This topic is locked

phprunner as cms

6/2/2010 8:48:04 PM
PHPRunner General questions
M
mdorren author

Hi, I've been using phprunner and iframes as a simple cms solution for my customers with great success, but it seems that after a while the views that I point to ask for a login instead of assuming guest permissions. Is there a way to hard code each page so that it will never go to the login page but assume guest status?
Thanks

A
ann 6/3/2010

Hi,
you need to set up $_SESSION["UserID"] in the generated files of the pages. Add this code

if (!@$_SESSION["UserID"])

$_SESSION["UserID"] = "Guest";



just before this line:

if(!@$_SESSION["UserID"])

{

$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];

header("Location: login.php?message=expired");

return;

}
M
mdorren author 6/3/2010



Hi,
you need to set up $_SESSION["UserID"] in the generated files of the pages. Add this code

if (!@$_SESSION["UserID"])

$_SESSION["UserID"] = "Guest";



just before this line:

if(!@$_SESSION["UserID"])

{

$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];

header("Location: login.php?message=expired");

return;

}




Many Thanks Ann! Is there a way I could put that code in an event so I would have to do it every time I changed the custom view and rebuilt?
Thanks again,

Marty

A
ann 6/3/2010

Marty,
unfortunately, no. As workaround you can add it to the files in /source folder.

Sergey Kornilov admin 6/3/2010

Marty,
try to add this code to AfterApplicationInitialized event.

M
mdorren author 6/3/2010



Marty,
try to add this code to AfterApplicationInitialized event.



That would be great, but won't it affect ALL the views then?... not just my "public" views..

Sergey Kornilov admin 6/4/2010

By default this code in AfterAppInit will be applied to all tables.
As a workaround you can add this code to AfterTableInit event of public views and tables.

M
mdorren author 6/4/2010



By default this code in AfterAppInit will be applied to all tables.
As a workaround you can add this code to AfterTableInit event of public views and tables.



Thanks, I'll give it a try and let you know