close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to include dynamic data in the e-mail receipt? Problem with Session values.

Thread began 3/01/2017 7:57 pm by Nathon Jones Web Design | Last modified 3/01/2017 8:37 pm by Ray Borduin | 139 views | 1 replies |

Nathon Jones Web Design

How to include dynamic data in the e-mail receipt? Problem with Session values.

I have a password reset page:
http://www.dreamcaruk.com/dreamcar-reset.php

This asks the user to enter their e-mail, to be sent a reset password link. You will note that I've revealed the hidden WA_RandomPassword field in the above example. When the form is submitted, this opens the http://www.dreamcaruk.com/dreamcar-reset-checkemail.php page which is structured, in terms of server behaviour order, as follows:

Recordset - filtered by the e-mail address entered on the previous page
Create Session - the WA_RandomPassword value from the hidden form field on the previous page (revealed for this example)
Update - saves the WA_RandomPassword to the users record
Universal E-mail - sends a plain text e-mail with a link that includes the e-mail address and WA_RandomPassword values as querystrings.

When the user clicks the link in the above e-mail, I want them to be transported to a confirmation page that checks the username and password against the record in database and, if they both match, presents a Reset Password form which allows the user to change their password.

On the page that contains the Recordset, Create Session, Update and Universal E-mail behaviours I have this to create the session value.

<?php
@session_start();
if("" == "") {
$_SESSION["NEWtempPW"] = "".((isset($_POST["tempPW"]))?$_POST["tempPW"]:"") ."";
}
?>



My e-mail confirmation template is:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Reset Password</title>

<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
h1 {
font-size: 3rem;
color: #00aeef;
}
.blue {
color: #00aeef;
}
a {
color: #00aeef;
text-decoration: none;
}
</style>
</head>

<body>

<p>Sorry that you're having trouble with your password. Please click on the link below to reset your password and play today!</p>

<p><a href="http://www.dreamcaruk.com/dreamcar-reset-confirm.php?DCe=<?php echo($rsWHO->getColumnVal("DCuserEMAIL")); ?>&DCp=<?php echo $_SESSION['NEWtempPW']; ?>">http://www.dreamcaruk.com/dreamcar-reset-confirm.php?DCe=<?php echo($rsWHO->getColumnVal("DCuserEMAIL")); ?>&DCp=<?php echo $_SESSION['NEWtempPW']; ?></a></p>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p>&copy; 2016-<?php echo date("Y") ?> All Rights Reserved. <a href="http://www.dreamcargalaxy.com" style="color: #fff;">DREAM <span class="blue">CAR</span> GALAXY</a> | <a href="http://www.dreamcargalaxy.com/terms-conditions.php" class="blue">Terms</a> | <a href="http://www.dreamcargalaxy.com/privacy-policy.php" class="blue">Privacy</a> | <a href="http://www.dreamcargalaxy.com/contact.php" class="blue">Contact</a></p>

</body>
</html>



You'll see what happens when you click "Reset Password". .The e-mail receipt page is being displayed directly in the browser as opposed to arriving by email to the user.

Any idea why? Is it because I have dynamic code in the e-mail receipt page? Is there any way to include that as I need to query the table on the final reset password page, before allowing them to reset.

Hope you can help. Thank you.
NJ

EDIT: Looks like I need to add globals to the head of the e-mail receipt page:
<?php
global $rsWHO;
global $_SESSION_NEWtempPW;
?>

Sign in to reply to this post

Ray BorduinWebAssist

That is correct. Any variables that are defined on the page that you want to use in your email body have to be declared as globals.

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