SHARE
TWEET

Untitled

a guest Mar 20th, 2016 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <Form Name ="form1" Method ="POST" ACTION = "login.php">
  2.  
  3. <label>Username: </label>
  4. <input type="text" name="pat_username" id="username" required="required" placeholder="username"/><br/><br />
  5.  
  6. <label>Password: </label>
  7. <input type="password" name="pat_password" id="password" required="required" placeholder="password"/><br/><br />
  8.  
  9. <input type="submit" value=" Submit " name="submit"/><br />
  10.  
  11. </form>
  12.    
  13. <?php
  14. if(isset($_POST["submit"])){
  15. $servername = "localhost";
  16. $username = "root";
  17. $password = "password";
  18. $dbname = "hospital";
  19.  
  20. // Create connection
  21. $conn = new mysqli($servername, $username, $password, $dbname);
  22.  
  23. Check connection
  24.     if ($conn->connect_error) {
  25.             die("Connection failed: " . $conn->connect_error);
  26.     }
  27.  
  28.  
  29.   $username = mysqli_real_escape_string($_POST['pat_username']);
  30.   $password = mysqli_real_escape_string($_POST['pat_password']);
  31.  
  32.   $result = mysqli_query($connect, "SELECT * FROM patients WHERE patient_username='".$username."' AND patient_password='".$password."' AND activate='0'");
  33.  
  34.   if ($result->num_rows) {      
  35.       echo "login successfull";    
  36.       }
  37.  
  38.     else
  39.  
  40.         {      
  41.             echo "login unsuccessfull, please try again";    
  42.         }
  43. $conn->close();
  44. }
  45. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top