View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Help with Verify Form field Information

Thread began 12/11/2009 10:40 am by buonsen368464 | Last modified 1/04/2010 3:56 pm by buonsen368464 | 3113 views | 21 replies

Walikan

Help with Verify Form field Information

Thanks Eric,
Welcome back from holidays.
I am expecting that user should not directly have access to the userEmailPW page. That implies, user must first pass through verify page with entered information that must match the information found in the database. If the user entered information match, then the user is redirected to the userEmailPW page. If the user entered information does not match, user is redirected back to verify page.

As of now, using recordset, I can verify user entered information.

Below is the script for the verify.php page

<?php require_once('../Connections/spartancare.php');?>
<?php require_once( "../WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php
if($_SERVER["REQUEST_METHOD"] == "POST"){
$WA_Auth_Parameter = array(
"connection" => $spartancare,
"database" => $database_spartancare,
"tableName" => "user",
"columns" => explode($WA_Auth_Separator,"FirstName".$WA_Auth_Separator."LastName".$WA_Auth_Separator."Phone".$WA_Auth_Separator."Zipcode"),
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["FirstName"]))?$_POST["FirstName"]:"") ."".$WA_Auth_Separator."".((isset($_POST["LastName"]))?$_POST["LastName"]:"") ."".$WA_Auth_Separator."".((isset($_POST["Phone"]))?$_POST["Phone"]:"") ."".$WA_Auth_Separator."".((isset($_POST["Zipcode"]))?$_POST["Zipcode"]:"") .""),
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text".$WA_Auth_Separator."text".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"FirstName".$WA_Auth_Separator."LastName".$WA_Auth_Separator."Phone".$WA_Auth_Separator."Zipcode"),
"sessionNames" => explode($WA_Auth_Separator,"FirstName".$WA_Auth_Separator."LastName".$WA_Auth_Separator."Phone".$WA_Auth_Separator."Zipcode"),
"successRedirect" => "userEmailPW.php?succeed=true",
"failRedirect" => "verify.php?failed=true",
"gotoPreviousURL" => TRUE,
"keepQueryString" => TRUE
);

WA_AuthenticateUser($WA_Auth_Parameter);
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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_verifyrs = "-1";
if (isset($_SESSION['FirstName'])) {
$colname_verifyrs = (get_magic_quotes_gpc()) ? $_SESSION['FirstName'] : addslashes($_SESSION['FirstName']);
}
$colname_verifyrs = "-1";
if (isset($_SESSION['LastName'])) {
$colname_verifyrs = (get_magic_quotes_gpc()) ? $_SESSION['LastName'] : addslashes($_SESSION['LastName']);
}
$colname_verifyrs = "-1";
if (isset($_SESSION['Phone'])) {
$colname_verifyrs = (get_magic_quotes_gpc()) ? $_SESSION['Phone'] : addslashes($_SESSION['Phone']);
}
$colname_verifyrs = "-1";
if (isset($_SESSION['Zipcode'])) {
$colname_verifyrs = (get_magic_quotes_gpc()) ? $_SESSION['Zipcode'] : addslashes($_SESSION['Zipcode']);
}

mysql_select_db($database_spartancare, $spartancare);
$query_verifyrs = "SELECT `user`.FirstName, `user`.LastName, `user`.Phone, `user`.Zipcode FROM `user`";
$verifyrs = mysql_query($query_verifyrs, $spartancare) or die(mysql_error());
$row_verifyrs = mysql_fetch_assoc($verifyrs);
$totalRows_verifyrs = mysql_num_rows($verifyrs);
?>

This is the custom script you proposed to be added after the code of the recordset

<?php if ($totalRows_verifyrs > 0) { // if recordset not empty
if(!session_id()) session_start();
$_SESSION['sent'] = 1
header("Location: userEmailPW.php");
?>



Also, below is the userEmailPW.php page

<?php require_once('../Connections/spartancare.php');?>
<?php require_once( "../WA_SecurityAssist/Helper_PHP.php" );
?>
<?php
if (!session_id()) session_start();
if(isset($_POST["Sent"])) {
$_SESSION["sent"] = "".$_SESSION['sent'] ."";
}
?>
<?php


function WA_SecurityAssist_Email_1_SendMail($WA_Auth_Parameter){
$WA_MailObject = WA_SecurityAssist_Definition("mail.mysite.com","25","admin@mysite.com","","","");
$WA_MailObject = WA_SecurityAssist_SendMail($WA_MailObject,"","","",$WA_Auth_Parameter["toAddress"],"",$WA_Auth_Parameter["fromAddress"],$WA_Auth_Parameter["subject"],$WA_Auth_Parameter["mailBody"]);
$WA_MailObject = null;
}// WA_SecurityAssist_Email_1_SendMail
?>
<?php
if(isset($_POST["Send"])){
//WA SecurityAssist Email object="Mail for Linux"
$WA_Auth_Parameter = array(
"connection" => $spartancare,
"database" => $database_spartancare,
"tableName" => "user",
"filterColumn" => "UserName",
"columnValue" => "".((isset($_POST["UserName"]))?$_POST["UserName"]:"") ."",
"columnType" => "text",
"usernameColumn" => "UserName",
"passwordColumn" => "Password",
"selectColumns" => array(""),
"sessionVariables" => array(""),
"successRedirect" => "userEmailPW.php?succeed=true",
"failRedirect" => "userEmailPW.php?failed=true",
"keepQueryString" => TRUE,
"toAddressColumn" => "UserName",
"fromAddress" => "admin@mysite.com",
"fromAddressDisplay" => "Password Admin",
"subject" => "Your Account Password",
"mailBody" => "User name: [UserName]\nPassword: [Password]",
"emailFunction" => "WA_SecurityAssist_Email_1_SendMail"
);

WA_Auth_ForgotPassword($WA_Auth_Parameter);
}
?>

I followed your instructions from the previous post and after testing the verify page, I received the following error:

Parse error: syntax error, unexpected T_STRING in /home/spart15/public_html/spartanman/myaccount/verify.php on line 79

Thanks

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...