soniya
asked on
Greeting visitors on website
Hello,
I want to greet visitors on the homepage of my website. welcoming new and identify existing customers. We have separate page for user registration.
How shall I go about?
I want to greet visitors on the homepage of my website. welcoming new and identify existing customers. We have separate page for user registration.
How shall I go about?
Or you do a double, Ip and cookie.
Some people dont allow cookies and some people have changing Ip's
Some people dont allow cookies and some people have changing Ip's
Have you written the user registration page yet?
ASKER
Yes the User registration form is done.
Can you help me with the code ?
Can you help me with the code ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then in user reg page have
<html>
<head>
<script type="text/javascript" language="JavaScript" src="cookie.js"></script>
<script type="text/javascript" language="JavaScript">
function saveName(theForm) {
setCookie('name','theForm. firstName. value+' '+theForm.lastName.value,e xpiryDate, '/')
}
</script>
</head>
<body>
<form onSubmit="saveName(this)">
First name: <input type="text" name="firstName" value="">
Last name: <input type="text" name="lastName" value="">
.
.
.
</form>
and in welcome have
<html>
<head>
<script type="text/javascript" language="JavaScript" src="cookie.js"></script>
<script type="text/javascript" language="JavaScript">
function getName() {
var name="getCookie('name')
return (name)?name:'Stranger';
}
</script>
</head>
<body>
<script>
document.write('Hello '+getName())
</script>
<html>
<head>
<script type="text/javascript" language="JavaScript" src="cookie.js"></script>
<script type="text/javascript" language="JavaScript">
function saveName(theForm) {
setCookie('name','theForm.
}
</script>
</head>
<body>
<form onSubmit="saveName(this)">
First name: <input type="text" name="firstName" value="">
Last name: <input type="text" name="lastName" value="">
.
.
.
</form>
and in welcome have
<html>
<head>
<script type="text/javascript" language="JavaScript" src="cookie.js"></script>
<script type="text/javascript" language="JavaScript">
function getName() {
var name="getCookie('name')
return (name)?name:'Stranger';
}
</script>
</head>
<body>
<script>
document.write('Hello '+getName())
</script>
Once they registrate you make a cookie with their name and once they come back you look tof this cookie...
Than somewhere at the top of your page you write...
//for those who don't have a cookie
Hello and welcome! If you are registered user, you can sign in here...
If not registered, you can register here...
//those with cookies
Wellcome again, Andrew Long. ....
You need a code for that or just the idea???
Ljubiccica