![]() |
Randomize pages order
Hey
Here's my php code: PHP Code:
What I would need help with is: 1. How to prevent pages from repeating? 2. How to stop and redirect to some other page after all the html pages from the questions folder have been displayed? I would appretiate any help! :) |
You can't do any of this without using some external storage. If its unique to an individual client, then you may best use sessions.
PHP Code:
|
Quote:
PHP Code:
Im not sure what is the right way to fix it? |
Missing a bracket here:
Code:
while (false !== ($file = readdir($dh)))PHP Code:
|
Quote:
|
Quote:
Lol, I always miss that last ) :/ |
Quote:
Nope, no error, just a blank page. I didn't put anything into the else condition, what should I put there though? :) |
Quote:
The problem you'll have is that is_file requires a valid file. It can be relative, but I missed the path in the check. Use this instead: PHP Code:
|
Quote:
Thank you so much for helping me!!! It is almost working now. At first I got all my questions randomly without repeating, only thing was that it was also displaying some code on the background, probably, how many questions are left or smth. After the last question where it was supposed to redirect to http://mypage.com it just showed a blank page with a text: Array () on it. Now that I refreshed/closed and opened the page and tried to start answering again, it right away shows me that blank page with Array () on it. Any idea?:confused: |
Yes. I left this in while debugging:
print_r($aUnvisited);.The blank page is actually caused by an error. The call to header() fails since I already flushed output with the print_r. When its removed, it should function properly. |
Quote:
PHP Code:
Even if I refresh it still probably takes it as I've already visited the question pages? |
Quote:
|
Quote:
One question: does it mean then that if a visitor would like to answer those questions once more, he wouldn't be able to? (I assume majority won't come up with deleting cache,cookies or sessions) |
Sessions only last until the browser is closed. If you need it to persist, you'll need to implement a datastorage through files or a db in order to block.
|
Quote:
Thank you thank you thank you!!!!:) |
| All times are GMT +1. The time now is 11:14 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.