PDA

View Full Version : Javascript/cookie..


Helza
12-11-2000, 09:10 AM
I was hoping someone would be able to help me out with this http://geekvillage.com/ubb/smile.gif

I want to use this javascript/cookie:
http://geekvillage.com/ubb/Forum3/HTML/001774.html (3rd reply or so)

To be used with allclicks exit pop-up program... so that it only pop-ups when you leave the page 1 time every 12hours..

I would be very greatfull..

Thanks in advance....

Drastic
12-11-2000, 07:05 PM
Hi Helza,

Just copy the script and put:
http://www.clickheretofind.com/index.php3?l=helzaexit

on the line at the end of the script where it says "http://www.yourdomain.com/popup.html"

and delete this part: 'PopupName','location=0,status=0,width=390,height= 340'

and in the body tag change : onUnload="go( )" to : OnUnLoad="doPop()"

You may want to make sure using this script is ok with allclicks.



------------------
FREEandHOT.com (http://freeandhot.com) - The Select Guide to Free Stuff Online

Helza
12-12-2000, 09:38 AM
Thanks, although I'm not using it right now http://geekvillage.com/ubb/smile.gif

I remembered that it checks for ip's so that if someone reconnected and has a dynamic ip he won't see it and I won't be credited.. So I made a small PHP/Cookie code.. adding a time+ip check http://geekvillage.com/ubb/smile.gif

If anyone needs it send me an message and i'll be happy to share it with you guys..

Drastic
12-12-2000, 09:16 PM
I would like to see it. http://geekvillage.com/ubb/smile.gif

I like working with cookies, and would like to learn more about coding for them. PHP is probably much better than JS for cookies.

Thanks,
Ken


------------------
FREEandHOT.com (http://freeandhot.com) - The Select Guide to Free Stuff Online

Helza
12-13-2000, 03:47 AM
Ok here is the code i made..
Please remember that this is a dirty piece of code http://geekvillage.com/ubb/smile.gif I have just made it to see if it works or not http://geekvillage.com/ubb/smile.gif as I had never worked with cookies before.. also I have not asked allclicks yet if i'm allowed to use it..

-------------------
<?


$ip = getenv("REMOTE_ADDR");
$popup='yes';
$go="open(\"http://www.clickheretofind.com/index.php3?l=helzaexit\",\"_blank\");\n";


if (isset($TestCookie6) OR ($TestCookie6<>'')){
$time=time();


if ($TestCookie6 < $time){$popup='yes';**
else{
if (isset($TestCookie5) OR ($TestCookie5<>'')){
if ($ip==$TestCookie5){$popup='no';**
else{$popup='yes';**
**
else{$popup='yes';**
**
**

// IF NO COOKIE THEN:
else {$popup='yes';**


if ($popup<>'no'){
$go="open(\"http://www.clickheretofind.com/index.php3?l=helzaexit\",\"_blank\");\n";
$expiretime=time()+10;
setcookie("TestCookie5",$ip,time()+43200);
setcookie("TestCookie6",$expiretime,time()+43200);
**

if ($popup=='no'){
$go=" ";
**


?>

-------------------

All php programmers can see its a pretty dirty code http://geekvillage.com/ubb/smile.gif.. didn't feel like making it nicely..

You can remove most of the
else{$popup='yes';** if you want to.. but i added some check stuff in there before it and didn't wanted to remove it completely http://geekvillage.com/ubb/smile.gif

also i've used 2 cookies due to the fact that the timeout of the cookies didn't seem to work on my computer (it did at others) I'm using the 2nd cookie to check and see if it has been 12h or not.. (1st is used to check the ip)..

I could have done it in 1 cookie.. but as i said it was just a test. I'm not using it yet..

to get it to work just replace the piece of javascript code (the exit) with:

if (exit) {
<? echo $go; ?>
**

and change the first $go with your code instead of mine http://geekvillage.com/ubb/smile.gif

Ahwell not really tested either http://geekvillage.com/ubb/smile.gif.. i tested it with a 10 second delay http://geekvillage.com/ubb/smile.gif

Click Here!