Advertisement
Guest User

Untitled

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