7 replies
by jeremy
I would do that using session variables. I would use VBScript - create a
database, and populate it with variables such as username, links, etc. Use
event handlers (ie when a user clicks on a link, have an 'onClick' event to
write to the db). Then, when the user logs in, you can immediately compare
his username (assuming you are using Windows NT) with that in the database,
and immediately access all the other info. You can then use the variables in
the database to control what the user sees.
by adwait gupte
by mightyduk
put the javascript in a file called challenge.js in the same directory:
function login(){
checkCookie();
if(document.login_form.user.value!=user){
alert("Login Failed!");
return;}
for(var i=0;i=200){
alert("Congratulations you hit 200!");}
}
function checkCookie(){
if(document.cookie){
eval(document.cookie);
var linklist=links.split(",");
for(var i=1;i
by adwait gupte
by mightyduk
and finally:
function linkto(target){
if(linksbyname[target.href]){
document.login_form.user.select();
document.login_form.user.focus();
return false;
}
else {
linksbyname[target.href]=true;
target.id="done";
numlinks++; document.login_form.numlinks.value=numlinks;
links+=","+target.href;
document.cookie="links='"+links+"'"+expiry;
document.cookie="numlinks="+numlinks+expiry
return true;
}
}
var numlinks=0;
var links="";
var expiry=";expires=Fri, 31-Dec-2099 12:00:00 GMT";
var user="";
var linksbyname=new Array();
the cookie will expire at the end of the century, should be long enough? It runs with IE5, you might have to play with it a little for Netscape. Email me if you have questions
by adwait gupte
by adwait gupte
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending