Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_set_cookie_params(86400);
- date_default_timezone_set('Europe/Amsterdam');
- include('positioning.php');
- include ('database_connection.php');
- if (isset($_POST['formsubmitted'])) {
- session_start();
- $error = array();
- if (empty($_POST['e-mail'])) {//if the email supplied is empty
- $error[] = 'Je hebt je email vergeten.';
- } else {
- if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['e-mail'])) {
- $Email = $_POST['e-mail'];
- } else {
- $error[] = 'Je email address is ongeldig';
- }
- }
- if (empty($_POST['Password'])) {
- $error[] = 'Je hebt je wachtwoord vergeten.';
- } else {
- $Password = $_POST['Password'];
- }
- if (empty($error))//if the array is empty , it means no error found
- {
- $query_check_credentials = "SELECT * FROM members WHERE (Email='$Email' AND password='$Password') AND Activation IS NULL";
- $result_check_credentials = mysqli_query($dbc, $query_check_credentials);
- if(!$result_check_credentials){//If the QUery Failed
- echo 'Query Failed ';
- }
- if (@mysqli_num_rows($result_check_credentials) == 1)//if Query is successfull
- { // A match was made.
- $query1 = "UPDATE members SET Timesloggedin = Timesloggedin + 1, WHERE e-mail ='$Email'";
- $query2 = "UPDATE members SET Lastloggedin = NOW() WHERE e-mail ='$Email'";
- mysqli_multi_query($dbc, $query1, $query2);
- echo $query1;
- echo $query2;
- mysqli_close($dbc);
- $_SESSION['loggedin'] = notnull;
- header('Location: middle.php');
- }else
- {
- $msg_error= 'Je account is inactief, ongeldig of je wachtwoord is verkeerd /Password is Incorrect';
- }
- } else {
- echo '<div class="errormsgbox"> <ol>';
- foreach ($error as $key => $values) {
- echo ' <li>'.$values.'</li>';
- }
- echo '</ol></div>';
- }
- if(isset($msg_error)){
- echo '<div class="warning">'.$msg_error.' </div>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement