This topic is locked
[SOLVED]

 BUG? HELP! <Guest>, guest user permissions i

7/3/2010 11:49:27 AM
PHPRunner General questions
J
jansgroup author

I thought i was going crazy and this guest level issue keeps occurring, i looked into the forums and found a few similar issues, but not exactly the same.
SO THE ISSUE:
I goto my live site, via URL, where the home page allows <GUEST> user access (the page has a contact form), ALL was previously working without an issue (just a few days ago) - but now its got a BAD ISSUE. An issue where a surfer can not access the page at the first attempt, but successful at each subsequent attempt.
So i type in the URL of my site, where the home page allows <GUEST> user access:
1st attempt: "You don't have permissions to access this table Back to login page"

2nd attempt: I am able to get right in.

3rd attempt: I am able to get right in.

and so on ...
I clear my cache and try again.
1st attempt: "You don't have permissions to access this table Back to login page"

2nd attempt: I am able to get right in.

3rd attempt: I am able to get right in.

and so on ...
I try another browser with cleared cache
same issue
1st attempt: "You don't have permissions to access this table Back to login page"

2nd attempt: I am able to get right in.

3rd attempt: I am able to get right in.

and so on ...
and another browser (literally tried this on FF, IE, Chrome, and Safari) ... same thing.

I go to a friends computer at another location ... same thing, even tried multiple browsers via friend
1st attempt: "You don't have permissions to access this table Back to login page"

2nd attempt: I am able to get right in.

3rd attempt: I am able to get right in.

and so on ...
SO ... Everytime anyone goes to the site the first time they get "You don't have permissions to access this table Back to login page"

however should they refresh the page, or re-type, re-paste the URL into the same browser a second time, they will get right in.
thats not too good.
---------------------------------
some history.
i recently switched from static permissions to dynamic permissions.

-- during the trouble shooting process i assumed this could be a fault, so i returned the system to static permissions, and deleted the associated tables from the database (via phpmyadmin).

I am currently static permissions.
i recently enabled locking.

-- during the trouble shooting process i assumed this could be a fault, so i disabled locking, and deleted the associated tables from the database (via phpmyadmin).

locking is not currently enabled.
i recently upgraded my phprunner from the standard version to the Enterprise edition:

-- during this process i had to uninstalled PHPRunner, and reinstalled (with latest build, currently 5.2 Build 5482), As i was getting errors on the first attempted project build.

I am currently running phprunner enteprise edition, 5.2 (Build 5482)
---------------------------------
desperate measures:

1 -- I attempted to turn off the <Guest> level access, by going back to Security Tab > Advanced Security Settings and unchecking the Add "Login as guest" with readonly access.

i rebuilt the project and loaded it, then went back and turned it ON again by going to Security Tab > Advanced Security Settings and checking the Add "Login as guest" with readonly access.

I followed that with User Group Permissions, confirming i was Static permissions and making sure all appropriate tables where checked in <Guest> for Add and List/View. ... but same issue remained!

it also made "Login as Guest" appear twice on the "Login Page" so i had to Reset the Login Page, rebuild the project and re FTP to the server ... but still the issue remained!

2 -- SO, I completely cleared the directory on the web server where all phprunner files had been installed, and reinstalled all phprunner files again (clean) ... but same issue remained!



---------------------------------

Additional info: here are some previous forum posts that have similarity. These are not exactly the same, and might be unrelated, however in the 8 hour attempt to rectify this issue, without a "support response" this is all i could find:
A.) http://www.asprunner.com/forums/topic/13557-php-runner-login-problem/

B.) http://www.asprunner.com/forums/topic/967-guest-login/

---------------------------------
Can anyone help me? Tell me its something silly, something obvious that i didnt see ... I have seriously been very thorough, i have read countless tutorials, and repeated the process 100% to the letter, making sure i checked every aspect, and triple checking myself along the way. This WAS previously working (see recent history), without an issue.
HELP, this is affecting many forms on many sites thats feeding to this system.
This is BAD BAD. I have spent an entire day beating my head against the wall, any help would be very welcome!
Thank you in advance.

A
ann 7/5/2010

Hi,
open generated TableName_add.php file, find this line:

//check if logged in


and add following code just before:

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

$_SESSION["UserID"] = "Guest";
J
jansgroup author 7/5/2010



Hi,
open generated TableName_add.php file, find this line:

//check if logged in


and add following code just before:

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

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



----
Ok, so i went to
TableName_add.php in the PHPRUNNER, switched to HTML view, and attempted to locate the //check if logged in , no luck, i then attempted to locate just the word 'check', also no luck.
I went to firefox on the web, and loaded the LIVE page
I then right-clicked to view source to locate //check if logged in, no luck, i then attempted to locate just the word 'check', also no luck.
So #1 if '//check if logged' is not on the TableName_add.php file where would i place the
if (!@$_SESSION["UserID"])

$_SESSION["UserID"] = "Guest";
to test this fix?

2 why is this even necessary? why isnt phprunner correctly building these GUEST pages.



