0

Hello, im having problems with the following code and it driving me made trying to find out the source to it not working out that one number is bigger than another when clearly it is, please can you help and make my day :)

Example of numbers im comparing...

08072011050724
09072011050724

it works with less than but not greater than but it needs to be greater than in order to be classed as expired.

it doesn't seem to think 09072011050724 is larger than 08072011050724

// CHECK FOR TOKEN EXPIRATION
				
$request = "SELECT * FROM `linklogic_tokens` WHERE `token` = '$token'";
$actions = mysql_query($request, $connect) or die(mysql_error($connect));
$row = mysql_fetch_assoc($actions);
					
if ($row['expires'] != 'false'){
				
	$request = "SELECT * FROM `linklogic_tokens` WHERE `token` = '$token'";
	$actions = mysql_query($request, $connect) or die(mysql_error($connect));
	$row = mysql_fetch_assoc($actions);
					
	if ($row['expires'] >= $timestamp){ //This is causing the problem..i think
					
	$request = "DELETE FROM `linklogic_tokens` WHERE `token` = '$token'";
	$actions = mysql_query($request, $connect) or die(mysql_error($connect));
						
	die('Token specified has expired.');
					
	}
					
}

Kind Regards,
Nathaniel Blackburn

Edited by shadowscape: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by shadowscape
0

Your logic seems to be reversed. If the expiry date has already passed, then you would want to delete the record. Assuming the $timestamp is the current one, then it needs to be greater or equal to $row before you do your delete.

0

Your logic seems to be reversed. If the expiry date has already passed, then you would want to delete the record. Assuming the $timestamp is the current one, then it needs to be greater or equal to $row before you do your delete.

Ahh your right, im not thinking straight (reversed in fact) but i guess that serves me right for not having a break, i just spotted my obvious mistake just before i got your post, thanks for your help dude it means a great deal to me :)

Edited by shadowscape: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.