fixed CheckAuth to take care about different timezones and sumer time changes
authorpk910 <philipp@zoelle1.de>
Sun, 25 Mar 2012 10:24:26 +0000 (12:24 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 25 Mar 2012 10:24:26 +0000 (12:24 +0200)
src/main.c

index 1287faf242dcba4c22148ccc945e55931ad570ea..1292a82c7c627c68e6241e80e3dab80fcaf18774 100644 (file)
@@ -429,7 +429,10 @@ static AUTHLOOKUP_CALLBACK(main_checkauths_callback) {
     printf_mysql_query("SELECT `user_id`, `user_registered` FROM `users` WHERE `user_user` = '%s'", escape_string(auth));
     res = mysql_use();
     if ((row = mysql_fetch_row(res)) != NULL) {
-        if(!exists || (strcmp(row[1], "0") && registered != atoi(row[1]))) {
+        int diff = registered - atoi(row[1]);
+        if(diff < 0)
+            diff *= -1;
+        if(!exists || (strcmp(row[1], "0") && diff > 86400)) {
             //User is no longer valid! Delete it...
             deleteUser(atoi(row[0]));
             char *alertchan = get_string_field("General.CheckAuths.alertchan");