For the time being i just need the answer to #1, but overall - i would like it if my Enterprise version of PHPRunner would correctly build guest pages.
Please let me know. Your post has given me a ray of hope - Im eager to test this, and more eager to get these sites back in production.

A
ann 7/5/2010

Hi,
open generated PLF0001_add.php file in any text editor and apply changes.

This error happens because $_SESSION["UserID"] is filled after login page only. So this variable is empty if you just open add page directly (without login page).

J
jansgroup author 7/5/2010



Hi,
open generated PLF0001_add.php file in any text editor and apply changes.

This error happens because $_SESSION["UserID"] is filled after login page only. So this variable is empty if you just open add page directly (without login page).


Ok, i generated a NEW build, uploaded it to the server, opened my FTP client, downloaded the TableName_add.php (PLF0001_add.php),

opened the file located the following lines:
-----

// check if logged in
if(!@$_SESSION["UserID"] || !CheckSecurity(@$SESSION["".$strTableName."_OwnerID"],"Add"))

-----
I then changed it to:
-----

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

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

// check if logged in
if(!@$_SESSION["UserID"] || !CheckSecurity(@$SESSION["".$strTableName."_OwnerID"],"Add"))

-----
and manually FTP'd the file back to the server with the adjustments.
To test it:
I then went to firefox, cleared my cache (search history), and attempted to view the page LIVE.
Same issue: "You don't have permissions to access this table Back to login page"
then i repasted URL, and it worked.
cleared cache again, and same issue "You don't have permissions to access this table Back to login page"
So this did not work.

A
ann 7/6/2010

Hi,
it's difficult to tell you what's wrong without seeing all your files. Please publish your application to Demo Account sending URL. 'Demo Account' button can be found on the last screen ('Finished') in the program.

J
jansgroup author 7/7/2010



Hi,
it's difficult to tell you what's wrong without seeing all your files. Please publish your application to Demo Account sending URL. 'Demo Account' button can be found on the last screen ('Finished') in the program.


Thank you for all your help! Per my support email discussion, the following appears to be the cause and fix.
Cause of issue: I had placed a redirect in Global Events > After successful login, which allowed in-house staff members to automatically be directed to a specific page (their LEADS page) at login. This appeared to have adversely affected the <Guest> level as well, causing permission errors on the public forms, which where Custom Views of the Leads table.
Fix: So this is what i was instructed to do, open "After successful login" event on the Events tab
there i found something like the following:
---------------------

//** Redirect to another page ****

header("Location: Leads_list.php?");

exit();

---------------------
I was instructed to replace it with this code:
---------------------

//** Redirect to another page ****

if ($_SESSION["UserID"] && $_SESSION["UserID"]!="Guest")

{

header("Location: Leads_list.php?");

exit();

}

---------------------
Then I was instructed to re-build the project and apply changes previously stated before of locate "//check if logged in" in generated "..._add.php files".
However i choose to do only the replacement of code in the Global Events > After successful login area, and leave the generated "..._add.php files" untouched. And the issue appears to be corrected and working without an issue, tested in multiple browsers, clearing cache, etc. No issues.
- I have one last open question regarding the TRUE NECESSITY of actually manually adjusting the generated "..._add.php files", as this is an extra step i wish to avoid if possible, and after testing, it appears it is avoidable and unnecessary.
Besides the open question, i would consider this Issue Resolved. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=51038&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

J
jansgroup author 7/8/2010



Thank you for all your help! Per my support email discussion, the following appears to be the cause and fix.
Cause of issue: I had placed a redirect in Global Events > After successful login, which allowed in-house staff members to automatically be directed to a specific page (their LEADS page) at login. This appeared to have adversely affected the <Guest> level as well, causing permission errors on the public forms, which where Custom Views of the Leads table.
Fix: So this is what i was instructed to do, open "After successful login" event on the Events tab
there i found something like the following:
---------------------

//** Redirect to another page ****

header("Location: Leads_list.php?");

exit();

---------------------
I was instructed to replace it with this code:
---------------------

//** Redirect to another page ****

if ($_SESSION["UserID"] && $_SESSION["UserID"]!="Guest")

{

header("Location: Leads_list.php?");

exit();

}

---------------------
Then I was instructed to re-build the project and apply changes previously stated before of locate "//check if logged in" in generated "..._add.php files".
However i choose to do only the replacement of code in the Global Events > After successful login area, and leave the generated "..._add.php files" untouched. And the issue appears to be corrected and working without an issue, tested in multiple browsers, clearing cache, etc. No issues.
- I have one last open question regarding the TRUE NECESSITY of actually manually adjusting the generated "..._add.php files", as this is an extra step i wish to avoid if possible, and after testing, it appears it is avoidable and unnecessary.
Besides the open question, i would consider this Issue Resolved. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=51074&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />


FINAL UPDATE: This message was sent to my email:
sorry for my fault.

This session is set up in the appsettings.php file first. So you don't need to edit

..._add.php file directly.
Jane Endaltseva