gengo Posted July 6, 2011 Share Posted July 6, 2011 Greetings, Again having issues. I have a site where one page is shown (index.php) and it randomizes the content, but keeps the URL static (index.php). Until someone logs in. After that, the user has the ability to add to the content. But what I want, is when they log it, it redirects them to a random page (the content in question) that is in a subfolder. index.php content/content1.php V V V content/contentn.php So, after successfully logging in, I want it to redirect to one of the many .php files (at random) in the content folder. By redirect, I mean I WANT the new URL to show to the user. Unlogged in: index.php (content1.php) - random [REFRESH] index.php (content5.php) - random etc. This works fine Logged in: content/content1.php - again, at random I'm not sure if this issue even makes much sense. I can get random images, but even then, the URL stays static. Quote Link to comment https://forums.phpfreaks.com/topic/241242-redirect-to-random-page-in-a-sub-folder/ Share on other sites More sharing options...
AbraCadaver Posted July 6, 2011 Share Posted July 6, 2011 This seems messy to me, but, I assume that in the way that is working that you just include the content pages in the index.php? If so, then just check if they are loggedin and then do a header redirect: index.php // $random_page = whatever you do to get a random page // $logged_in = whatever you do to determine if someone is logged in if($logged_in) { header("Location: content/$random_page"); } else { include("content/$random_page"); } Quote Link to comment https://forums.phpfreaks.com/topic/241242-redirect-to-random-page-in-a-sub-folder/#findComment-1239238 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.