Simple PHP script need help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bear
    Confirmed User
    • Jul 2001
    • 261

    #1

    Simple PHP script need help

    Hi all,

    I have a redirection problem which need some php expert to help.

    I have a php script in my server and a lot of webmasters point to this script. It's like:
    http://www.doamin.com/top.php?username

    But I need to change it to another script, I want to change it to something like:
    http://www.doamin.com/in.php?id=username

    Can anybody teach me to to write a redirect script for top.php? So that all request for top.php will forward to in.php and also keeep the "username" variable. Thanks a lot.

    Max
  • JackFoley
    Confirmed User
    • Jul 2001
    • 858

    #2
    Top.php should contain a line of code that checks for a username and then does some action based on the username being present or not. I forget what the variable is, I think it's $QUERY_STRING but I'm not entirely sure. Look in the script and you'll see what I mean, it should look something like this:

    if (isset($QUERY_STRING)) {
    [do some stuff here]
    }
    else {
    [do something else]
    }

    Simply replace all the stuff it would normally do with:

    $username = $QUERY_STRING;
    header("Location: in.php?id=$username");

    If you know a little PHP you should be able to figure it out... it's kinda hard to explain without seeing the original top.php code.

    ------------------
    Plenty of wheat to go around.
    SUBMIT | TRADE | CONTACT

    Comment

    Working...