hi all...how are u? i have a question , i'm creatingn a php login system for a forum but i'm new in php and i'm not able to put session timing for the login ..i want when the user login to register the session and then after login in ..if the user is not active for 5 minutes i want him to be redirected to the login page again...i was reading a topic for php session ..but i did not get it ..please help ....that's my code:
<?php
session_start();
?>
<html>
<head>
<title></title>
</head>
<body>
<?php
$dbh=@mysql_connect('localhost','root','');
if(!$dbh){
exit('Unable to connect');
}
if(!@mysql_select_db('ijdb')){
exit('Unable to find ijdb');
}
$result=@mysql_query('select * from users');
if(!$result){
exit('no data found');
}
$t=0;
$u=$_REQUEST['un'];
$p=$_REQUEST['pass'];
$encpass=md5($p);
while($row=mysql_fetch_array($result)){
if(($row['name']== $u) and ($row['pass']==$encpass)){
$t=1;
}
}
if($t==1){
$_SESSION['user']=$u;
$_SESSION['pass']=$p;
header("Location: http://www.forum.com/welcome.php");
}
if($t==0){
echo FAUX;
}
?>
</body>
</html>