Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <html>
  2. <?php
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $dbname = "Doctor_Patient";
  7. $conn = new mysqli($servername, $username, $password, $dbname);
  8.  
  9. $sql = "SELECT D_Mail_Id,D_appoinmentNo FROM doctor";
  10. $email=$_GET['email'];
  11. $pass=$_GET['password'];
  12. print "$email";
  13. if ($conn->connect_error) {
  14.     echo "Dead";
  15.     die("Connection failed: " . $conn->connect_error);
  16. }
  17. getData($conn,$sql,1);
  18. $sql = "SELECT L_Name,L_Id FROM labrotorian";
  19. getData($conn,$sql,3);
  20. function getData($conn,$sql,$value)
  21. {
  22.     while($row=mysqli_fetch_assoc($result1))
  23.     {
  24.         $check_username=$row['username'];
  25.         $check_password=$row['password'];
  26.     }
  27.  
  28.     if($email == $check_username && $pass == $check_password && $value==1){
  29.         mysqli_close($conn);
  30.         header ('location: Doctor/index.php');
  31.  
  32.     }else if($email == $check_username && $pass == $check_password && $value==2){
  33.         mysqli_close($conn);
  34.         header ('location: Patient/index.php');
  35.  
  36.     }else if($email == $check_username && $pass == $check_password && $value==3){
  37.         mysqli_close($conn);
  38.         header ('location: Lab/index.php');
  39.     }
  40.     else{
  41.     //<script src=wrongpass.js></script>
  42.     header ('location: index.php');
  43.     }
  44. }
  45. mysqli_close($conn);
  46. ?>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement