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

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.

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.