RealBeginner
06-18-2002, 11:57 AM
Hi there
I want to store a cookie that determines if a user has been to site and registered.
If they have registered when the user clicks a "Download" graphic the cookie must either send them to a log-in page saying Welcome back "FirstName" please enter your username and password or to a Register Page to register. Once they have registered a password and username are sent to them.
I have got js to delete, get and set the cookie.
All I need is script that will check the cookie, redirect and display the username if necessary.
I am a beginner and do not really understand this stuff.
This is the code that I got with the other js but do not know how to modify it.
function DoTheCookieStuff()
{
username=getCookie('username');
if (username!=null)
{
alert('Hi there '+username+' - Good to see you again!')
}
else {
username=prompt('Hi - this is your first visit to my page - please enter your name.',"");
setCookie('username',username,365)}
}
Please help
I want to store a cookie that determines if a user has been to site and registered.
If they have registered when the user clicks a "Download" graphic the cookie must either send them to a log-in page saying Welcome back "FirstName" please enter your username and password or to a Register Page to register. Once they have registered a password and username are sent to them.
I have got js to delete, get and set the cookie.
All I need is script that will check the cookie, redirect and display the username if necessary.
I am a beginner and do not really understand this stuff.
This is the code that I got with the other js but do not know how to modify it.
function DoTheCookieStuff()
{
username=getCookie('username');
if (username!=null)
{
alert('Hi there '+username+' - Good to see you again!')
}
else {
username=prompt('Hi - this is your first visit to my page - please enter your name.',"");
setCookie('username',username,365)}
}
Please help