Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Strategic problem of logouts

Links for php scripts

Moderators: macek, egami, gesf

Strategic problem of logouts

Postby sansoft » Thu May 20, 2004 5:26 am

Hi,

this one's very imp for me.i have got two links on a single form namely logintime and logouttime. when the user comes to the office and starts the project he/she first logs in and after 8 hrs of work logs out.

ok fine thats happening.......no issues.the values are inserted in the table taskdatetime when logging in and updated when "logging out".

now there may be some cheaters who can keep on updating the logout field.

what i want is once u "LOGOUT" of the scene there can be no way a user can again update the table.Any suggesstions???below is the code.....which can be updated at any time.i dont want that...plz help



Code: Select all

include"../include/mysqlconnect.php";

$now = time();

$anh = $date = date("Y-m-d H:i:s a",$now);

$sql="update taskdatetime set outtime='$anh' where user_id='$sesuserid'" ;

$result=mysql_query($sql,$conn);







sansoft
New php-forum User
New php-forum User
 
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India

Postby Redcircle » Thu May 20, 2004 3:15 pm

now there may be some cheaters who can keep on updating the logout field.

I'm not exactly sure what you mean by this. They are extending the logout time after they have logged out?
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby gesf » Thu May 20, 2004 11:58 pm

I supose you´re working with sessions and/or cookies in some way!
Anyway, you need to check if the user is active (logged in), before update his/her data!

Or you can make something like (example):
Code: Select all
if(logout_time < time_now) ...
Where logout_time is the datetime stored when the user logs out from your system and time_now is the actual datetime (always server time)!
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron