+ Reply to Thread
Results 1 to 5 of 5

Thread: redirect

  1. #1
    djcustom is offline x10Hosting Member djcustom is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    15

    redirect

    I have a file that sends information for forms. How would I go about redirecting someone if the go directly to the file.

  2. #2
    mephis's Avatar
    mephis is offline x10Hosting Member mephis is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    39

    Re: redirect

    check the $_SERVER["HTTP_REFERER"], if it doesn't come from where you expect it to come from, redirect it

  3. #3
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    Re: redirect

    Also, if they want directly to the file instead of using the forum, then no POST/GET data will be sent (although it is possible to send faux POST/GET data).
    Check this with
    PHP Code:
    if (isset($_POST['data'])) 
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

  4. #4
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: redirect

    All great ways, but you could also use a PHP session if you want that extra bit of security, anyone can fake referrers or post data. Sessions let you keep variables specific to a user, stored in temporary files on the server and identified by session cookies that expire as soon as the browser closes.
    PHP Code:
    File:
    <?php
    session_start
    ();
    $_SESSION['IP']=$_SERVER['REMOTE_ADDR'];
    ?>

    <html>
    ...

    In Form:
    <?php
    session_start
    ();
    if (
    $_SESSION['IP']!=$_SERVER['REMOTE_ADDR'])
    header('Location: http://www.yoursite.com/');
    ?>

    <html>
    ...
    Last edited by Twinkie; 11-18-2008 at 11:11 PM.

  5. #5
    dickey's Avatar
    dickey is offline x10 Sophmore dickey is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    128

    Re: redirect

    I agree with twinkie, curl can easily trick your page to make it believe that the referrer is legitimate I suggest you put a captcha and store the password in as a session variable and you will be sure of your security.

    but basically you use the header() function to redirect in php.
    Don't get me wrong as I believe if and when I help someone I also help myself whereby whatever someone learns I also learn.

    But I will also accept credits or reps if you really want to part with it.

+ Reply to Thread

Similar Threads

  1. redirect with .htacess
    By moltes in forum Programming Help
    Replies: 4
    Last Post: 07-30-2008, 11:10 PM
  2. sort of redirect help
    By galaxyAbstractor in forum Programming Help
    Replies: 4
    Last Post: 06-14-2008, 06:08 AM
  3. Redirect
    By BlueIce in forum Free Hosting
    Replies: 3
    Last Post: 10-21-2007, 08:06 AM
  4. Cpanel Redirect problem
    By BigEmmaFanz in forum Free Hosting
    Replies: 5
    Last Post: 12-10-2005, 04:51 PM
  5. How Do You Redirect?
    By TarinC in forum Off Topic
    Replies: 2
    Last Post: 10-02-2005, 11:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers