コード例 #1
0
ファイル: newprofile.php プロジェクト: jphilip124/Symbiota
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
$login = array_key_exists('login', $_POST) ? $_POST['login'] : '';
$emailAddr = array_key_exists('emailaddr', $_POST) ? $_POST['emailaddr'] : '';
$action = array_key_exists("submit", $_REQUEST) ? $_REQUEST["submit"] : '';
$pHandler = new ProfileManager();
$displayStr = '';
//Sanitation
if ($login) {
    if (!$pHandler->setUserName($login)) {
        $login = '';
        $displayStr = 'Invalid login name';
    }
}
if ($emailAddr) {
    if (!$pHandler->validateEmailAddress($emailAddr)) {
        $emailAddr = '';
        $displayStr = 'Invalid login name';
    }
}
if ($action && !preg_match('/^[a-zA-Z0-9\\s_]+$/', $action)) {
    $action = '';
}
if ($action == "Create Login") {
    $okToCreateLogin = true;
    if ($useRecaptcha) {
        $resp = recaptcha_check_answer($RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if (!$resp->is_valid) {
            // What happens when the CAPTCHA was entered incorrectly
            $okToCreateLogin = false;
            $displayStr = "The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")";