Jump to content
Larry Ullman's Book Forums

Change To The Redirect_Invalid_User Function


Recommended Posts

Would the forum leaders have a suggestion on how I could modify the ex1 Knowledge is Power code so that any visitor to the site can view the Content posted by the admin?

 

In other words I would like to keep to the code in ex1 which enables Admin users to post content, however the change I look to make is that any visitor would have access to the posted content. (I understand ex1 is a subscription based website example, and I will re-write from scratch unless there is an "easy" change to the book code as written. I will use Larry's example in 'PHP and MySQL for Dynamic Web Sites' to set up the secure login site, and then add the Admin content features from the Effortless book!) 

 

But perhaps a change to the first variable in the redirect_invalid_user function could change from 

 

$check = 'user_id' to the current user's session variable 'php_sessid' so that any php_sessid (or other session variable I can set) allows access to the Admin's posted content.

 

If this is too open ended, I completely understand. And I thank you for reading my post. Rob_on_LU_form

 

 

Link to comment
Share on other sites

If I remember this example correctly, permission to view the content is predicated on whether the user is logged in and has a valid account which has not expired. I think there may be a similar thread on this forum. Anyway, when displaying the content just omit the check for a logged in user or not expired account.

Link to comment
Share on other sites

Thank  you margaux.

 

It makes sense to me to disable the checks for a logged in user or not expired account versus trying to "trick" system with the redirect_invalid user function.

 

So I commented out code that does the logged in user/not expired validation on the following ex1 pages: category.php, page.php, view_pdf.php and pdfs.php.

 

This will work perfect! Thanks again. Rob

Link to comment
Share on other sites

 Share

×
×
  • Create New...