<?PHP
global $AF, $SPT_DBUserName, $SPT_DBPassword, $SPT_DBHost;

if (isset($_GET["D"]) && isset($_GET["C"]) &&
    md5($_GET["D"].$SPT_DBUserName.$SPT_DBPassword.$SPT_DBHost) == $_GET["C"] )
{
    $Response = unserialize( gzinflate( base64_decode( $_GET["D"] )));

    if (isset($_POST["F_UserEmail"]) &&
        User::IsValidLookingEMailAddress($_POST["F_UserEmail"]))
    {

        $Response["ExtendedInfo"]["email"] = $_POST["F_UserEmail"];

        $DataSerial = base64_encode(gzdeflate(serialize($Response)));
        $CkSum = md5($DataSerial.$SPT_DBUserName.$SPT_DBPassword.$SPT_DBHost);

        $AF->SetJumpToPage("P_OpenId_CreateUser&D=".urlencode($DataSerial)."&C=".$CkSum);
    }
    else
    {
        $Response["ErrorMessage"] = "Invalid email address provided.";

        $DataSerial = base64_encode(gzdeflate(serialize($Response)));
        $CkSum = md5($DataSerial.$SPT_DBUserName.$SPT_DBPassword.$SPT_DBHost);

        $AF->SetJumpToPage("P_OpenId_GetUserEmail&D=".urlencode($DataSerial)."&C=".$CkSum);
    }
}

?>