close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

users_EmailPW redirect

Thread began 1/27/2011 6:34 pm by danielsebas | Last modified 8/01/2012 1:20 am by Web Designer Troy | 2098 views | 6 replies |

danielsebas

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.

Sign in to reply to this post

Jason ByrnesWebAssist

that code change is changing the redirect for failed validations. you want to set the redirect ion the Universal Email server behavior.


double click the universal email server behavior and set the go to page to "index.php?id=newpass"

instead of changing the validation failed redirect.

Sign in to reply to this post

danielsebas

Hi Jason, I have Universal Email 4 installed and the version used in the solution pack is a different version, when I double click in the server behaviors panel the Universal Email option that is installed in the page it shows me the information of the fields, so I only added in the go dialog box the page to refresh, and it refreshes were it should like in the other option if I change manually the code, but what I want is to maintain the default option of the users_EMailPW.php were it appears the message that the email was sent or that the email is not in the records or that it fails to send the mail within the same page.

Thank you in advance for your help

Sign in to reply to this post

danielsebas

Hi Jason, I accomplished what I wanted without changing the Universal Email code, I just deleted the action="users_EmailPW" from the form.

Sign in to reply to this post

Jason ByrnesWebAssist

OK, glad to hear it is working.

Sign in to reply to this post

Web Designer Troy

$_SERVER['PHP_SELF']; is giving a double path entry

My question has nothing to do with the above issue. But, I need to ask my questions somewhere.

$_SERVER['PHP_SELF']; is giving a double path entry. I seen this issue in the forum before. What is it?

Reproduce code:
---------------
<?php
echo $_SERVER['PHP_SELF'];
?>

Expected result:
----------------
/testself/testself.php

Actual result:
--------------
/testself/testself.php/testself.php

Sign in to reply to this post

Web Designer Troy

I found the solution

In my php5.ini file, I needed to set:


cgi.fix_pathinfo = 1

to

cgi.fix_pathinfo = 0

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...