GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   DTML pop up help? Sessions cookies - I'm frustrated! (https://gfy.com/showthread.php?t=872590)

iMind 11-30-2008 11:19 PM

DTML pop up help? Sessions cookies - I'm frustrated!
 
Sorry, my last thread wasn't named properly enough to target the right help

I have a site and I want to display a div layer on it, but only ONCE per session..
as to not annoy surfers.

So basically they come on to the site, see the DIV pop up, click it or click close, and if they click close it sets a cookie, so it's not shown again

I'm pulling my fucking hair out here.

I tried modifying the code I found here, http://cssbeauty.com/skillshare/disc...using-cookies/

but the layer pops up, then disappears..

Any help in the right direction would be appreciated

Malicious Biz 11-30-2008 11:23 PM

iMind is a communist

iMind 12-01-2008 12:32 AM

bump :helpme

qwe 12-01-2008 12:51 AM

it has to be that mac you own :1orglaugh

iMind 12-01-2008 12:56 AM

Quote:

Originally Posted by qwe (Post 15125267)
it has to be that mac you own :1orglaugh

yeah, that must be it.

retard.

Alky 12-01-2008 12:56 AM

why not just start the session when you load the div, not when they click close..just an idea.

didnt look at the code, but maybe the onclose isnt working right or something.

iMind 12-01-2008 12:59 AM

Thanks for the suggestions Alky..

Sadly my knowledge of code ends at HTML, so I'm havin a hard time doing anything with that script, was hoping there was a simple solution but doesn't seem to be

Alky 12-01-2008 01:03 AM

Quote:

Originally Posted by iMind (Post 15125279)
Thanks for the suggestions Alky..

Sadly my knowledge of code ends at HTML, so I'm havin a hard time doing anything with that script, was hoping there was a simple solution but doesn't seem to be

PHP Code:

session_start();
if(!
$_SESSIONS["ldhtml"]) {
$_SESSIONS["ldhtml"]="1";
//LOAD DHTML


something like that should work

iMind 12-01-2008 01:10 AM

hmm, perhaps it's time I take a PHP course..

Currently I'm using this

PHP Code:

<script language="javascript" type="text/javascript">
  <!--
   function 
getCookie(name){
    if(
document.cookie!=""){
      var 
cookie=document.cookie;
      var 
start=cookie.indexOf(name);
      var 
stop;

      if(
start!=-1){
        
start+=name.length+1;
        
stop=cookie.indexOf(';'start);

        if(
stop==-1)
          
stop=cookie.length;
        return 
unescape(cookie.substring(startstop));
      }
    }
    else
      return 
false;
  }

  function 
makeCookie(namevalue){
    var 
cookie name '=' escape(value) + ';';
    
document.cookie cookie;
  }

  function 
showhide(idsetcookie){
    if(
setcookie==true){
      var 
cookie=getCookie('show');
      var 
show=new Array();
      if(
cookie) {show=cookie.split(', ');}
      var 
invar=-1;

    for(
i=0show.lengthi++)
      if(
show[i]==id)
        
invar=i;
    }

    if(
document.getElementById(id).style.display=="none"){
      
document.getElementById(id).style.display="block";

      if(
invar==-&& setcookie==true)
        
show[show.length]=id;
    }
    else{
      
document.getElementById(id).style.display="none";

      if(
invar!=-&& setcookie==true)
        
show.splice(invar1);
    }

    if(
setcookie==true)
      
makeCookie('hide'show.join(', '));
  }

  function 
init(){
    
showhide('container'false)

    var 
cookievalue=getCookie('show');
    var 
show;

    if(
cookievalue!=""){
      
show=cookievalue.split(', ');

      for(
i=0show.lengthi++)
        
document.getElementById(show[i]).style.display="block";
    }
  }
  -->
  
</script> 

and then

PHP Code:

      <a href="javascript:showhide('container', false)">Close This Window!</a


It closes alright, but if I refresh the page it shows again :(

Alky 12-01-2008 01:17 AM

where are you calling init from?

iMind 12-01-2008 01:38 AM

Quote:

Originally Posted by Alky (Post 15125313)
where are you calling init from?

from the body tag
onload=init()

iMind 12-01-2008 01:41 AM

it's working .. but flashes real quick, which obviously is unsuitable :(


All times are GMT -7. The time now is 11:54 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc