Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1.  <html>
  2.    <body>
  3.        <?php
  4.             $con = mysql_connect("localhost","root","");
  5.         if (!$con)
  6.         {
  7.             die('Could not connect: ' . mysql_error());
  8.         }
  9.         mysql_select_db("sandeep", $con);
  10.         if(mysql_query("SELECT username FROM userlogin WHERE username = '".$_POST['uname']."' AND password = '".$_POST['pwd']."'"))
  11.         {
  12.             $result = mysql_query("SELECT * FROM userlogin");
  13.             echo "<table>";
  14.             for($i = 0;$i < mysql_num_fields(); $i++)
  15.                     echo "<th>".mysql_field_name($result,$i)."</th>";  
  16.                 while($row = mysql_fetch_array($result))
  17.                 {
  18.                     echo "<tr>";
  19.                     echo "<td>".$row['username']."</td>";
  20.                     echo "<td>".$row['password']."</td>";
  21.                     echo "</tr>";
  22.             }
  23.                echo </table>;
  24.         } else
  25.         echo "Login denied";
  26.         ?>
  27.    <body>
  28.  </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement