wifang / mollify

Automatically exported from code.google.com/p/mollify
0 stars 0 forks source link

Guest mode hack: ok, except the first time #357

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

To provide a guest-like mode, I used the piece of code from the 
ExternalInterface example:

<?php
set_include_path("backend/".PATH_SEPARATOR.get_include_path()); 
    require_once("external/MollifyExternalInterface.class.php"); 
    $mollify = MollifyExternalInterface(); 
    $mollifyUserId = 2; 
    $mollify->authenticate($mollifyUserId); 
?>

This code was moved to mollify/index.html then renamed as index.php. I noticed 
that the very first time this page runs, it still loads the login popup window, 
it only works at the second time and beyond. You can experience this after 
cookies are cleaned up.

I would appreciate a tip to prevent the login from appearing. Using the 
mollify.init option "show-login": false is not enough, because in that case I 
get a blank screen at first time.

Greetings,
Daimonji Kyrillos

Original issue reported on code.google.com by cyril.ha...@gmail.com on 24 Jan 2012 at 4:59

GoogleCodeExporter commented 9 years ago
If you put this very first thing in the page, even before the <html> tag, I 
think it should prevent login.

If not, refresh should at least do the trick, ie something like this (not sure 
if syntax is valid, just from top of my head):

if (!$mollify->isAuthenticated()) {
      print '<html><head><meta http-equiv="Refresh" content="0"/></head></html>';
      die();
}

Original comment by samuli.j...@gmail.com on 24 Jan 2012 at 6:42

GoogleCodeExporter commented 9 years ago
Thank you Samuli,

I tried your solution, it worked well locally but not remotely. To make it work 
remotely, I added 'usleep(10);' before checking for effective authentication.

By the way the previous code was inserted before the HTML tag.

Greetings,
Daimonji Kyrillos

Original comment by cyril.ha...@gmail.com on 25 Jan 2012 at 12:15