Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <link type="text/css" rel="stylesheet" href="stylesheet_battlefront.css"/>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "usbw";
- $dbname = "games";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- ?>
- <div id="Top_Box">
- <span> Welcome to Weirdgames.com! </span>
- <img id="Logo" src="../images/Logo.png"></img>
- </div>
- <div id="Toolbar">
- <ul>
- <li id="toolbar_text">
- <a href="Search_Game.php"> Back to search game!</a>
- </li>
- </ul>
- </div>
- <div id="Gamepic">
- <?php
- if (isset($_POST['Civ5'])) {
- $video_game = " 'Civ5' ";
- $path_to_image = "../images/Civ5.jpg";
- }
- if (isset($_POST['blop3'])) {
- $video_game = " 'Call of Duty: Black Ops 3' ";
- $path_to_image = "../images/Call of Duty_Black Ops 3.jpg";
- }
- if (isset($_POST['front'])) {
- $video_game = " 'Starwars Battlefront' ";
- $path_to_image = "../images/Starwars Battlefront.jpg";
- }
- echo '<img src='.$path_to_image.'></img>'
- ?>
- </div>
- <div id="Infobox">
- <?php
- $query = "SELECT * FROM games WHERE Name = " .$video_game;
- $result = mysqli_query($conn, $query);
- if(!$result) {
- echo "Invalid query";
- }
- while ($row = mysqli_fetch_array($result, MYSQL_BOTH)) {
- echo '<li>';
- foreach($row as $field) {
- echo $row['Name'];
- }
- echo '</li>';
- }
- $cart = array(
- 'Game' => $video_game,
- );
- $file_str = serialize($cart);
- file_put_contents('cart.ini', $cart);
- ?>
- </div>
- <div>
- <form method="post" action="cart.php">
- <input type="submit" name="buy it!" value="buy it!"/>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement