123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <html>
- <style>
- .center {
- margin-left: auto;
- margin-right: auto;
- font-size: 32px;
- }
- p {text-align: center;}
- </style>
- <?php
- include 'functions.php';
- include 'config.php';
- $ID=$_GET["ID"];
- $ShowUser=$_GET["User"];
- if($ID!="")
- {
- $sql = "SELECT Name, Text, Options, Image FROM stor WHERE RefID=?";
- $stmt = $conn->prepare($sql);
- $stmt->bind_param("i", $ID);
- $stmt->execute();
- $result = $stmt->get_result();
- if ($result->num_rows > 0)
- {
- // output data of each row
- while($row = $result->fetch_assoc())
- {
- echo '<table class="center">
- <tr>
- <th>' . applyBB($row["Name"]) . ' </th>
- </tr>';
- if($row["Image"]!="0")
- {
- $imLink="images/0.jpg";
- $sql3 = "SELECT Link, Unlocked, Alt FROM Images WHERE ID=?";
- $stmt = $conn->prepare($sql3);
- $into=$row["Image"];
- $stmt->bind_param("i", $into);
- $stmt->execute();
- $result3 = $stmt->get_result();
- $imDes="";
- while($row2 = $result3->fetch_assoc())
- {
- if($row2["Unlocked"]=='1')
- {
- $imLink=$row2["Link"];
- $imDes=$row2["Alt"];
- }
- }
- echo '<tr>
- <td><p></align><img src="' . $imLink . '" alt="'. htmlentities($imDes) .'" style="width:400px;"></p></td>
- </tr>';
- }
- echo '<tr>
- <td>' . nl2br(applyBB($row["Text"])) . '</td>
- </tr>
- <tr>
- <td></td>
- </tr>';
- $Options=$row["Options"];
- if($Options!="")
- {
- $choices= explode(" ", $Options);
- $arrLength = count($choices);
- $l=1;
- for($i = 0; $i < $arrLength; $i++)
- {
-
-
- $sql2 = "SELECT Description FROM stor WHERE RefID=?";
- $stmt = $conn->prepare($sql2);
- $stmt->bind_param("i", $choices[$i]);
- $stmt->execute();
- $result2 = $stmt->get_result();
- while($row2 = $result2->fetch_assoc())
- {
- if($row2["Description"]!="")
- {
- echo "<tr><td><a href=reader.php?ID=".$choices[$i]."> " . $l . ": " ;
- echo htmlentities($row2["Description"]);
- echo "</a></td></tr> ";
- $l=l+1;
- }
- }
- }
-
- }
- echo "</table>";
- }
- }
- else
- {
- echo "Invalid ID";
- }
- }
- else
- {
- if($ShowUser=='')
- {
- echo '<p style="font-size:32px; ">Available Stories: </p>';
- $sql = "SELECT ID, Title, Opener, Description, Owner FROM Stories ORDER BY rand()";
- $stmt = $conn->prepare($sql);
- $stmt->execute();
- $result = $stmt->get_result();
- echo "<br>";
- if ($result->num_rows > 0)
- {
- while($row = $result->fetch_assoc())
- {
- echo "<br><a href=reader.php?ID=".$row["Opener"].">".htmlentities($row["Title"])."</a> <br> <i>".htmlentities($row["Description"])."</i>" ;
- echo "<br>";
- }
- }
- }
- else
- {
-
- }
- }
- ?>
- </html>
|