By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,711 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,711 IT Pros & Developers. It's quick & easy.

No PHP Error. Just "Page Cannot be displayed"

P: n/a
I was wondering if someone could explain why I'm receiving this error. It's
like a 404 error but I think it might be something else.

Basically, I have a page where a user inputs his email address. The system
is supposed to look up the email address and send the associated password to
that email address. It worked up until a few months ago. Note that the
validation works. So, if the user tries to submit a blank text box, it
returns an error. If the email address is not found, it returns an error
"Email not found." But if the email is valid, it just dies. This code
worked a few months ago when I initially wrote it.

Thanks for any help.

<html>
<head>
<title>Rateagame.net: Forgot Password</title>
<link rel=stylesheet type=text/css href=/rateagame.css>
</head>
<body bgcolor="#000000" topmargin="0" leftmargin="0" marginheight="0"
marginwidth="0">
<p align="center">
<?

virtual("includes/header.inc");

$email=$_POST['strEmail'];

if ($email != "") {

$dbh = mysql_pconnect("*","*","*");

mysql_select_db("mja674s",$dbh);

$query="SELECT UserName, UserPassword, UserEmail FROM Users Where UserEmail
= '$email'";

$result=mysql_query($query);

$returned=mysql_num_rows($result);

if ($returned>0) {

while($row=mysql_fetch_array($result)) {
$data=$row["UserPassword"];
$td = mcrypt_module_open (MCRYPT_TripleDES, "",
MCRYPT_MODE_ECB,"");
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
$dectext = trim(mcrypt_ecb
(MCRYPT_TripleDES,(Keysize),hex2bin($data), MCRYPT_DECRYPT,$iv));

$user_name = $row["UserName"];

$message = "Hello $user_name!\n\nYour password is:
$dectext\n\nRegards,\n\nThe Rateagame.net Team\nw********@rateagame.net";
mail($row["UserEmail"], "Your Rateagame.net Password", $message, "From:
we*******@rateagame.net");

$output_message = FormatText("Your password was sent to $email");
echo $output_message;
}

} else {

$output_message = FormatText("Email Not Found");
echo $output_message;

}
} else {

$output_message = FormatText("Email is Blank");
echo $output_message;

}

function hex2bin($data) {
$len = strlen($data);
return pack("H" . $len, $data);
}

function FormatText($text) {
$output_text = "<p align='center'><b><font face='Trebuchet MS' size='2'
color='#6A6AFF'>$text</font></b></p>";
return $output_text;
}

?>
</body>
</html>
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Matt <aw***********@aol.com> wrote:
I was wondering if someone could explain why I'm receiving this error. It's
like a 404 error but I think it might be something else.


[without taking a look at the provided PHP code]
Are you using IE? The IE might be showing it's own "friendly" error
page. Turn this feature of or use any other browser to find out what is
really being sent to the client...

--

Daniel Tryba

Jul 17 '05 #2

P: n/a
I had that turned off, yes, but still received the "page cannot be
displayed" error.

Matt
"Daniel Tryba" <ne****************@canopus.nl> wrote in message
news:c6**********@news.tue.nl...
Matt <aw***********@aol.com> wrote:
I was wondering if someone could explain why I'm receiving this error. It's like a 404 error but I think it might be something else.


[without taking a look at the provided PHP code]
Are you using IE? The IE might be showing it's own "friendly" error
page. Turn this feature of or use any other browser to find out what is
really being sent to the client...

--

Daniel Tryba

Jul 17 '05 #3

P: n/a
"Matt" <aw***********@aol.com> wrote in message news:<1uvkc.3954$I%1.352887@attbi_s51>...
I was wondering if someone could explain why I'm receiving this error. It's
like a 404 error but I think it might be something else.

Basically, I have a page where a user inputs his email address. The system
is supposed to look up the email address and send the associated password to
that email address. It worked up until a few months ago. Note that the
validation works. So, if the user tries to submit a blank text box, it
returns an error. If the email address is not found, it returns an error
"Email not found." But if the email is valid, it just dies. This code
worked a few months ago when I initially wrote it.

Thanks for any help.

<html>
<head>
<title>Rateagame.net: Forgot Password</title>
<link rel=stylesheet type=text/css href=/rateagame.css>
</head>
<body bgcolor="#000000" topmargin="0" leftmargin="0" marginheight="0"
marginwidth="0">
<p align="center">
<?

virtual("includes/header.inc");
[snip]

Your problems might be here, since the virtual() command does an
Apache-level inclusion of a file that might itself be configured. Try
doing this and see if you still get the error:

@virtual("includes/header.inc"); // Use "@" to suppress the warning

see http://www.php.net/manual/en/function.virtual.php

Otherwise I am not sure what could be causing your problem as the rest
of your code seems valid. Shutting off "friendly errors" in your
browser will give you a clearer idea from the server end what might
actually be going on.

Phil


$email=$_POST['strEmail'];

if ($email != "") {

$dbh = mysql_pconnect("*","*","*");

mysql_select_db("mja674s",$dbh);

$query="SELECT UserName, UserPassword, UserEmail FROM Users Where UserEmail
= '$email'";

$result=mysql_query($query);

$returned=mysql_num_rows($result);

if ($returned>0) {

while($row=mysql_fetch_array($result)) {
$data=$row["UserPassword"];
$td = mcrypt_module_open (MCRYPT_TripleDES, "",
MCRYPT_MODE_ECB,"");
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
$dectext = trim(mcrypt_ecb
(MCRYPT_TripleDES,(Keysize),hex2bin($data), MCRYPT_DECRYPT,$iv));

$user_name = $row["UserName"];

$message = "Hello $user_name!\n\nYour password is:
$dectext\n\nRegards,\n\nThe Rateagame.net Team\nw********@rateagame.net";
mail($row["UserEmail"], "Your Rateagame.net Password", $message, "From:
we*******@rateagame.net");

$output_message = FormatText("Your password was sent to $email");
echo $output_message;
}

} else {

$output_message = FormatText("Email Not Found");
echo $output_message;

}
} else {

$output_message = FormatText("Email is Blank");
echo $output_message;

}

function hex2bin($data) {
$len = strlen($data);
return pack("H" . $len, $data);
}

function FormatText($text) {
$output_text = "<p align='center'><b><font face='Trebuchet MS' size='2'
color='#6A6AFF'>$text</font></b></p>";
return $output_text;
}

?>
</body>
</html>

Jul 17 '05 #4

P: n/a
hmm... That didn't see to help, unfortunately.

I did notice that if I type in the page manually, without any post data
being sent, it says "email is blank," which it is supposed to do.

However, it also gives me this error:

Notice: Undefined index: strEmail in /home/mja674s/www/sendpassword.php4 on
line 0

Matt
"Phil Powell" <so*****@erols.com> wrote in message
news:1c**************************@posting.google.c om...
"Matt" <aw***********@aol.com> wrote in message

news:<1uvkc.3954$I%1.352887@attbi_s51>...
I was wondering if someone could explain why I'm receiving this error. It's like a 404 error but I think it might be something else.

Basically, I have a page where a user inputs his email address. The system is supposed to look up the email address and send the associated password to that email address. It worked up until a few months ago. Note that the
validation works. So, if the user tries to submit a blank text box, it
returns an error. If the email address is not found, it returns an error "Email not found." But if the email is valid, it just dies. This code
worked a few months ago when I initially wrote it.

Thanks for any help.

<html>
<head>
<title>Rateagame.net: Forgot Password</title>
<link rel=stylesheet type=text/css href=/rateagame.css>
</head>
<body bgcolor="#000000" topmargin="0" leftmargin="0" marginheight="0"
marginwidth="0">
<p align="center">
<?

virtual("includes/header.inc");


[snip]

Your problems might be here, since the virtual() command does an
Apache-level inclusion of a file that might itself be configured. Try
doing this and see if you still get the error:

@virtual("includes/header.inc"); // Use "@" to suppress the warning

see http://www.php.net/manual/en/function.virtual.php

Otherwise I am not sure what could be causing your problem as the rest
of your code seems valid. Shutting off "friendly errors" in your
browser will give you a clearer idea from the server end what might
actually be going on.

Phil


$email=$_POST['strEmail'];

if ($email != "") {

$dbh = mysql_pconnect("*","*","*");

mysql_select_db("mja674s",$dbh);

$query="SELECT UserName, UserPassword, UserEmail FROM Users Where UserEmail = '$email'";

$result=mysql_query($query);

$returned=mysql_num_rows($result);

if ($returned>0) {

while($row=mysql_fetch_array($result)) {
$data=$row["UserPassword"];
$td = mcrypt_module_open (MCRYPT_TripleDES, "",
MCRYPT_MODE_ECB,"");
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); $dectext = trim(mcrypt_ecb
(MCRYPT_TripleDES,(Keysize),hex2bin($data), MCRYPT_DECRYPT,$iv));

$user_name = $row["UserName"];

$message = "Hello $user_name!\n\nYour password is:
$dectext\n\nRegards,\n\nThe Rateagame.net Team\nw********@rateagame.net"; mail($row["UserEmail"], "Your Rateagame.net Password", $message, "From: we*******@rateagame.net");

$output_message = FormatText("Your password was sent to $email");
echo $output_message;
}

} else {

$output_message = FormatText("Email Not Found");
echo $output_message;

}
} else {

$output_message = FormatText("Email is Blank");
echo $output_message;

}

function hex2bin($data) {
$len = strlen($data);
return pack("H" . $len, $data);
}

function FormatText($text) {
$output_text = "<p align='center'><b><font face='Trebuchet MS' size='2' color='#6A6AFF'>$text</font></b></p>";
return $output_text;
}

?>
</body>
</html>

Jul 17 '05 #5

P: n/a

"Matt" <aw***********@aol.com> wrote in message
news:1uvkc.3954$I%1.352887@attbi_s51...
I was wondering if someone could explain why I'm receiving this error. It's like a 404 error but I think it might be something else.

Basically, I have a page where a user inputs his email address. The system is supposed to look up the email address and send the associated password to that email address. It worked up until a few months ago. Note that the
validation works. So, if the user tries to submit a blank text box, it
returns an error. If the email address is not found, it returns an error
"Email not found." But if the email is valid, it just dies. This code
worked a few months ago when I initially wrote it.

Thanks for any help.

<snip>

1) Your page might be getting redirected in the virtual() to somewhere that
doesn't exist - do you have to use it? Is require() or include() appropriate
for you?

2) Replace the page with a simple "print 'Hi.';" to see if the page is being
reached at all (negates code as a problem). If it is, have you tried
error_reporting(E_ALL) and seeing if you get anything else?

Garp
Jul 17 '05 #6

P: n/a
> 1) Your page might be getting redirected in the virtual() to somewhere
that
doesn't exist - do you have to use it? Is require() or include() appropriate for you?


Well, the error was in fact due to the virtual(). The file it includes does
exist, but it was somehow tripping an error related to the decryption of my
password and causing the 'cannot be displayed' error. I checked for spaces
at ends of lines and deleted any blank lines I had as I've read that these
can mess up the header info.

Anyway, I just commented the virtual() line for now and manually copied in
the stuff it was supposed to include (it was just a simple menu bar that I
wanted displayed on all my pages).

At least it works now. But I'm still curious how the virtual() part and the
decryption interact to create an error.

~Matt
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.