Guest User

Untitled

a guest
Jan 17th, 2016
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.52 KB | None | 0 0
  1. <?php
  2. $profpic = "bg.jpg";
  3. ?>
  4.  
  5. <head>
  6.     <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
  7. <style type="text/css">
  8.     body
  9.     {
  10.         background-image:url('<?php echo $profpic ?>');
  11.     }
  12. </style>
  13.  
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  15. <title>Cinema</title>
  16.  </head>
  17. <?php
  18. $moziid = $_POST["id"];
  19. $mozinev = $_POST["nev"];
  20. $varos = $_POST["city"];
  21. $utca = $_POST["street"];
  22. $hazszam = $_POST["number"];
  23. $uname = $_POST["uname"];
  24. $pass = $_POST["pass"];
  25. $felh = "kibfc6";
  26. $jelszo = "eashobev";
  27.  
  28.        try
  29.        {
  30.           $dbh = new PDO('mysql:host=localhost;dbname=kibfc6', $felh, $jelszo);
  31.             $sql= "SELECT mozi_id FROM mozi WHERE mozi_id='".$moziid."'";
  32.             $result = $dbh->query($sql);
  33.             $num=$result->rowCount();
  34.             if($num==1)
  35.             {
  36.                 if ($mozinev == "")
  37.                 {
  38.                    
  39.                     $sql2 = "SELECT mozi_id, mozi_nev from mozi";
  40.                     $sth = $dbh->query($sql2);
  41.                     $sth->setFetchMode(PDO::FETCH_OBJ);
  42.                     while($row = $sth->fetch())
  43.                     {
  44.                         if ($row->mozi_id == $moziid) $mozinev = $row->mozi_nev;
  45.                     }
  46.                    
  47.                 }
  48.                 if ($varos == "")
  49.                 {
  50.                    
  51.                     $sql2 = "SELECT mozi_id, varos from mozi";
  52.                     $sth = $dbh->query($sql2);
  53.                     $sth->setFetchMode(PDO::FETCH_OBJ);
  54.                     while($row = $sth->fetch())
  55.                     {
  56.                         if ($row->mozi_id == $moziid) $varos = $row->varos;
  57.                     }
  58.                    
  59.                 }
  60.                 if ($utca == "")
  61.                 {
  62.                    
  63.                     $sql2 = "SELECT mozi_id, utca from mozi";
  64.                     $sth = $dbh->query($sql2);
  65.                     $sth->setFetchMode(PDO::FETCH_OBJ);
  66.                     while($row = $sth->fetch())
  67.                     {
  68.                         if ($row->mozi_id == $moziid) $utca = $row->utca;
  69.                     }
  70.                    
  71.                 }
  72.                 if ($hazszam == "")
  73.                 {
  74.                    
  75.                     $sql2 = "SELECT mozi_id, hazszam from mozi";
  76.                     $sth = $dbh->query($sql2);
  77.                     $sth->setFetchMode(PDO::FETCH_OBJ);
  78.                     while($row = $sth->fetch())
  79.                     {
  80.                         if ($row->mozi_id == $moziid) $hazszam = $row->hazszam;
  81.                     }
  82.  
  83.                 }
  84.                 $sth = $dbh->prepare("UPDATE mozi SET mozi_nev = '".$mozinev."', varos = '".$varos."', utca = '".$utca."', hazszam = '".$hazszam."' WHERE mozi_id = '".$moziid."'");
  85.                 $sth->execute();
  86.                 sikeres($uname, $pass);
  87.             }
  88.             else
  89.             {
  90.                 nincsIlyen($uname, $pass);
  91.             }
  92.         }
  93.         catch (PDOException $e)
  94.         {
  95.             print "Hiba!: " . $e->getMessage() . "<br/>";
  96.             die();
  97.         }  
  98.  
  99.     function sikeres($uname, $pass)
  100.     {
  101.         $username = $uname;
  102.         $password = $pass;
  103.         echo '<br></br>';
  104.         echo '<p style="color: yellow; text-align: center"> Mozi adatai sikeresen módosítva </p>';
  105.         echo "<html>";
  106.         echo '<form method="POST" action="mozi_modosit.php">
  107.                            <input type="hidden" name="uname" value='.$username.'>
  108.                            <input type="hidden" name="pass" value='.$password.'>
  109.                            <input style="background: yellow; border: none;" type="submit" value="Vissza">
  110.                            </form>;';
  111.                             echo "</html>";
  112.     }
  113.  
  114.     function nincsIlyen($uname, $pass)
  115.     {
  116.         $username = $uname;
  117.         $password = $pass;
  118.         echo '<br></br>';
  119.         echo '<p style="color: yellow; text-align: center"> Nincs ilyen mozi, amit módosítani szeretne </p>';
  120.         echo "<html>";
  121.         echo '<form method="POST" action="mozi_modosit.php">
  122.                            <input type="hidden" name="uname" value='.$username.'>
  123.                            <input type="hidden" name="pass" value='.$password.'>
  124.                            <input style="background: yellow; border: none;" type="submit" value="Vissza">
  125.                            </form>;';
  126.                             echo "</html>";
  127.     }
  128.    
  129.     $dbh = null;
  130. ?>
Add Comment
Please, Sign In to add comment