Diff
Not logged in

Differences From:

File src/login.c part of check-in [e3c529c2f0] - Merge in clone and sync changes. Fix a bug in undelta. by anonymous on 2007-07-30 16:31:11. Also file src/login.c part of check-in [66f4caa379] - Improvements to the WWW interface. by drh on 2007-07-23 19:52:51. Also file src/login.c part of check-in [3a25b68390] - Only request the password one time on a push or pull. by drh on 2007-07-30 16:35:16. [view]

To:

File src/login.c part of check-in [e621b6dbe3] - Use POST instead of GET for the /xfer method. Other bug fixes in the URL parser. by drh on 2007-07-30 14:28:17. [view]

@@ -204,17 +204,21 @@
   }
 
   /* Check the login cookie to see if it matches a known valid user.
   */
-  if( uid==0 && (zCookie = P(login_cookie_name()))!=0 ){
-    uid = db_int(0,
-            "SELECT 1 FROM user"
-            " WHERE uid=%d"
-            "   AND cookie=%Q"
-            "   AND ipaddr=%Q"
-            "   AND cexpire>julianday('now')",
-            atoi(zCookie), zCookie, zRemoteAddr
-         );
+  if( uid==0 ){
+    if( (zCookie = P(login_cookie_name()))!=0 ){
+      uid = db_int(0,
+              "SELECT uid FROM user"
+              " WHERE uid=%d"
+              "   AND cookie=%Q"
+              "   AND ipaddr=%Q"
+              "   AND cexpire>julianday('now')",
+              atoi(zCookie), zCookie, zRemoteAddr
+           );
+    }else{
+      uid = db_int(0, "SELECT uid FROM user WHERE login='anonymous'");
+    }
   }
 
   if( uid==0 ){
     g.isAnon = 1;