Advertisement
Guest User

Untitled

a guest
Jan 17th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.41 KB | None | 0 0
  1. <?php
  2. $profpic = "bg.jpg";
  3. ?>
  4.  
  5. <html>
  6.     <head>
  7.         <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
  8. <style type="text/css">
  9. body
  10. {
  11.     background-image:url('<?php echo $profpic ?>');
  12. }
  13. </style>
  14.  
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  16. <title>Cinema</title>
  17.  
  18. <br><br>
  19. <p style="color: yellow; text-align: center"> Kérem adja meg mennyi összeget akar feltölteni, melyik vendég számlájára? </p>
  20.  
  21.         <table width=350 align=center border=1 cellspacing=0>
  22. <tr>
  23.     <td align=center> <p style="color: white; text-align: center">Vendeg ID </p> </td>
  24.     <td align=center> <p style="color: white; text-align: center">E-mail cím </p> </td>
  25.     <td align=center> <p style="color: white; text-align: center">Pénz </p> </td>
  26. </tr>
  27.  
  28. <?php
  29. $felh = "kibfc6";
  30. $jelszo = "eashobev";
  31. $uname = $_POST["uname"];
  32. $pass = $_POST["pass"];
  33.  
  34.        try
  35.        {
  36.           $dbh = new PDO('mysql:host=localhost;dbname=kibfc6', $felh, $jelszo);
  37.             $sql="SELECT * FROM vendeg";
  38.             $result = $dbh->query($sql);
  39.             $num = $result->rowCount();
  40.             # echo '<p style="color: yellow; text-align: center"> '.$num.' </p>';
  41.            if ($num > 0)
  42.             {
  43.                 $sth = $dbh->query('SELECT * FROM vendeg');
  44.                 $sth->setFetchMode(PDO::FETCH_OBJ);
  45.                
  46.                 while($row = $sth->fetch())
  47.                 {  
  48.                   echo '<tr>';
  49.                   echo '<td align=center><p style="color: yellow; text-align: center"> '.$row->vendeg_id.'  </p></td>';
  50.                   echo '<td align=center><p style="color: yellow; text-align: center"> '.$row->vendeg_email.'  </p></td>';          
  51.                   if ($row->penz == NULL)
  52.                   {
  53.                       echo '<td align=center><p style="color: yellow; text-align: center"> 0 Ft </p></td>';
  54.                   }
  55.                   else
  56.                   {
  57.                     echo '<td align=center><p style="color: yellow; text-align: center"> '.$row->penz.' Ft  </p></td>';  
  58.                   }                  
  59.                   echo '</tr>';
  60.                 }
  61.             }
  62.             else
  63.             {
  64.                 hibas();
  65.             }
  66.         }
  67.         catch (PDOException $e)
  68.         {
  69.             print "Hiba!: " . $e->getMessage() . "<br/>";
  70.             die();
  71.         }  
  72.  
  73.     function hibas()
  74.     {
  75.         $username = $uname;
  76.         $password = $pass;
  77.         echo '<br></br>';
  78.         echo '<p style="color: yellow; text-align: center"> Nincs vendeg az adatbázisban </p>';
  79.         echo "<html>";
  80.         echo '<table width=50 align=center border=0 cellspacing=0>';
  81.         echo '<form method="POST" action="admin.php" style="text-align: center">
  82.              <input type="hidden" name="uname" value='.$username.'>
  83.              <input type="hidden" name="pass" value='.$password.'>
  84.              <input style="background: yellow; border: none;" text-align="center" type="submit" value="Vissza">
  85.              </form>';
  86.         echo '</table>';
  87.         echo "</html>";
  88.     }
  89.    
  90.     $dbh = null;
  91.  
  92. ?>
  93.  
  94. <table width=350 align=center border=1 cellspacing=1>
  95.         <tr>
  96.             <td align=center>
  97.                 <form method="POST" action="ujpenzosszeg.php" style="text-align: center">
  98.                     <p style="color: yellow; text-align: center"> Vendeg ID </p>
  99.                     <input type="number" name="id" required>
  100.                     <p style="color: yellow; text-align: center"> Pénz összeg </p>
  101.                     <input type="number" name="penz" required>
  102.                     <br><br>
  103.                     <input type="hidden" name="uname" value=<?php echo ''.$uname.''?>>
  104.                     <input type="hidden" name="pass" value=<?php echo ''.$pass.''?>>
  105.                     <input style="background: yellow; border: none;" text-align="center" type="submit" value="Hozzáad">
  106.                 </form>                
  107.                 <form method="POST" action="admin.php" style="text-align: center">
  108.                 <input type="hidden" name="uname" value=<?php echo ''.$uname.''?>>
  109.                     <input type="hidden" name="pass" value=<?php echo ''.$pass.''?>>
  110.                     <input style="background: yellow; border: none;" text-align="center" type="submit" value="Mégse">
  111.                 </form>
  112.             </td>
  113.         </tr>
  114.     </table>
  115. </head>
  116. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement