Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" autocomplete="off">
  2. <label>Email : </label>
  3. <input type="email" name="email" class="form-control"/><br/>
  4. <label>Password : </label>
  5. <input type="password" name="password" class="form-control"/><br/>
  6.  
  7.  
  8. <hr/>
  9. <input type="submit" class="btn btn-warning" value="Login" name="login"/>&nbsp; or &nbsp;
  10. <a href="register.php" class="btn btn-success"><span class="glyphicon glyphicon-user"></span> Register an account</a>&nbsp;
  11.  
  12. <?php
  13. if (isset($_POST['login'])) {
  14. $email = $password = $error = "";
  15. $email = $_POST['email'];
  16. $password = md5($_POST['password']);
  17.  
  18. if (empty($email) || empty($password)) {
  19. $error = "Please enter your Email and Password!";
  20. } else {
  21. $sql = "SELECT * FROM tbl_users
  22. WHERE email='$email' && password='$password'";
  23. $res = mysql_query($sql);
  24. $user = mysql_num_rows($res);
  25.  
  26. if ($user['blocked'] == 'YES') {
  27. $error = "Your Account has been blocked. Please contact us for more info";
  28. } else {
  29. if ($user == 1) {
  30. $_SESSION['current_user'] = $email;
  31. header("Location: edit_profile.php");
  32. exit();
  33. } else {
  34. $error = "Wrong Email and Password";
  35. }
  36. }
  37.  
  38. }
  39. }
  40. ?>
  41. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement