/    Sign up×
Community /Pin to ProfileBookmark

Tracking Time out of user

I have the following script for tracking user. I need help how to define variable for TimeOUT ($timeout). Please help. :rolleyes:

Code is the following:

[code=php]

<?PHP
/* Connect to MySQL-Server */

/* Open $db */

$username=$_COOKIE[‘username’];

// I would like to Update The Session TimeOut
$result = query( “UPDATE users_sessions
SET
timeout = UNIX_TIMESTAMP()+{$timeout} WHERE
SESSID = ‘{$SESSID}'” );
$result1 = mysql_query($result);
}

// Setcookies and authentication

if($_POST[‘remember’] != ‘1’)

{

$SESSID = md5( time() );

$sql = query(” DELETE FROM users_sessions WHERE username = ‘{$_POST[‘usernamelogin’]}'”);
$sql = mysql_query($sql);

$result= query (” INSERT INTO users_sessions SET
`SESSID` = ‘{$SESSID}’,
`username` = ‘{$_POST[‘usernamelogin’]}’,
`IP` = ‘{$_SERVER[‘REMOTE_ADDR’]}’,
`TimeOut` = UNIX_TIMESTAMP()+{$timeout}” );
$result2 = mysql_query($result);
}

else

{
// Checking CheckBox Remember Me
if( $_POST[‘remember’] == ‘1’ )
{
setcookie(‘username’, $_POST[‘usernamelogin’], time() + 60*60*24*30 );
}
else
{
setcookie(‘username’, $_POST[‘usernamelogin’]);
}

}
?>
[/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @toplisek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...