$submit = $_POST[‘submit’];
$email_required = $_POST[’email_required’];
$reset_id = urldecode($_GET[‘reset_id’]);
$new_password = $_POST[‘new_password’];
$conf_new_password = $_POST[‘conf_new_password’];
$ts = urldecode($_GET[‘ts’]);
if ($email_required)
{
if ($new_password && !$conf_new_password)
{
echo “ALERT: Please confirm your password.”;
}
else
{
if ($conf_new_password && !$new_password)
{
echo “ALERT: Please confirm your password.”;
}
else
{
if (strlen($new_password) > 5)
{
if ($new_password == $conf_new_password)
{
if ($email_required && $reset_id && $new_password && $conf_new_password)
{
$url = “http://www.tcg.org/auth/wp/passres.cfc?method=ResetPwd&EmailRequired=”.$email_required.”&ResetID=”.$reset_id.”&NewPwd=”.$new_password.”&returnformat=json&ts=”.$ts;
//echo $url;
//die();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$xml = curl_exec($ch);
curl_close($ch);
$json = json_decode($xml);
$response = $json->DATA;
//echo $url;
// echo $response[0][0];
// die();
if ( $response[0][0] == ‘THIS LINK IS NO LONGER VALID. NO ACTION WAS TAKEN. PLEASE RESUBMIT YOUR REQUEST.’)
{
echo $response[0][0];
//echo $url;
// die();
header (“Refresh: 1; url=http://www.americantheatre.org/password-reset/”);
die();
}
if ( $response[0][0] == ‘NO ACTION WAS TAKEN. PLEASE CALL CUSTOMER SERVICE AT 212.609.5900’)
{
//echo $url;
echo $response[0][0];
die();
}
if ( $response[0][0] == ‘PASSWORD WAS UPDATED.’)
{
echo “Your password has been updated. You are now being re-directed to the login page.”;
header (“Refresh: 1; url=http://www.americantheatre.org/log-in/”);
die();
}
//var_dump($response);
//die();
}
else
{
echo “ALERT: There was an error processing your request.”;
}
}
else
{
echo “ALERT: Your passwords do not match.”;
}
}
else
{
echo “ALERT: Your password must be at least 5 characters.”;
}
}
}
}
else
{
echo “Enter your email address and new password.”;
}