Visa källkod

Nedanstående filer finns i denna katalog. Klicka på en fil för att visa dess innehåll.

bth-cards/

  1. .buildpath
  2. .project
  3. CCard.php
  4. CCardHand.php
  5. CDeck.php
  6. argyle.jpg
  7. card.php
  8. common.php
  9. deck.php
  10. grunge.jpg
  11. hand.php
  12. index.php
  13. sessDest.php
  14. sessions.php
  15. sessions_mroos.php
  16. source.php
  17. template.php
  18. tiles.jpg

Stäng "deck.php"

<?php

// ===============================================================
// Contents: Kortgrejer.
// Author: Staffan Lindsgård
// ===============================================================

$pagetitle = "Korta leken!";
$customhead = "";

require_once "common.php";
echo $page_top;


// ===============================================================
// Inkluderar externa PHP-filer.

require_once "CDeck.php";


// ===============================================================
// Inställningar för felsökning.

error_reporting(-1);
$debug = false;
$debug = (empty($_GET['debug']) ? $debug : $_GET['debug']);
$debug = ($debug=="true" ? true : false);
$debug_out = "<h1 class='debug'>Debug info</h1>\n";


// ===============================================================
// Skriver lite variabler.

$deck1 = new CDeck();
$html = "<h2>Visa kort i en oblandad lek</h2>\n";
while($card = $deck1->DealFromTop()) {
	$card->FlipCard();
	$html .= $card->GetCardAsCSS();
}

$deck2 = new CDeck();
$deck2->Shuffle();
$html .= "<h2>Visa fem kort från en blandad lek</h2>\n";
for($i = 1; $i <= 5; $i++) {
	$card = $deck2->DealFromTop();
	$card->FlipCard();
	$html .= $card->GetCardAsCSS();
}

?>

<h1>Hur ser min kortlek ut?</h1>
<?php echo $html; ?>
<?php echo ($debug == true ? $debug_out : ''); ?>

<?php
echo $page_bottom;
?>