Advertisement
Guest User

Untitled

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