Hi all.
I have 3 pages (p1.php - p2.php - p3.php). Each this page has a code:
p1.php -> p1
p2.php -> p2
p3.php -> p3
I don't get to make the string test receive, for example, p2, p3, p1 and record this value in database. Why this ?
When the user acess p2 in first time, the script records this value in $test. If the user access again the same page, the message is "You just take it"
So, the user access only one time each page. But I cant get to record like a array, for example.
Can you help me, please ?
Thank you
About array
Moderator: General Moderators
may be I didn't get the point....
Do you want to prevent users from requesting the same page/function twice?
If so, read http://www.php.net/manual/en/ref.session.php
If not, please clarify
Do you want to prevent users from requesting the same page/function twice?
If so, read http://www.php.net/manual/en/ref.session.php
If not, please clarify
- gite_ashish
- Forum Contributor
- Posts: 118
- Joined: Sat Aug 31, 2002 11:38 am
- Location: India
Hi,
The normal variable values are NOT maintained/persisted between page visits. If you want to prevent users from visiting the same page again and again, you need to maintain session. Unlike normal variables, session variables CAN maintain/persist their values.
In case of functions, you can use static variable, which can maintain/persist their values between function calls.
See PHP man:
http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/language.v ... scope.html
Regards,
The normal variable values are NOT maintained/persisted between page visits. If you want to prevent users from visiting the same page again and again, you need to maintain session. Unlike normal variables, session variables CAN maintain/persist their values.
In case of functions, you can use static variable, which can maintain/persist their values between function calls.
http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/language.v ... scope.html
Regards,
Hi volka.
First, thank you for your attention. Sorry if I didn't explain correct. So I created test pages. So If the user make anyone this test, the user cann't to repeat the test.
So, this is the reason that I want to record the code page in a page field, in array, if it's possible.
Whe the user tries to access the page, will be deny, because the user already makes the test.
Hi gite_ashish.
Thank you too.
I use session in homepages because needs to login and password.
The reason that I want to use array, I hope that I had explain above.
Thank you for all.
First, thank you for your attention. Sorry if I didn't explain correct. So I created test pages. So If the user make anyone this test, the user cann't to repeat the test.
So, this is the reason that I want to record the code page in a page field, in array, if it's possible.
Whe the user tries to access the page, will be deny, because the user already makes the test.
Hi gite_ashish.
Thank you too.
I use session in homepages because needs to login and password.
The reason that I want to use array, I hope that I had explain above.
Thank you for all.