Hi folks,
Is is possible to set and test a cookie in the same perl process?
It's for a shopping cart (my first *real* script! ). The process would run along the lines of - if the user doesn't have a cookie, set a cookie, test to see if it's been set and if it hasn't get the IP address as the (almost) unique identifier. And if you can't get an IP for some ungodly reason, add a random number to the URL to track the user. Like this:
&bugger_off_to_the_next_part;
}
else {
&set_a_cookie;
&get_the_cookie; #Test to see if it was set
if ($user_has_a_cookie = 1) {
&bugger_off_to_the_next_part;
}
else {
&get_the_IP;
if ($did_I_get_an_IP = 0) {
&add_random_to_URL;
}
}
}
Or something like that! So is this possible, or will I have to do something else, and if so, any suggestions? Avoiding JavaScript is possible, I'm aware of "if document.cookies" but I want to avoid JavaScript and particularly JS cookies where possible.
Thanks,
adam
Ps. Forgot to mention - Alex, for some reason the post page goes grey when I hit submit in Communicator 4.5. I guess if you're doing a new board it doesn't really matter anyway. And my suggestion for the board would be to have something pretty much the same as the UBB, as it's quite definetly one of the best around.
Cheers!
[This message has been edited by dahamsta (edited March 27, 1999).]
Is is possible to set and test a cookie in the same perl process?
It's for a shopping cart (my first *real* script! ). The process would run along the lines of - if the user doesn't have a cookie, set a cookie, test to see if it's been set and if it hasn't get the IP address as the (almost) unique identifier. And if you can't get an IP for some ungodly reason, add a random number to the URL to track the user. Like this:
Code:
if ($user_has_a_cookie = 1) { &bugger_off_to_the_next_part;
}
else {
&set_a_cookie;
&get_the_cookie; #Test to see if it was set
if ($user_has_a_cookie = 1) {
&bugger_off_to_the_next_part;
}
else {
&get_the_IP;
if ($did_I_get_an_IP = 0) {
&add_random_to_URL;
}
}
}
Or something like that! So is this possible, or will I have to do something else, and if so, any suggestions? Avoiding JavaScript is possible, I'm aware of "if document.cookies" but I want to avoid JavaScript and particularly JS cookies where possible.
Thanks,
adam
Ps. Forgot to mention - Alex, for some reason the post page goes grey when I hit submit in Communicator 4.5. I guess if you're doing a new board it doesn't really matter anyway. And my suggestion for the board would be to have something pretty much the same as the UBB, as it's quite definetly one of the best around.
Cheers!
[This message has been edited by dahamsta (edited March 27, 1999).]