Please Help, Weird Issues w/ PHP

Discussion in 'PHP' started by jsamdirect, Mar 8, 2008.

  1. #1
    I am having a weird issue issue where PHP applications that use form checking are not working correctly. One of them checks the email password format of the info a new user enters when they register. When submitting the form the check thinks that the formats are wrong, even though they are correct. I have seen this issue with two different php apps, both of which work fine on another server. And if I comment out the check code the app works (but doesn't validate the format of course) Has anyone ever ran across this issue or have any thoughts on it?

    I am currently running on Apache 2.0.63 and PHP 4.3.9. I am thinking it is an issue with PHP but am not 100% sure how to track it down.
     
    jsamdirect, Mar 8, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Post your code.
     
    nico_swd, Mar 8, 2008 IP
  3. jsamdirect

    jsamdirect Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I did not write the code but if I comment out this line it allows the user to register.

    $fv->isEmailAddress('email',"$lang[formcheck_emailinv]");

    And I believe this is the code that is checking the format.

    // check whether input is a valid email address
    function isEmailAddress($field, $msg)
    {
    $value = $this->_getValue($field);
    $pattern = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/";
    if(preg_match($pattern, $value))
    {
    return true;
    }
    else
    {
    $this->_errorList[] = array("field" => $field, "value" => $value, "msg" => $msg);
    return false;
    }
    }


    Note that I am having this issue with apps such as Word Press, which works on another server.

    Thanks for your help!
     
    jsamdirect, Mar 8, 2008 IP
  4. jsamdirect

    jsamdirect Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Looking deeper into it... it seems that the issue is with preg_match. Looks like non of the code that uses it is working.
     
    jsamdirect, Mar 8, 2008 IP
  5. jsamdirect

    jsamdirect Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok, I determined that I can run php script from the bash prompt fine. However whenever I run them from a browser preg_match always returns false. Any thoughts why this would be?
     
    jsamdirect, Mar 8, 2008 IP