Advertisement
Guest User

Untitled

a guest
Oct 27th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. <?php
  2.  
  3. session_set_cookie_params(86400);
  4. date_default_timezone_set('Europe/Amsterdam');
  5.  
  6. include('positioning.php');
  7. include ('database_connection.php');
  8.  
  9. if (isset($_POST['formsubmitted'])) {
  10. session_start();
  11.  
  12. $error = array();
  13.  
  14. if (empty($_POST['e-mail'])) {//if the email supplied is empty
  15. $error[] = 'Je hebt je email vergeten.';
  16. } else {
  17.  
  18.  
  19. if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['e-mail'])) {
  20.  
  21. $Email = $_POST['e-mail'];
  22. } else {
  23. $error[] = 'Je email address is ongeldig';
  24. }
  25. }
  26.  
  27. if (empty($_POST['Password'])) {
  28. $error[] = 'Je hebt je wachtwoord vergeten.';
  29. } else {
  30. $Password = $_POST['Password'];
  31. }
  32. if (empty($error))//if the array is empty , it means no error found
  33. {
  34. $query_check_credentials = "SELECT * FROM members WHERE (Email='$Email' AND password='$Password') AND Activation IS NULL";
  35.  
  36. $result_check_credentials = mysqli_query($dbc, $query_check_credentials);
  37. if(!$result_check_credentials){//If the QUery Failed
  38. echo 'Query Failed ';
  39. }
  40.  
  41. if (@mysqli_num_rows($result_check_credentials) == 1)//if Query is successfull
  42. { // A match was made.
  43.  
  44. $query1 = "UPDATE members SET Timesloggedin = Timesloggedin + 1, WHERE e-mail ='$Email'";
  45. $query2 = "UPDATE members SET Lastloggedin = NOW() WHERE e-mail ='$Email'";
  46.  
  47. mysqli_multi_query($dbc, $query1, $query2);
  48.  
  49. echo $query1;
  50. echo $query2;
  51. mysqli_close($dbc);
  52.  
  53. $_SESSION['loggedin'] = notnull;
  54. header('Location: middle.php');
  55.  
  56.  
  57. }else
  58. {
  59.  
  60. $msg_error= 'Je account is inactief, ongeldig of je wachtwoord is verkeerd /Password is Incorrect';
  61. }
  62.  
  63. } else {
  64.  
  65.  
  66.  
  67. echo '<div class="errormsgbox"> <ol>';
  68. foreach ($error as $key => $values) {
  69.  
  70. echo ' <li>'.$values.'</li>';
  71.  
  72. }
  73. echo '</ol></div>';
  74. }
  75.  
  76. if(isset($msg_error)){
  77.  
  78. echo '<div class="warning">'.$msg_error.' </div>';
  79. }
  80. }
  81.  
  82.  
  83.  
  84. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement