users_EmailPW redirect
Hi, I am using framework with the Registration Solution Pack, I add the update record from DataAssist and encrypted the password, I didn't used the SecurityAssist mail option but the default form the users_EmailPW (Universal email 1) I edited the session function for the NewPW cookie.
Everything woks fine but when I send the email the page refreshes under the user_EmailPW.php page and I need it to refresh in the index?id=newpass showing the message that the email was sent. I changed the $WAFV_Redirect = $_SERVER["PHP_SELF"]; to $WAFV_Redirect = header('Location: index.php?id=newpass'); and the mail is sent and the page refreshes were it should but it doesn't show the message that the mail was sent.
Here is my code:
// WA Application Builder Update
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $PowerCMSConnection;
$WA_table = "users";
$WA_redirectURL = "";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "UserEmail";
$WA_fieldNamesStr = "UserPassword";
$WA_fieldValuesStr = "".WA_SHA1Encryption($_SESSION['NuevoPass']) ."";
$WA_columnTypesStr = "',none,''";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_where_fieldValuesStr = "".((isset($_POST["emailAddress"]))?$_POST["emailAddress"]:"") ."";
$WA_where_columnTypesStr = "',none,''";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);
$WA_connectionDB = $database_PowerCMSConnection;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_LostPW = "-1";
if (isset($_POST['emailAddress'])) {
$colname_LostPW = (get_magic_quotes_gpc()) ? $_POST['emailAddress'] : addslashes($_POST['emailAddress']);
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_LostPW = sprintf("SELECT * FROM users WHERE UserEmail = %s", GetSQLValueString($colname_LostPW, "text"));
$LostPW = mysql_query($query_LostPW, $PowerCMSConnection) or die(mysql_error());
$row_LostPW = mysql_fetch_assoc($LostPW);
$totalRows_LostPW = mysql_num_rows($LostPW);
?>
<?php
if (isset($_POST["Send_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_usersEmailPW_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateEM(((isset($_POST["emailAddress"]))?$_POST["emailAddress"]:"") . "",true,1);
$WAFV_Errors .= WAValidateNM($totalRows_LostPW . "",1,100,"",",.",true,2);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"usersEmailPW");
}
}
?>
<?php
if (!session_id()) session_start();
if(isset($_POST["Send_x"])) {
$nuevopass = $_SESSION['NuevoPass'];
$_SESSION["NuevoPass"] = "".WA_RandomPassword(9, true, true, true, "") ."";
}
?>
<?php
if (($_SERVER["REQUEST_METHOD"] == "POST")) {
//WA Universal Email object="mail"
//Send Loop Once Per Entry
$RecipientEmail = "".((isset($_POST["emailAddress"]))?$_POST["emailAddress"]:"") ."";include("WA_Universal_Email/WAUE_users_EmailPW_1.php");
//Send Mail All Entries
if (""!="") {
header("Location: ");
}
}
Instead of the NewPW session variable I am using the name: NuevoPass
In the ecart session I added: $nuevopass = $_SESSION['NuevoPass']; so I can use $nuevopass in the lost_password.php template page to send the unencrypted password in the mail.
Thank you in advance.