Michael, thanks for responding so quickly!!
Below is the code. What I am I doing wrong?
//processing page #1, processes the username and password (Registration page form)
//I have this code at the end of the form processing page:
if(isset($_POST['submit'])
{
//This makes sure they did not leave any fields blank
if(empty($_POST['d_email']
{
die('Please complete all of the required fields. Use your [Back] button to return and try again.');
}
// checks if the username is in use
if (!get_magic_quotes_gpc())
{
$_POST['d_email'] = addslashes($_POST['d_email
}
$usercheck = $_POST['d_email'];
$check = mysql_query("SELECT d_email FROM dealer_user WHERE d_email = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0)
{
die('Sorry, the Email '.$_POST['d_email'].' is already in use. Use your [Back] button to return and try again!');
}
// this makes sure both passwords entered match
if ($_POST['d_pass'] != $_POST['dpassword_confirm'
{
die('Your passwords did not match. Use your [Back] button to return and try again! ');
}
// *************check e-mail format**OK****************
if (!preg_match("/.*@.*..*/",
{
die('Invalid e-mail address.');
}
//SET COOKIE
$_POST['d_email'] = stripslashes($_POST['d_ema
$_POST['d_pass'] = stripslashes($_POST['d_pas
$hour = time() + 0;
//SET TO EXPIRE WHEN BROWSER IS CLOSED at 0 closed or 3600 for 1 hour
setcookie(BBBeCookie, $_POST['d_email'], $hour, '/', '.badboydealerportal.com')
setcookie(BBBpCookie, $_POST['d_pass'], $hour, '/', '.badboydealerportal.com')
// SET SESSION VARIABLES
$_SESSION['d_email'] = $_POST['d_email'];
$_SESSION['d_pass'] = $_POST['d_pass'];
// here we encrypt the password and add slashes if needed
$_POST['d_pass'] = md5($_POST['d_pass']);
if (!get_magic_quotes_gpc())
{
$_POST['d_pass'] = addslashes($_POST['d_pass'
$_POST['d_email'] = addslashes($_POST['d_email
}
/* INSERT INTO DATABASE NOW, INSTEAD OF HOLD THE VARIABLES IN THE SESSION VARIABLES AND WAIT TO POST THEM ON THE NEXT PAGE ****************/
/*now we insert it into the database ********OK**********/
$insert = "INSERT INTO dealer_user (d_email, d_pass, signup_date, trackerID) VALUES ('".$_POST['d_email']."', '". $_POST['d_pass']."', now(), '".$_SESSION['trackerID'].
$addNewDealer = mysql_query($insert);
if (!$addNewDealer)
{
echo 'There has been a database error. Please contact the webmaster.' . mysql_error();
}
else
{
/****THIS SETS THE dealer_id auto increment # to trackerID and is saved to database*****
$dealer_id = mysql_insert_id(); //this would be the dealer_id autoincremented for this dealer row
$_SESSION['trackerID'] = $dealer_id;
}
session_write_close();
echo header("Location: Register2.php" );
/*************************
}
As you can see I saved the password to the Session variable before it was encrypted and it shows fine in the print_r function as the non-encrypted password.
Then on the next page, the user enters other Registration information (contact info)
The session variables are passed from page to page correctly.
This form is then processed with processRegister2.php
On this processing page, once the user enters all of his/her information, an email confirmation is sent.
I want to be able to pull the $_SESSION [password] and make it = to a $variable to be used in the mail() function, instead of pulling the encrypted password from the database.
Is this possible?? Can you pass Session variables into functions?
THANKS SO MUCH!!
Main Topics
Browse All Topics





by: Michael701Posted on 2009-07-08 at 18:32:35ID: 24810049
you should be able to reference it by $_SESSION['password'] (or whatever name you assigned it)
Remember $_SESSION variables are not available until the NEXT page load. Are you trying to set and use the $_SESSION['password'] in the same page?