Jump to content

Last login not showing correctly.


Go to solution Solved by scootstah,

Recommended Posts

Hello everyone. 

 

With my current coding on the login page, it seems to only set the last logged in date per month, which results in the following:

 

 

Hg5mNLw.jpg

 

It seems to set the date logged in only once per month. It's always on the 15th of a month, however the times are all different times. I don't understand why it only sets the dates to the 15th of each month rather then just the actual date a user logged in on? 

 

This is my current code: 

if($login_ok) 
			{ 
				if($row2['status'] == 0) 
				{
					if($row['suspended'] == 1)
					{
						header("Location: usersuspended.php"); 
						exit;
					} 
					else
					{
						unset($row['salt']); 
						unset($row['password']); 
						$_SESSION['loggedin'] = 1;
						$_SESSION['user'] = $row; 
						$_SESSION['username'] = $_POST['username'];
						$_SESSION['adminlevel'] = $adminlevel;
						$_SESSION['userid'] = $userid;
						$_SESSION['verifypend'] = $verifypend;
						$_SESSION['donator'] = $donator;
						
						$query = " 
							UPDATE users 
								SET lastlogged = :date
							WHERE 
								username = :username 
						"; 
						 
						$query_params = array( 
							':date' => date('Y-m-y H:i:s'),
							':username' => $_POST['username'] 
						); 
						 
						try 
						{ 
							$stmt = $db->prepare($query); 
							$result = $stmt->execute($query_params); 
						} 
						catch(PDOException $ex) 
						{ 

							die("Failed to run query: " . $ex->getMessage()); 
						}
Link to comment
https://forums.phpfreaks.com/topic/297213-last-login-not-showing-correctly/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.