Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. // Create connection
  2. $conn = new mysqli($servername, $username, $password, $dbname);
  3.  
  4.  
  5. // Check connection
  6. if ($conn->connect_error) {
  7. die("Connection failed: " . $conn->connect_error);
  8. }
  9. $email=$password="";
  10. $error_email=$error_password="";
  11. if(isset($_POST['submit']))
  12. {
  13. $email=trim($_POST['email']);
  14. $password=trim($_POST['password']);
  15.  
  16. if($email=="")
  17. {
  18. $error_email="Email field is required";
  19. }
  20. if($password=="")
  21. {
  22. $error_password="Password field is required";
  23. }
  24.  
  25.  
  26. if($email!="")
  27. {
  28.  
  29. if (!filter_var($email, FILTER_VALIDATE_EMAIL))
  30. {
  31. $error_email=" Invalid email address";
  32.  
  33. }
  34. else
  35. {
  36. if($error_email=="" && $error_password=="")
  37. {
  38. $query="SELECT * from tbluser where email='$email' AND password='$password'";
  39. $extquery=$conn->query($query);
  40.  
  41. $getRec=$extquery->fetch_assoc();
  42. if($getRec)
  43. {
  44. $_SESSION['user_detail']=$getRec;
  45.  
  46.  
  47. //print_r($_SESSION['user_detail']['name']); die;
  48. header('location: http://videwatch.in');
  49. }
  50. else
  51. {
  52. $error_email="Invalid email and password";
  53. $error_password="Invalid email and password";
  54. }
  55.  
  56. }
  57.  
  58. }
  59.  
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement