sigrok decoder for caliper
[mirrors/Programs.git] / php / gamebook / gamebook.php
CommitLineData
ec14f546
TM
1<html><?php\r
2///////////////////////\r
3//GameBook Engine 0.1\r
4//Coded: Harvie 2oo7\r
5///////////////////////\r
6\r
7//Config:\r
8$osud = "Osud rozhodl: ";\r
9\r
10//PARAMETERS///////////////////////////////////////////////////////\r
11if (isset($_GET["book"]))\r
12 { $book = $_GET["book"]; }\r
13 else\r
14 { $book = "game01.txt"; }\r
15\r
16if (isset($_GET["pos"]))\r
17 { $pos = $_GET["pos"]; }\r
18 else\r
19 { $pos = 2; }\r
20\r
21///////////////////////////////////////////////////////////////////\r
22\r
23//Init:\r
24$game = file($book);\r
25$descs = explode("|", $game[0]);\r
26//print_r($descs);\r
27$room = $game[($pos - 1)];\r
28\r
29\r
30?>\r
31<head>\r
32 <title><?php echo($descs[0]); ?></title>\r
33</head>\r
34\r
35<body>\r
36<h1><?php echo($descs[0]); ?> ( OpenGameBook )</h1>\r
37<h2><?php echo($descs[1]); ?></h2>\r
38<h3>Kapitola: <?php echo($descs[2]); ?></h3>\r
39<?php echo($descs[3]); ?>\r
40<hr />\r
41<a href="?book=game01.txt">?book=game01.txt</a> - UKAZKOVA HRA<br />\r
42<a href="?book=game01.txt&pos=1">?book=game01.txt&amp;pos=1</a> - UVOD<br />\r
43<a href="?book=game01.txt&pos=2">?book=game01.txt&amp;pos=2</a> - UKAZKOVY SAVEGAME<br />\r
44<a href="./game01.txt">./game01.txt</a> - UKAZKA DATOVEHO SOUBORU GAMEBOOKU\r
45<hr /><br /><br />\r
46<?php\r
47\r
48\r
49//Random:\r
50if ( strpos( (" ".$room), "{") != 0 ) {\r
51 $rnd = explode("{", $room);\r
52 $rnd = explode("}", $rnd[1]);\r
53 $rnd = explode("\\\\", $rnd[0]);\r
54 $irand = rand(0, (sizeof($rnd)-1) );\r
55 $osudout = ("<br /><a href=\"?book=".$book."&pos=".$rnd[$irand]."\">".$osud . $rnd[$irand]."</a>"); \r
56}\r
57\r
58//Parse links:\r
59$room = str_replace("[", "<a href=\"?book=".$book."&pos=", $room);\r
60$room = str_replace("|", "\">", $room);\r
61$room = str_replace("]", "</a>", $room);\r
62$room = str_replace("\\\\", " nebo ", $room);\r
63\r
64//Output:\r
65echo ("<b>".$pos.":</b> ".$room);\r
66echo ($osudout);\r
67\r
68?>\r
69<hr />\r
70</body>\r
71\r
72</html>
This page took 0.91249 seconds and 4 git commands to generate.