[Wifidog] Problem (With Patch) in SQL code,

Rikhardur.EGILSSON at oecd.org Rikhardur.EGILSSON at oecd.org
Thu Sep 30 07:31:14 EDT 2004



The 'interval' function in MySQL seems to be totally different than the one
in PostgreSQL, and thus, the SQL code creates an error.

I have modified the SELECT statements a little in a way that should work on
both MySQL and PostgreSQL.

 

--- auth/index.php.old	2004-09-30 11:43:14.800883787 +0200
+++ auth/index.php	2004-09-30 11:45:06.141610442 +0200
@@ -30,7 +30,7 @@
 $auth_message = '';
 
 $token = $db->EscapeString($_REQUEST['token']);
-$db->ExecSqlUniqueRes("SELECT *, CASE WHEN ((NOW() - reg_date) > interval
'".VALIDATION_GRACE_TIME." minutes') THEN true ELSE false END AS
validation_grace_time_expired FROM users,connections WHERE
users.user_id=connections.user_id AND connections.token='$token'", $info,
false);
+$db->ExecSqlUniqueRes("SELECT *, CASE WHEN (NOW() > (reg_date +
'".VALIDATION_GRACE_TIME." minutes')) THEN true ELSE false END AS
validation_grace_time_expired FROM users,connections WHERE
users.user_id=connections.user_id AND connections.token='$token'", $info,
false);
 if ($info != null)
   {
     if ($_REQUEST['stage']== STAGE_LOGIN)




--- login/index.php.old	2004-09-30 11:50:09.795414166 +0200
+++ login/index.php	2004-09-30 11:51:00.732367640 +0200
@@ -48,7 +48,7 @@
     $previous_password = $_REQUEST['pass'];
     $user = $db->EscapeString($_REQUEST['user']);
     $password_hash = get_password_hash($_REQUEST['pass']);
-    $db->ExecSqlUniqueRes("SELECT *, CASE WHEN ((NOW() - reg_date) >
interval '".VALIDATION_GRACE_TIME." minutes') THEN true ELSE false END AS
validation_grace_time_expired FROM users WHERE (user_id='$user' OR
email='$user') AND pass='$password_hash'", $user_info, false);
+    $db->ExecSqlUniqueRes("SELECT *, CASE WHEN (NOW() > (reg_date +
'".VALIDATION_GRACE_TIME." minutes')) THEN true ELSE false END AS
validation_grace_time_expired FROM users WHERE (user_id='$user' OR
email='$user') AND pass='$password_hash'", $user_info, false);
 
     if ($user_info != null)
       {

-------------- next part --------------
_______________________________________________
Wifidog mailing list
Wifidog at isf.waglo.com
http://isf.waglo.com/mailman/listinfo/wifidog_isf.waglo.com


More information about the Wifidog mailing list