Redirection Help Please

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Redirection Help Please

    I try to use PHP to redirect to other page and failed. Please give me a
    help. Thanks.

    The script is:

    if($rows_num>0)
    {
    session_start();
    session_register("userid");
    session_register("username");
    session_register("userpriv");
    $userid=$data[0]['user_id'];
    $username=$data[0]['username'];
    $userpriv=$data[0]['priv_id'];
    echo "<script
    language=javascript>self.location='admin_cpanel.ph p';</script>";
    exit;
    }
    else
    {
    echo "<script
    language=javascript>self.location='admin_login.php ';</script>";
    exit;
    }

    The result is a blank page. No redirection as expected.


    RX Guest

  2. Similar Questions and Discussions

    1. ASP redirection
      Hey, I have an idea and wonder if it's possible I want to have a form page with aboot three different drop down menus. once all the options...
    2. redirection
      Thank you for your hel my question is: How can I redirect a visitor to a HTML site if he does not have flash plugin instaled on his computer? on my...
    3. URL redirection database
      I'm distributing HTML files on a CD. I'd like those files to include URLs that point to a simple database on my ISP IIS server, do a lookup based...
    4. [PHP] cookies and redirection
      > I have a small problem was wondering if anyone out there knew anyhting about Yeah, set the cookie as normal using the header() function (or...
    5. [PHP] Redirection Question
      Hi, I'm not sure if this is going to help or not.. Since I understand your issue only barely.. If I understand correctly, regardless of whether...
  3. #2

    Default Re: Redirection Help Please

    RX a écrit le 20/02/2004 :
    > echo "<script
    > language=javascript>self.location='admin_cpanel.ph p';</script>";
    > exit;
    > }
    > else
    > {
    > echo "<script
    > language=javascript>self.location='admin_login.php ';</script>";
    > exit;
    > }
    I think JavaScript needs double-quotes. Try :
    echo "<script
    language='javascript'>self.location=\"admin_login. php\";</script>";


    Jedi121 Guest

  4. #3

    Default Re: Redirection Help Please

    RX wrote:
    > I try to use PHP to redirect to other page and failed. Please give me a
    > help. Thanks.
    >
    > The script is:
    >
    > if($rows_num>0)
    > {
    > session_start();
    > session_register("userid");
    > session_register("username");
    > session_register("userpriv");
    > $userid=$data[0]['user_id'];
    > $username=$data[0]['username'];
    > $userpriv=$data[0]['priv_id'];
    > echo "<script
    > language=javascript>self.location='admin_cpanel.ph p';</script>";
    > exit;
    > }
    > else
    > {
    > echo "<script
    > language=javascript>self.location='admin_login.php ';</script>";
    > exit;
    > }
    >
    > The result is a blank page. No redirection as expected.

    either
    self.location.href='newLocation'
    or
    window.location.href='newLocation'
    should work.

    Seeing how javascript can be turned off by a person, I wouldn't rely on it
    to redirect everyone. Do a bit of research and look for the syntax of a
    meta redirect, those are more reliable IMHO.
    Mike Discenza Guest

  5. #4

    Default Re: Redirection Help Please

    Try php function header(), ie.

    header ( "Location: admin_cpanel.php" );

    "RX" <liqiangx@telus.net> wrote in message
    news:ptvZb.28246$n17.4865@clgrps13...
    > I try to use PHP to redirect to other page and failed. Please give me a
    > help. Thanks.
    >
    > The script is:
    >
    > if($rows_num>0)
    > {
    > session_start();
    > session_register("userid");
    > session_register("username");
    > session_register("userpriv");
    > $userid=$data[0]['user_id'];
    > $username=$data[0]['username'];
    > $userpriv=$data[0]['priv_id'];
    > echo "<script
    > language=javascript>self.location='admin_cpanel.ph p';</script>";
    > exit;
    > }
    > else
    > {
    > echo "<script
    > language=javascript>self.location='admin_login.php ';</script>";
    > exit;
    > }
    >
    > The result is a blank page. No redirection as expected.
    >
    >

    Duyet The Vo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139