Email lists > Professional PHP > [Pro. PHP Dev.] Re: Doubt in Redirecting > [Pro. PHP Dev.] Re: Doubt in Redirecting

[Pro. PHP Dev.] Re: Doubt in Redirecting




This post if a part of  this thread

2008-01-02 03:30:33
Re: Doubt in Redirecting
You can get the HTTP_REFERER value from the super global,
$_SERVER.

if (!isset($_COOKIE['user_id'])) {

  // check if there is a referer link else set it to a
default
location
  if ($_SERVER['HTTP_REFERER'] ) $route_to =
$_SERVER['HTTP_REFERER'];
  else $route_to = 'default';

  // store the referer location somewhere, in a session,
cookie, or
pass it onto the next page using the get method as shown
  header('Location: /User/register?route_to='.$route_to);
} else {
   header('Location: /User/welcome');
}

There are other ways to approach this, such as tracking the
user in a
session.  HTTP_REFERER isn't very trustable, though it is
set properly
for the most part.
On Dec 24 2007, 11:48 pm, Nava nethan <navanethan...gmail.com> wrote:
> Thanks .
> But its Not enough for me.
>
> My real time need is :
>
> My site i am having 10 resources.
>
> Here if i click 1st resource link then it will take
into 1st resource.
> Here if i click 2st resource link then it will take
into 2st resource.
>
> i need the else part is a dynamic one. How can do this
??
> is there any possiblity to using History.go(-1).
>
> Help this case.
>
> Regards,
> Navanethan
>
> On Dec 25, 12:38 pm, "Newsfeeds"
<newsfe...downcrunch.com> wrote:
>
> > Hello Nava nethan,
>
> > <?php
> > if (!isset($_COOKIE['user_id'])) {
> >         header('Location: /User/register');} else
{
>
> >         header('Location: /User/welcome');}
>
> > ?>
>
> > Best regards,
>
> > ======= At 2007-12-25, 14:51:41 you wrote:
=======
>
> > >Hi All,
>
> > >I  have a doubt with Redirecting.
> > >I am using PHP with mysql.
> > >My Need is :
> > >                  If i click the link then it
check the cookies user
> > >id stored or not ? If cookie stored user_id
from the database then
> > >rediredt into the page. oterwise redirect into
Registration page,
> > >after got register then move into the page.

>
> > >How can i do this  ??
>
> > >Help me.
>
> > = = = = = = = = = = = = = = = = = = = =
>
> > Newsfeeds
> > MSN: TiE...gmail.com
> > newsfe...downcrunch.com
> > 2007-12-25- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---


about | contact  Other archives ( Real Estate discussion Medical topics )