Advertisement
Guest User

Untitled

a guest
May 10th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. functon enter()
  2. {
  3.   if (username!=null && username!="" && password!=null && password!="")
  4.     {
  5.     setCookie('username',username,1,'password',password);
  6.      logou
  7.     }
  8. }
  9. function setCookie(c_name,value,expiredays,c_name2,value2)
  10. {
  11. var exdate=new Date();
  12. exdate.setDate(exdate.getDate()+expiredays);
  13. document.cookie=c_name+ "=" +escape(value)+
  14. document.cookie=c_name2+ "=" +escape(value2)+
  15. ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  16. }
  17.  
  18. function getCookie(c_name)
  19. {
  20. if (document.cookie.length>0)
  21.   {
  22.   c_start=document.cookie.indexOf(c_name + "=");
  23.   if (c_start!=-1)
  24.     {
  25.     c_start=c_start + c_name.length+1;
  26.     c_end=document.cookie.indexOf(";",c_start);
  27.     if (c_end==-1) c_end=document.cookie.length;
  28.     return unescape(document.cookie.substring(c_start,c_end));
  29.     }
  30.   }
  31. return "";
  32. }
  33. function checkCookie()
  34. {
  35. username=getCookie('username');
  36. password = getCookie('password')
  37. if (username!=null && username!="" && logout!==true)
  38.   {
  39.   alert('Welcome again '+username+'!');
  40.   }
  41. else if (username!= null && username!="" && logout!==false)
  42.   {
  43.   alert("You must sign in!")
  44.   }
  45.   else
  46.   alert("You must sign up!")
  47.  <input type="password" id="password1" value="" />
  48.  <input type="password" id="username1" value="" />
  49.  <input type="button" id="button1" onclick="enter()"
  50.   }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement