Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [Robert_B] Simple login with cookie fix (static build): Edit Log

Here is the list of edits for this post
Re: [Robert_B] Simple login with cookie fix (static build)
   
yer here you go, tested on IE6 and Mozilla 0.8

Code:
<script language="JavaScript" type="text/javascript">
<!--

function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}


// Tests if the session id value is set and if the length is over zero the user is logged in
if (getCookie("s").length > 0) {
document.write("<a href='http://www.yourdomain.com/cgi-bin/user.cgi?logout=1'>Logout</a>");
} else {
document.write("<a href='http://www.yourdomain.com/cgi-bin/user.cgi'>Login</a>");
}

if (getCookie("s").length > 0) {
// Display members only feature here
}

-->
</script>



Comedy Quotes - Glinks 3.3.0, PageBuilder, StaticURLtr, CAPTCHA, User_Edit_Profile

Last edited by:

Chas-a: Jun 8, 2004, 6:34 PM

Edit Log: