Advertisement
Guest User

Untitled

a guest
May 28th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2.  
  3. <html>
  4. <head>
  5. <title>work3</title>
  6. </head>
  7. <body>
  8.  
  9. <form>
  10.  
  11. E-mail:
  12. <input type="text" id="form1" value="MAiL" size="26">
  13. NickName:
  14. <input type="text" id="form2" value="Nick" size="26">
  15. Web page:
  16. <input type="text" id="form3" value="Empty" size="26">
  17.  
  18. </form>
  19.  
  20. <input type="submit" id="button1" value="Submit info" onclick="compute()">
  21. <br></br>
  22. <form>
  23.  
  24.  
  25. User:
  26. <input type="text" id="form4" value="user" size="26">
  27. Password
  28. <input type="password" id="form5" value="" size="26">
  29. <br></Br>
  30. <textarea id="txt1" cols="80" rows="10" type= readonly>
  31.  
  32. </textarea>
  33.  
  34.  
  35. </form>
  36. <input type="submit" id="button2" value="Enter" onclick="admin()">
  37.  
  38.  
  39.  
  40.  
  41. <script language="JavaScript" type="text/javascript">
  42. function admin()
  43. {
  44. var us=document.getElementById("form4").value;
  45. var pass=document.getElementById("form5").value;
  46. if (us=="admin"&&pass=="111111") alert("Password correct");
  47.  
  48. document.getElementById('txt1').value=document.cookie;
  49. }
  50.  
  51.  
  52. function compute()
  53. {
  54. var em=document.getElementById("form1").value;
  55. var nn=document.getElementById("form2").value;
  56. var wb=document.getElementById("form3").value;
  57. var t="0";
  58. var all;
  59. var k;
  60. var t1="Nick Name: ";
  61. var t2=" E-mail: ";
  62. var t3=" Web page: ";
  63.  
  64.  
  65. if (/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(em));
  66. else t="1";
  67.  
  68. if (/^[0-9a-zA-Z_]*$/.test(nn));
  69. else t="2";
  70. var v = new RegExp();
  71. v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
  72.  
  73.  
  74. if (!v.test(wb)&&wb!="Empty") t="3";
  75.  
  76. if (t=="1") alert("Wrong E-mail address");
  77. if (t=="2") alert("Incorrect Nickname");
  78. if (t=="3") alert("URL not valid,if you don`t have please enter: Don`t have");
  79. if (t=="0") {
  80. alert("Everything OK");
  81. all=t1+nn+t2+em+t3+wb;
  82.  
  83.  
  84. k=getCookie(all);
  85.  
  86. if (k!=null) {k++;alert("Your here for "+k+" times");setCookie(all,k,365)};
  87. else setCookie(all,1,365);
  88.  
  89.  
  90. }
  91.  
  92.  
  93. }
  94.  
  95. function getCookie(NameOfCookie){
  96. if (document.cookie.length > 0) {
  97. begin = document.cookie.indexOf(NameOfCookie+"=");
  98. if (begin != -1) {
  99. begin += NameOfCookie.length+1;
  100. end = document.cookie.indexOf(";", begin);
  101. if (end == -1) end = document.cookie.length;
  102. return unescape(document.cookie.substring(begin, end));
  103. }
  104. }
  105. return null;
  106. }
  107.  
  108. function setCookie(NameOfCookie, value, expiredays) {
  109. var ExpireDate = new Date ();
  110. ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  111.  
  112. document.cookie = NameOfCookie + "=" + escape(value) +
  113. ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
  114. }
  115.  
  116. function delCookie (NameOfCookie) {
  117. if (getCookie(NameOfCookie)) {
  118. document.cookie = NameOfCookie + "=" +
  119. "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  120. }
  121. }
  122.  
  123.  
  124.  
  125.  
  126.  
  127. </script>
  128.  
  129.  
  130. </body>
  131. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement