Announcement

Collapse
No announcement yet.

Checking referrer... something seems to go wrong

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Checking referrer... something seems to go wrong

    I'm trying to set a up a simple PHP script to protect downloads. Here's the script:
    PHP Code:
    $ADMN[defaulturl] = "[url=http://www.biohazardextreme.com]http://www.biohazardextreme.com[/url]";
    $okaysites = array("[url=http://biohazardextreme.com]http://biohazardextreme.com[/url]",
    "[url=http://www.biohazardextreme.com]http://www.biohazardextreme.com[/url]"
    ); 
    $ADMIN[url_1] = "[url=http://www.biohazardextreme.com/cubed/media/movies/]http://www.biohazardextreme.com/cubed/media/movies/[/url]";
    $ADMIN[url_2] = "[url=http://downloads.com]http://downloads.com[/url]";
    $ADMIN[url_3] = "[url=http://downloads.com/new]http://downloads.com/new[/url]";
    //////////////////////////////////////////////////////
    $reffer $HTTP_REFERER;
    if(
    $reffer) {
    $yes 0;
    while(list(
    $domain$subarray) = each($okaysites)) {
    if (
    ereg("$reffer",$subarray)) {
    $yes 1;
    }
    }
    $theu "url"."_"."$site";
    if (
    $ADMIN[$theu] AND $yes == 1) {
    header("Location: $ADMIN[$theu]/$file);
    } else {
    header("Location: $ADMIN[defaulturl]);
    }
    } else {
    header("Location: $ADMIN[defaulturl]);

    So far, so good.

    Try here:

    http://www.totallyre.com/link.html

    And you'll notice the script seems to work well. A little TOO well, actually...

    Because, if you try the following link:

    http://www.biohazardextreme.com/link.html

    It STILL redirects to $ADMIN[defaulturl] even though the referring domain is in the "okay" list.

    What gives? (Using PHP4.2.2 with register_globals ON)
    Last edited by Marco; Sat 25th Jan '03, 2:08pm.

  • #2
    Try $_SERVER['HTTP_REFERER'] instead.
    --filburt1, vBulletin.org/vBulletinTemplates.com moderator
    Web Design Forums.net: vB Board of the Month
    vBulletin Mail System (vBMS): webmail for your forum users

    Comment


    • #3
      Originally posted by filburt1
      Try $_SERVER['HTTP_REFERER'] instead.
      Nope.. no luck.

      Comment


      • #4
        It could be your browser.

        The $HTTP_REFERER variable is not set by the server, but the browser.

        So if the URL was manually typed in, of if your browser does not support it, $HTTP_REFERER will be empty.

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X