Advertisement
Guest User

Untitled

a guest
Mar 5th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1. <?php
  2.     include('database.php');
  3.    
  4.     $sql = "SELECT * from user";
  5.     $result = mysqli_query($conn, $sql);
  6.    
  7.     if(isset($_POST['uName'] && isset($_POST['uPass'])))
  8.     {
  9.         // User is trying to authenticate
  10.         // MD5 for the password
  11.        
  12.         // Retrieve the password from DB
  13.        
  14.         // See if they match
  15.        
  16.         // User is home:
  17.         echo "Hello, " . $_POST['iName'] . " ". md5($_POST['iName']);
  18.        
  19.         // User is rejected:
  20.     }
  21.     else
  22.     {
  23.         echo "
  24.         <html>
  25.         <title>
  26.         Register
  27.         </title>
  28.        
  29.         <body>
  30.        
  31.         ";
  32.         /*
  33.         if(mysqli_num_rows($result) > 0)
  34.         {
  35.             while($row = mysqli_fetch_assoc($result))
  36.             {
  37.                 echo "<tr> <td>id</td><td>".$row["id"] . "</td><td>name</td><td>" . $row["name"] . "</td></tr>";
  38.             }
  39.         }
  40.         else
  41.         {
  42.             echo "0 results.";
  43.         }      
  44.         */
  45.         echo "
  46.         Enter your username, password and other required data...
  47.         <form action=\"loginReader.php\" method=\"POST\">
  48.             Username: <input type=\"text\" id=\"uName\" name=\"uName\" size=\"20\"/>
  49.             <br/>
  50.             Password: <input type=\"password\" name=\"uPass\" id=\"uPass\" size=\"20\"/>
  51.             <br/>
  52.             <input type=\"submit\" value=\"LOGIN!\"/>
  53.             <br/>
  54.         </form>
  55.         <a href=\"register.php\">Register</a>
  56.         </body>
  57.         </html>    
  58.         ";
  59.        
  60.     }
  61.     mysqli_close($conn);
  62.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement