Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Senior Member raspberryh's Avatar
    Join Date
    Aug 2004
    Location
    Erie, PA
    Posts
    882
    Member #
    7208
    Liked
    1 times
    Hi,
    I am using PHP 5.1.2 and the getenv() function is not working - it returns empty string. Does anyone know if there is some kind of setting in the setup of PHP that would control this? We just got the site switched to a new server so I don't know if maybe there's a setting that's different or something. Oh yeah and I'm viewing the site with Firefox version 1.0.7 but it does the same thing in IE as well.
    The PHP setup info is here: http://allstarfg.com/phpinfo.php
    Also, this is on a Microsoft server whereas the code I was using was on a Unix server. Does that make a difference?
    Thanks,
    Heather
    choosy developers choose gif!
    website | paintings | blog

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    getenv(string) requires a parameter: http://us2.php.net/manual/en/function.getenv.php

    post your code snippet.

    Have you tried using $_SERVER[string] instead?

  4. #3
    Senior Member raspberryh's Avatar
    Join Date
    Aug 2004
    Location
    Erie, PA
    Posts
    882
    Member #
    7208
    Liked
    1 times
    Hi Transio,
    Thanks for replying!! This is the code (it's actually not mine though)
    PHP Code:
    function check_referer($referers)
    {
        if (
    count($referers))
        {
            
    $found false;
            
    $temp explode("/",getenv("HTTP_REFERER"));
            
    $referer $temp[2];
            for (
    $x=0$x count($referers); $x++)
            {
                if (
    eregi ($referers[$x], $referer))
                    
    $found true;
            }
            if (!
    getenv("HTTP_REFERER"))
                
    $found false;
            if(!
    $found)
            {
                
    print_error("You are coming from an <b>unauthorized domain.</b>");
                
    error_log("[formmail.php] Illegal Referer. (".getenv("HTTP_REFERER").")"0);
            }
            return 
    $found;
        }
        else
        {
            return 
    true// not a good idea, if empty, it will allow it.
        
    }

    I haven't tried $_SERVER[string], I will try that. Thanks for the suggestion!
    Heather
    choosy developers choose gif!
    website | paintings | blog


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

getenv empty string
,
getenv is empty in php
,
how to know if getenv is empty
,

php getenv not working

Click on a term to search for related topics.
All times are GMT -6. The time now is 12:20 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com