Guest User

Untitled

a guest
Apr 11th, 2016
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <link type="text/css" rel="stylesheet" href="stylesheet_battlefront.css"/>
  3. <body>
  4. <?php
  5. $servername = "localhost";
  6. $username = "root";
  7. $password = "usbw";
  8. $dbname = "games";
  9.  
  10. // Create connection
  11. $conn = new mysqli($servername, $username, $password, $dbname);
  12. // Check connection
  13. if ($conn->connect_error) {
  14.      die("Connection failed: " . $conn->connect_error);
  15. }
  16. ?>
  17. <div id="Top_Box">
  18.             <span> Welcome to Weirdgames.com! </span>
  19.             <img id="Logo" src="../images/Logo.png"></img>  
  20. </div>
  21.          <div id="Toolbar">
  22.             <ul>
  23.                 <li id="toolbar_text">
  24.                     <a href="Search_Game.php"> Back to search game!</a>
  25.                 </li>
  26.             </ul>  
  27.          </div>
  28.  
  29.          <div id="Gamepic">
  30. <?php
  31.         if (isset($_POST['Civ5'])) {
  32.     $video_game = " 'Civ5' ";
  33.     $path_to_image = "'../images/Civ5.jpg'";
  34.          }
  35.     if (isset($_POST['blop3'])) {
  36.     $video_game = " 'Call of Duty: Black Ops 3'";
  37.     $path_to_image = "'../images/Call of Duty_Black Ops 3.jpg'";
  38.         }
  39.     if (isset($_POST['front'])) {
  40.     $video_game = " 'Starwars Battlefront' ";
  41.     $path_to_image = "'..//images/Starwars Battlefront.jpg'";
  42.         }
  43. echo '<img src='.$path_to_image.'</img>'
  44. ?>
  45.          </div>
  46.          <div id="Infobox">
  47. <?php
  48. $query = "SELECT * FROM games WHERE Name = " .$video_game;
  49. $result = mysqli_query($query);
  50. if(!$result) {
  51. echo "Invalid query";
  52. }
  53.  
  54. while ($row = mysqli_fetch_array($result)) {
  55.     echo '<li>';
  56.     foreach($row as $field) {
  57.         echo $row['Name'];
  58.     }
  59.     echo '</li>';
  60. }
  61. $cart = array(
  62.   'Game' => $video_game,
  63.  
  64. );
  65. $file_str = serialize($cart);
  66. file_put_contents('cart.ini', $cart);
  67. ?>
  68.         </div>
  69.          
  70. <div>
  71.     <form method="post" action="cart.php">
  72.         <input type="submit" name="buy it!" value="buy it!"/>
  73.     </form>
  74. </div>       
  75.     </body>
  76. </html>
Add Comment
Please, Sign In to add comment