very basic php question

Discussion in 'PHP' started by baris22, Feb 13, 2009.

  1. #1
    hello all,

    I want to add second url to the allowed referrer. Can anyone help me.

    
    
    define('ALLOWED_REFERRER', 'xxx.net/index.php?page=course-req');
    if (ALLOWED_REFERRER !== '' && (!isset($_SERVER['HTTP_REFERER']) || strpos(strtoupper($_SERVER['HTTP_REFERER']),strtoupper(ALLOWED_REFERRER)) === false))
    {
    die("You can not view this page directly. Please contact .");
    }
    
    
    PHP:
     
    baris22, Feb 13, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    copy paste the code again after that and change define to meet requirements
     
    crivion, Feb 14, 2009 IP
  3. tihan

    tihan Active Member

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #3
    define('ALLOWED_REFERRER', 'xxx.net/index.php?page=course-req');
    define('ALLOWED_REFERRER2', 'new.url/new');
    if ((ALLOWED_REFERRER !== '') && (ALLOWED_REFERRER2 !== '') && (!isset($_SERVER['HTTP_REFERER']) || !(strpos(strtoupper($_SERVER['HTTP_REFERER']),strtoupper(ALLOWED_REFERRER2)) === false) && strpos(strtoupper($_SERVER['HTTP_REFERER']),strtoupper(ALLOWED_REFERRER)) === false)))
    {
    die("You can not view this page directly. Please contact .");
    }
     
    tihan, Feb 14, 2009 IP