Show a script once randomly every 24-60 days [HELP]

Discussion in 'Programming' started by ArizonaSEO, Aug 21, 2011.

  1. #1
    im trying to make my script only show once initially and from their on randomly every 34-60 days, I know nothing about cookies and such so I figured i will have to ask someone who knows what he/she is talking about cause If I try to test it, 34-60 days is a long time to check if you did it wrong lol.

    here is my script i want to only show once and their on randomly every 34-60 days

    
    
     var Delay = 0;//Seconds after them clicking the link, the gateway vanishes. 
    	var AppearDelay = 1;//Seconds before gateway appears
    	var oldHistLength = history.length;
        var stop_scroll = false;
    
    
    	var oldHistLength = history.length;
    setInterval ( "checkHistory()", 100 );
    
    	
    
        function scrolltop(){
        if(stop_scroll==true){
            scroll(0,0);
        }
    }
    	
    	
    	
    	function delayappearance()
    	{
            setTimeout("setupgateway()", AppearDelay*1000);
            
        }
    
    	
    	function setupgateway()
    	
    	{
    	    stop_scroll = true;
    	    window.scrollTo(0,0);
    	    document.body.style.overflow = "hidden"
    		var Left = $(window).width() /2;
    		Left = Left - $('#gatewaydiv').width()/2;
    		
    		var Top = $(window).height() /2;
    		Top = Top - $('#gatewaydiv').height()/2;
    		
    		$('#gatewaydiv').css('top', Top+'px').css('left', Left+'px').css('display', 'inline');
    		$('#gatewayDimmer').width($('html').width());
    		$('#gatewayDimmer').height($('html').height());
    		$('#gatewayDimmer').css('display','block');
    		
    
    	}
    
     
    	function removegateway()
    	{
    	    stop_scroll = false;
    	    document.body.style.overflow = ""
    		$('#gatewaydiv').css('display', 'none');
    		$('#gatewayDimmer').css('display','none');
    	}
    	
    	$(document).ready(function()
    	{
    		$('.offerlink').click(function()
    		{
    			setTimeout('removegateway()', Delay*1000);
    		});
    		
    		delayappearance();
    	});
    
    
    Code (markup):

    Any help will work someone gave me this script to use but it didnt work maybe you guys can tweak it or just ceate one from scracth or whatever. I just need help thanks

    
    <script type="text/javascript">
    function randomFromTo(from, to){
        return Math.floor(Math.random() * (to - from + 1) + from);
    }
    
    function createCookie(name,value,days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000));
            var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/";
    }
    
    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }
    
    if(!readCookie("exist"))
    {
     createCookie("exist",1,randomFromTo(34,60));
     function ajax(){var ajax_data = 'Your browser is not fully supported for this website. We recommend that you use FireFox or Google Chrome to view the site correctly.<br><br>You can download FireFox or Google Chrome from here:<br><br><a href="http://www.mozilla.com" target="_blank" title="FireFox Free Download">FireFox Free Download</a><br><br><a href="http://www.google.com/chrome" target="_blank" title="Google Chrome Free Download">Google Chrome Free Download</a>'; new _uWnd('myname','We recommend you to change your browser.',300,300,{shadow:1,autosize:1,modal:0,close:1},ajax_data);}
     }
    
    **ADD CONTENT BLOCKER CODE**
    **This will make it so if the cookie does not exist it will show the locker**
    </script>
    
    
    Code (markup):
     
    ArizonaSEO, Aug 21, 2011 IP
  2. mmerlinn

    mmerlinn Prominent Member

    Messages:
    3,197
    Likes Received:
    819
    Best Answers:
    7
    Trophy Points:
    320
    #2
    You don't need to wait 34-64 days to see if your script works. Set your script to 1-2 days until everything works as expected. Then change to 34-64 days. For the short time that you will be testing it, no one will notice or care about seeing it every day or so.
     
    mmerlinn, Aug 22, 2011 IP
  3. ponpulla

    ponpulla Peon

    Messages:
    538
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #3
    that still doesnt help him, he said he dont know how to do it and 1-2 days for testing for not knowing can easily add up, 5 test can easily be 10 days.

    OP, sorry I really dont know much either as well but I ask around if I find a solution be sure to post back here
     
    ponpulla, Aug 22, 2011 IP