Advertisement
mvujas

PHP vurnabilities details.php

Dec 1st, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.74 KB | None | 0 0
  1. <?php
  2.     require_once ("database_utils.php");
  3.     initDB();
  4.  
  5.     $errors = array();
  6. ?>
  7. <html>
  8.     <head>
  9.         <title>Bioskop | Detalji</title>
  10.         <link rel="stylesheet" type="text/css" href="css/style.css">
  11.         <link href="https://fonts.googleapis.com/css?family=Spectral+SC" rel="stylesheet">
  12.     </head>
  13.     <body>
  14.         <h1>Detalji rezervacije</h1>
  15.         <a href="./"><button>Povratak na početnu stranu</button></a>
  16.         <!-- Nije direktno podlozan -->
  17.         <?php
  18.             $reservation_movie_id = "";
  19.             $reservation_seat = "";
  20.             if (isset($_GET["movie"])) {
  21.                 $reservation_movie_id = $_GET["movie"];
  22.             }
  23.             if (isset($_GET["seat"])) {
  24.                 $reservation_seat = $_GET["seat"];
  25.             }
  26.  
  27.             $seat_exploded = explode("-", $reservation_seat);
  28.             $row = "-";
  29.             $col = "-";
  30.             if (count($seat_exploded) == 2) {
  31.                 $row = $seat_exploded[0];
  32.                 $col = $seat_exploded[1];
  33.             } else {
  34.                 $errors[] = "Format sedišta nije odgovarajući.";
  35.             }
  36.  
  37.             $reservation = getReservation($reservation_movie_id, $reservation_seat);
  38.             $reservation[COL_RES_NAME] = htmlspecialchars($reservation[COL_RES_NAME]);
  39.             $reservation[COL_RES_PHONE] = htmlspecialchars($reservation[COL_RES_PHONE]);
  40.             $reservation[COL_RES_EMAIL] = htmlspecialchars($reservation[COL_RES_EMAIL]);
  41.             if ($reservation) {
  42.                 echo "<h2>Rezervacija za film {$reservation[COL_MOVIE_NAME]}, red $row, kolona $col</h2>";
  43.                 echo "<p>Ime: <b>{$reservation[COL_RES_NAME]}</b></p>";
  44.                 echo "<p>Telefon: <b>{$reservation[COL_RES_PHONE]}</b></p>";
  45.                 echo "<p>Email: <b>{$reservation[COL_RES_EMAIL]}</b></p>";
  46.             } else {
  47.                 $errors[] = "Tražena rezervacija ne postoji.";
  48.             }
  49.         ?>
  50.         <div class="errors">
  51.             <?php
  52.                 foreach ($errors as $error) {
  53.                     echo "<div>$error</div>";
  54.                 }
  55.             ?>
  56.         </div>
  57.     </body>
  58. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement