Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-08-2010, 06:48 PM cookies and urls
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Hi everybody...I wonder if anyone can help with what I thought was a simple task at first but I was wrong, Iv'e looked all over the net but found no solution.
What I'm trying to do is this: a visitor is directed from a site to paypal, on redirection a cookie is placed on their pc logging the last page they were on, this is the script,

{
setcookie ("Auth", "http://mydomain.com/somepage.html", time() + 3600, "/");
}
exit;

This part works ok.
When they are redirected back to the site from paypal they are directed to a page containing a script which looks for this cookie and redirects them back to the page they were on, this is as far as I got with the script,
{
$_COOKIE["Auth $cookieValue"];

header("Location: $cookieValue");
exit();
}

I know it looks wrong but I can't work it out, the script is executed but in the browser its a blank page and no redirect.
Any pointers would be appreciated folks.
Go easy, I ain't gonna win any medals for scripting.

Rayo
Rayo is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-09-2010, 11:40 AM Re: cookies and urls
miki86's Avatar
Extreme Talker

Posts: 185
Location: print_r($serbia);
Trades: 0
PHP Code:
{
$cookieValue $_COOKIE["Auth"];

header("Location: $cookieValue");
exit();

miki86 is online now
Reply With Quote
View Public Profile
 
Old 10-09-2010, 12:41 PM Re: cookies and urls
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Thank's Miki86...bang on, it worked fine, who knows why I never saw it!
While were on this, is there a way to set the url in the cookie without putting in the actual url, ie: a method which sets the cookie value to the url of the page which is in the browser at the time.

Cheers
Rayo
Rayo is offline
Reply With Quote
View Public Profile
 
Old 10-09-2010, 12:51 PM Re: cookies and urls
miki86's Avatar
Extreme Talker

Posts: 185
Location: print_r($serbia);
Trades: 0
PHP Code:
setcookie ("Auth"$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], time() + 3600"/"); 
Im sure there are better ways but this came first on my mind.
miki86 is online now
Reply With Quote
View Public Profile
 
Old 10-10-2010, 05:24 AM Re: cookies and urls
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Thanks for your input again Miki86........I can't get this one to work because its not putting the full url in the cookie, I get the message "The requested URL /mysite/mypage.html was not found on this server" it must be that the http:// is missing, I had a go at fixing this but no luck.
Any Idea's.
Rayo is offline
Reply With Quote
View Public Profile
 
Old 10-10-2010, 05:49 AM Re: cookies and urls
miki86's Avatar
Extreme Talker

Posts: 185
Location: print_r($serbia);
Trades: 0
You only get this /mysite/mypage.html ?
Then try assigning full domain name + file path before setting a cookie.

PHP Code:
$path $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
//or $path = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
//or $path = 'http://mydomain.com'.$_SERVER['REQUEST_URI'];
setcookie ("Auth"$pathtime() + 3600"/"); 
miki86 is online now
Reply With Quote
View Public Profile
 
Old 10-10-2010, 07:01 AM Re: cookies and urls
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
That's fixed it Miki86........thank's for all your help.........much appreciated.
Rayo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to cookies and urls
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30694 seconds with 12 queries