Thread: Check referer

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    Hi room, I need help on this code!
    I have a Fatal error: Call to unsupported or undefined function error() in line 24
    Line 24 is: error("Unauthorized access to: $HTTP_REFERER"); What I'm doing wrong?

    $referers = array('mydomain.com','www.mydomain.com');

    function check_referer () {
    global $REFERERS, $HTTP_REFERER;
    if ($HTTP_REFERER != "")
    while (list($val, $ref) = each($REFERERS))
    if (preg_match("/^http://$ref/", $HTTP_REFERER))
    return;
    error("Unauthorized access to: $HTTP_REFERER");
    exit;
    }
    check_referer();
  2. #2
  3. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    what is error()?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by RyanP:
    what is error()?[/quote]

    This is an example I take from formmail.pl I tried to modify the script for my php form.
    I'm new in programming I have no idea what is the error. The script work fine but when someone try to use it on their server I have the fatal error.
  6. #4
  7. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    i don't think error() is a built-in PHP function, you're going to have to either create an error() function or just print your ("Unauthorized access to: $HTTP_REFERER");
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Gig Harbor, Washington, USA
    Posts
    29
    Rep Power
    0
    Isn't what he wants, error(), die()? So do

    die("Error Occurred");

    ------------------
    chris swanicke
    swanicke@defected.net
  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    error("Unauthorized access to: $HTTP_REFERER");


    Just print the an error string and see how it works..

    echo "Unauthorized access to: $HTTP_REFERER";

    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited September 13, 2000).]
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Shiju Rajan:

    error("Unauthorized access to: $HTTP_REFERER");


    Just print the an error string and see how it works..

    echo "Unauthorized access to: $HTTP_REFERER";
    [/quote]

    Everything is working fine now!
    I added:
    echo "Unauthorized access to: $HTTP_REFERER";
    exit;
    }

    Thank You all!

    [This message has been edited by dalida (edited September 13, 2000).]

Similar Threads

  1. dynamically created check boxes
    By wduffee in forum PHP Development
    Replies: 3
    Last Post: February 3rd, 2004, 01:10 PM
  2. Do compilers optimize some / into *?
    By Jason Doucette in forum C Programming
    Replies: 46
    Last Post: December 25th, 2003, 08:47 PM
  3. called too early to check prototype at mediawrap.cgi
    By jenniefer in forum Perl Programming
    Replies: 4
    Last Post: December 20th, 2003, 08:37 AM
  4. check http referer
    By frazzle in forum PHP Development
    Replies: 1
    Last Post: December 14th, 2003, 04:55 PM
  5. setting http referer question
    By gkg1 in forum PHP Development
    Replies: 0
    Last Post: November 9th, 2003, 11:38 PM

IMN logo majestic logo threadwatch logo seochat tools logo