Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- functon enter()
- {
- if (username!=null && username!="" && password!=null && password!="")
- {
- setCookie('username',username,1,'password',password);
- logou
- }
- }
- function setCookie(c_name,value,expiredays,c_name2,value2)
- {
- var exdate=new Date();
- exdate.setDate(exdate.getDate()+expiredays);
- document.cookie=c_name+ "=" +escape(value)+
- document.cookie=c_name2+ "=" +escape(value2)+
- ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
- }
- function getCookie(c_name)
- {
- if (document.cookie.length>0)
- {
- c_start=document.cookie.indexOf(c_name + "=");
- if (c_start!=-1)
- {
- c_start=c_start + c_name.length+1;
- c_end=document.cookie.indexOf(";",c_start);
- if (c_end==-1) c_end=document.cookie.length;
- return unescape(document.cookie.substring(c_start,c_end));
- }
- }
- return "";
- }
- function checkCookie()
- {
- username=getCookie('username');
- password = getCookie('password')
- if (username!=null && username!="" && logout!==true)
- {
- alert('Welcome again '+username+'!');
- }
- else if (username!= null && username!="" && logout!==false)
- {
- alert("You must sign in!")
- }
- else
- alert("You must sign up!")
- <input type="password" id="password1" value="" />
- <input type="password" id="username1" value="" />
- <input type="button" id="button1" onclick="enter()"
- }
- }
- </head>
- <body onload="checkCookie()">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement