Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2011, 02:39 AM
Authorized User
 
Join Date: Jul 2011
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default login using sessionid or time

hi all,
i have written a code in php using sessions.below is the code......

Code:
<?php
if(!isset($_SESSION)) 
{
 session_start();
}
$now = time();
$limit = $now;
if(isset($_SESSION['last_activity']) && ($_SESSION['last_activity'] < $limit)) 
{
 $_SESSION = array();
 header('Location:logout.php');
 exit;
} 
else 
{
//the current time
$_SESSION['last_activity'] = $now;
}
?>
.
tell me how to modify in the above code that if the user is entering for first
time then using time() or sessionid it should be stored
or else if he is entering for first time then using current time() or sessionid
it must be stored.....





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reset the SessionID? akkad C# 2 October 24th, 2007 06:49 AM
question about login and "remember me next time" hertendreef ASP.NET 2.0 Professional 0 February 14th, 2007 07:29 AM
single user login at a time dayarprasad MySQL 1 June 23rd, 2006 11:08 PM
only one login allowed at a time using one userid chayanvinayak PHP How-To 2 May 1st, 2006 01:54 PM
How to Generate my own SESSIONID anand_asv .NET Framework 2.0 0 March 2nd, 2005 10:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.