Page 1 of 2
Code Check Please
Posted: Wed Dec 03, 2003 1:58 pm
by AliasBDI
I have a problem with this code, but I am receiving no error:
Code: Select all
$result = mysql_query("SELECT first_name, last_name, email_address, username, decrypted_password, dl, birth FROM users WHERE dl='$dl' AND birth='$birth' ") or die (mysql_error());
if (!$result) {
print "ERROR - browse query failed.";
exit();
}
while ( $row = mysql_fetch_array($result) )
{
Posted: Wed Dec 03, 2003 2:05 pm
by infolock
care to clarify on the problem then?
???
Posted: Wed Dec 03, 2003 2:09 pm
by AliasBDI
I don't know the problem. I assume the code has an error somewhere. It stops at this part of the code and displays a blank page when called. Here is the full page:
Code: Select all
<?php
include '../includes/db.php';
// Define post fields into simple variables. These are called CONSTANTS.
$dl = $_POSTї'dl'];
$birth = $_POSTї'birth'];
/* Lets strip some slashes in case the user entered
any escaped characters. */
$dl = stripslashes($dl);
$birth = stripslashes($birth);
/* Do some error checking on the form posted fields */
if((!$dl) || (!$birth)){
header('Location: forgot2.php');
/*echo 'You did not submit the following required information! <br />';
if(!$dl){
echo "Drivers License is a required field. Please enter it below.<br />";
}
if(!$birth){
echo "Birth Date is a required field. Please enter it below.<br />";
}
include 'forgot.php'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script! */
}
// Find record in database.
$result = mysql_query("SELECT first_name, last_name, email_address, username, decrypted_password, dl, birth FROM users WHERE dl='$dl' AND birth='$birth' ") or die (mysql_error());
if (!$result) {
print "ERROR - browse query failed.";
exit();
}
while ( $row = mysql_fetch_array($result) )
{
$username = $rowї'username'];
$password = $rowї'decrypted_password'];
$first = $rowї'first_name'];
$last = $rowї'last_name'];
$last = $rowї'email_address'];
$activatepath = "/students/login.php";
// Let's mail the user!
$subject = "USERNAME and PASSWORD request at $sitename";
$message = "Dear $first $last,
You or someone posing to be you requested that a copy of your USERNAME and PASSWORD to be sent to this email address.
Please disregard this email if you did not request it. However, if you do wish to login to your BLASTER account, click on the following link (or copy/paste it into your browser address bar):
$sitepath$activatepath
Your information for login is stated below:
Username: $username
Password: $password
**Please keep this username and password in a location that is easily accessible by you.
Thanks!
$sitename
http://www.ticketblasters.com
bs:281.457.6700
This is an automated response, please do not reply!";
mail($email, $subject, $message, "From: $sitename <$adminemail>\nX-Mailer: PHP/" . phpversion());
header('Location: _success_forget.php');
//echo $email;
}
?>
Posted: Wed Dec 03, 2003 2:12 pm
by Saethyr
no changes, just making easier to look at.
Code: Select all
<?php
include '../includes/db.php';
// Define post fields into simple variables. These are called CONSTANTS.
$dl = $_POST['dl'];
$birth = $_POST['birth'];
/* Lets strip some slashes in case the user entered
any escaped characters. */
$dl = stripslashes($dl);
$birth = stripslashes($birth);
/* Do some error checking on the form posted fields */
if((!$dl) || (!$birth)){
header('Location: forgot2.php');
/*echo 'You did not submit the following required information! <br />';
if(!$dl){
echo "Drivers License is a required field. Please enter it below.<br />";
}
if(!$birth){
echo "Birth Date is a required field. Please enter it below.<br />";
}
include 'forgot.php'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script! */
}
// Find record in database.
$result = mysql_query("SELECT first_name, last_name, email_address, username, decrypted_password, dl, birth FROM users WHERE dl='$dl' AND birth='$birth' ") or die (mysql_error());
if (!$result) {
print "ERROR - browse query failed.";
exit();
}
while ( $row = mysql_fetch_array($result) )
{
$username = $row['username'];
$password = $row['decrypted_password'];
$first = $row['first_name'];
$last = $row['last_name'];
$last = $row['email_address'];
$activatepath = "/students/login.php";
// Let's mail the user!
$subject = "USERNAME and PASSWORD request at $sitename";
$message = "Dear $first $last,
You or someone posing to be you requested that a copy of your USERNAME and PASSWORD to be sent to this email address.
Please disregard this email if you did not request it. However, if you do wish to login to your BLASTER account, click on the following link (or copy/paste it into your browser address bar):
$sitepath$activatepath
Your information for login is stated below:
Username: $username
Password: $password
**Please keep this username and password in a location that is easily accessible by you.
Thanks!
$sitename
http://www.ticketblasters.com
bs:281.457.6700
This is an automated response, please do not reply!";
mail($email, $subject, $message, "From: $sitename <$adminemail>\nX-Mailer: PHP/" . phpversion());
header('Location: _success_forget.php');
//echo $email;
}
?>
Posted: Wed Dec 03, 2003 2:19 pm
by infolock
let me reitterate what I meant.
You say the page is displaying blank. Well, this page isn't echoing anything out to be posted to the page, so the page will be blank..
Or do you mean the email is blank? or the email isn't being sent at all?
in other words, what was you expecting to happen?
Posted: Wed Dec 03, 2003 2:21 pm
by mrvanjohnson
$email is not defined change
Code: Select all
<?php
$last = $row['email_address'];
?>
to
Code: Select all
<?php
$email = $row['email_address'];
?>
Sorry...
Posted: Wed Dec 03, 2003 2:21 pm
by AliasBDI
The email is not being generated. Nor is the page redirecting (as the header states). So the page is blank. I did some testing on the page to show me where the code was stopping, and that is the code I posted originally.
Sorry about the mix up.
Posted: Wed Dec 03, 2003 2:24 pm
by JAM
What is the error levels set as? If they are off (or to low) you might want to consider bumping them up so that any error messages that are supressed gets visible to you.
JAM
Posted: Wed Dec 03, 2003 2:30 pm
by AliasBDI
I'm not familiar with setting error levels...
Posted: Wed Dec 03, 2003 2:31 pm
by mrvanjohnson
I don't think you have an error, check my posting on changing your line of code and let me know what you think.
Posted: Wed Dec 03, 2003 2:33 pm
by mrvanjohnson
For the record, you would change you Error Level reporting in your php.ini file. I believe you can also set it in the script using the [php_man]error_reporting() [/php_man]function
Posted: Wed Dec 03, 2003 2:40 pm
by JAM
Checking it:
Code: Select all
echo 'Error Level: '.(ini_get('error_reporting') == '2047' ? 'E_ALL' : 'Not E_ALL')."\n";
If it's not E_ALL;
Setting it:
Code: Select all
ini_set ('error_reporting', E_ALL);
(added on top of the page)
mrvanjohnson might be very right, just thought it was worth mentioning.
mrvanjohnson
Posted: Wed Dec 03, 2003 2:43 pm
by AliasBDI
I must have missed your post. I corrected it. That was definitely a mess up. However, it did not resolve the problem. It is still acting the same.
Posted: Wed Dec 03, 2003 2:50 pm
by infolock
have you setup access to the sendmail binary on your system ? or are you using some other type of mail program?
also, have you looked at
http://www.php.net/mail ?
infolock
Posted: Wed Dec 03, 2003 3:19 pm
by AliasBDI
I actually have another page running a similar script that emails new users who create accounts in order that they be confirmed. So email is working.