Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.28 KB | None | 0 0
  1. <html>
  2.  
  3.    <body>
  4.  
  5.        <?php
  6.  
  7.                 $con = mysql_connect("localhost","root","");
  8.  
  9.                 if (!$con)
  10.  
  11.                 {
  12.  
  13.                         die('Could not connect: ' . mysql_error());
  14.  
  15.                 }
  16.  
  17.                 mysql_select_db("sandeep", $con);
  18.  
  19.                 if(mysql_num_rows(mysql_query("SELECT id FROM userlogin WHERE username = '".$_POST['uname']."' AND password = '".$_POST['pwd']."'")))
  20.  
  21.                 {
  22.  
  23.                         $result = mysql_query("SELECT * FROM userlogin");
  24.  
  25.                         echo "<table><tr>";
  26.  
  27.                         for($i = 0;$i < mysql_num_fields; $i++)
  28.  
  29.                                 echo "<th>".mysql_field_name($result,$i)."</th>";
  30.                                echo "</tr>";  
  31.  
  32.                         while($row = mysql_fetch_array($result))
  33.  
  34.                         {
  35.  
  36.                                 echo "<tr>";
  37.  
  38.                                 echo "<td>".$row['username']."</td>";
  39.  
  40.                                 echo "<td>".$row['password']."</td>";
  41.  
  42.                                 echo "</tr>";
  43.  
  44.                         }
  45.  
  46.                        echo "</table>";
  47.  
  48.                 } else
  49.  
  50.                 echo "Login denied";
  51.  
  52.         ?>
  53.  
  54.    <body>
  55.  
  56.  </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement