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)
-   -   More PHP help needed (https://gfy.com/showthread.php?t=491918)

BiggleJones 07-13-2005 02:54 PM

More PHP help needed
 
I am trying to implement the CCBill ID cookie code ( like http://www.spunkycash.com/ ) into my affiliate site. I have the code working on individual pages, but the variable/cookie clears everytime I switch pages. Any help on this would be awesome and thanks in advance:

<?
$ccbillid = "".$_POST['ccbillinput']."";
$cookie_life = time() + 31536000;
setcookie('ccbillid', $ccbillid, $cookie_life, '/', '.69gs.com');
$_COOKIE["ccbillid"] = $ccbillid;

if (!$_COOKIE["ccbillid"]){$ccbilloutput = "XXXXXX"; }
else {$ccbilloutput = $_COOKIE["ccbillid"]; }

if(isset($_COOKIE['ccbillinput'])) $ccbillid = $_COOKIE['ccbillinput'];
if(isset($_POST['ccbillinput'])) $ccbillid = $_POST['ccbillinput'];
?>

Due 07-13-2005 02:59 PM

Check first before your setcookie if a cookie exists.
Most likely only the FIRST page they see is through POST $_POST['ccbillinput'] so on the next page they go to the POST command will be blank and you will be setting a blank cookie.

AcidMax 07-13-2005 02:59 PM

Code:

setcookie('ccbillid', $ccbillid, $cookie_life, '/', '.69gs.com');
$_COOKIE["ccbillid"] = $ccbillid;

Without testing the problem could be the code above. Just try setting it on one page, and then just checking to see if it exists.

Code:

if(!isset($_COOKIE['ccbillid']))
{
  setcookie(...);
}

echo $_COOKIE['ccbillid'];


MickeyG 07-13-2005 03:02 PM

add session_start(); to each pg.

AcidMax 07-13-2005 03:06 PM

Quote:

Originally Posted by MickeyG
add session_start(); to each pg.

He is not setting a session variable.

BiggleJones 07-14-2005 06:11 PM

Thanks AcidMax for the suggestion...still cant get it working. Anyone else have any ideas?

Alky 07-14-2005 06:14 PM

maybe change:
PHP Code:

setcookie('ccbillid'$ccbillid$cookie_life'/''.69gs.com'); 

to:
PHP Code:

setcookie('ccbillid'$ccbillid$cookie_life'/''69gs.com'); 

that period in the domain might be throwing it off

just a guess i didnt test it.

Alky 07-14-2005 06:15 PM

Quote:

Originally Posted by MickeyG
add session_start(); to each pg.

and don't do this.

BiggleJones 07-14-2005 06:18 PM

I didnt even notice that period, but I took it out and still same problem. Ive been trying to figrue this out for over a week now, and its the only thing left to do so I can re-launch my affiliate program.

UUUUggghhhhh :helpme

Alky 07-14-2005 06:19 PM

you have that code on every page?

Alky 07-14-2005 06:21 PM

and its working fine for me i browsed from page to page, also closed my browser and came back... still good on my end

BiggleJones 07-14-2005 06:22 PM

Quote:

Originally Posted by Alky
you have that code on every page?

yea....Im just having the form post to whatever page they are on.

Should I just have the form post to one php page instead? And if so, what code should I put in the individual pages to call that variable?

BiggleJones 07-14-2005 06:23 PM

Quote:

Originally Posted by Alky
and its working fine for me i browsed from page to page, also closed my browser and came back... still good on my end

hmmm....am I calling it wrong? <? print $ccbilloutput; ?>

Alky 07-14-2005 06:24 PM

Quote:

Originally Posted by BiggleJones
yea....Im just having the form post to whatever page they are on.

Should I just have the form post to one php page instead? And if so, what code should I put in the individual pages to call that variable?

if you do it this way, you will need to check if $_POST['ccbillinput'] is set, otherwise it is going to run your setcookie every time

BiggleJones 07-14-2005 06:26 PM

Quote:

Originally Posted by Alky
if you do it this way, you will need to check if $_POST['ccbillinput'] is set, otherwise it is going to run your setcookie every time

Got ICQ or AIM?

AIM - Biggle Jones

ICQ - 291596343

BiggleJones 07-14-2005 07:00 PM

THIS JUST IN.....ALKY IS THE MAN (even with his Persian mullet)


All times are GMT -7. The time now is 11:52 AM.

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