No PHP Error. Just "Page Cannot be displayed"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    No PHP Error. Just "Page Cannot be displayed"

    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>Rateagam e.net: Forgot Password</title>
    <link rel=stylesheet type=text/css href=/rateagame.css>
    </head>
    <body bgcolor="#00000 0" topmargin="0" leftmargin="0" marginheight="0 "
    marginwidth="0" >
    <p align="center">
    <?

    virtual("includ es/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_q uery($query);

    $returned=mysql _num_rows($resu lt);

    if ($returned>0) {

    while($row=mysq l_fetch_array($ result)) {
    $data=$row["UserPasswo rd"];
    $td = mcrypt_module_o pen (MCRYPT_TripleD ES, "",
    MCRYPT_MODE_ECB ,"");
    $iv = mcrypt_create_i v (mcrypt_enc_get _iv_size ($td), MCRYPT_RAND);
    $dectext = trim(mcrypt_ecb
    (MCRYPT_TripleD ES,(Keysize),he x2bin($data), MCRYPT_DECRYPT, $iv));

    $user_name = $row["UserName"];

    $message = "Hello $user_name!\n\n Your password is:
    $dectext\n\nReg ards,\n\nThe Rateagame.net Team\nwebmaster @rateagame.net" ;
    mail($row["UserEmail"], "Your Rateagame.net Password", $message, "From:
    webmaster@ratea game.net");

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

    } else {

    $output_message = FormatText("Ema il Not Found");
    echo $output_message ;

    }
    } else {

    $output_message = FormatText("Ema il is Blank");
    echo $output_message ;

    }

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

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

    ?>
    </body>
    </html>


  • Daniel Tryba

    #2
    Re: No PHP Error. Just &quot;Page Cannot be displayed&quot;

    Matt <awpilotnospam@ aol.com> wrote:[color=blue]
    > 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.[/color]

    [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

    Comment

    • Matt

      #3
      Re: No PHP Error. Just &quot;Page Cannot be displayed&quot;

      I had that turned off, yes, but still received the "page cannot be
      displayed" error.

      Matt
      "Daniel Tryba" <news_comp.lang .php@canopus.nl > wrote in message
      news:c6u150$ssc $2@news.tue.nl. ..[color=blue]
      > Matt <awpilotnospam@ aol.com> wrote:[color=green]
      > > I was wondering if someone could explain why I'm receiving this error.[/color][/color]
      It's[color=blue][color=green]
      > > like a 404 error but I think it might be something else.[/color]
      >
      > [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
      >[/color]


      Comment

      • Phil Powell

        #4
        Re: No PHP Error. Just &quot;Page Cannot be displayed&quot;

        "Matt" <awpilotnospam@ aol.com> wrote in message news:<1uvkc.395 4$I%1.352887@at tbi_s51>...[color=blue]
        > 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>Rateagam e.net: Forgot Password</title>
        > <link rel=stylesheet type=text/css href=/rateagame.css>
        > </head>
        > <body bgcolor="#00000 0" topmargin="0" leftmargin="0" marginheight="0 "
        > marginwidth="0" >
        > <p align="center">
        > <?
        >
        > virtual("includ es/header.inc");[/color]

        [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("inclu des/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

        [color=blue]
        >
        > $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_q uery($query);
        >
        > $returned=mysql _num_rows($resu lt);
        >
        > if ($returned>0) {
        >
        > while($row=mysq l_fetch_array($ result)) {
        > $data=$row["UserPasswo rd"];
        > $td = mcrypt_module_o pen (MCRYPT_TripleD ES, "",
        > MCRYPT_MODE_ECB ,"");
        > $iv = mcrypt_create_i v (mcrypt_enc_get _iv_size ($td), MCRYPT_RAND);
        > $dectext = trim(mcrypt_ecb
        > (MCRYPT_TripleD ES,(Keysize),he x2bin($data), MCRYPT_DECRYPT, $iv));
        >
        > $user_name = $row["UserName"];
        >
        > $message = "Hello $user_name!\n\n Your password is:
        > $dectext\n\nReg ards,\n\nThe Rateagame.net Team\nwebmaster @rateagame.net" ;
        > mail($row["UserEmail"], "Your Rateagame.net Password", $message, "From:
        > webmaster@ratea game.net");
        >
        > $output_message = FormatText("You r password was sent to $email");
        > echo $output_message ;
        > }
        >
        > } else {
        >
        > $output_message = FormatText("Ema il Not Found");
        > echo $output_message ;
        >
        > }
        > } else {
        >
        > $output_message = FormatText("Ema il is Blank");
        > echo $output_message ;
        >
        > }
        >
        > function hex2bin($data) {
        > $len = strlen($data);
        > return pack("H" . $len, $data);
        > }
        >
        > function FormatText($tex t) {
        > $output_text = "<p align='center'> <b><font face='Trebuchet MS' size='2'
        > color='#6A6AFF' >$text</font></b></p>";
        > return $output_text;
        > }
        >
        > ?>
        > </body>
        > </html>[/color]

        Comment

        • Matt

          #5
          Re: No PHP Error. Just &quot;Page Cannot be displayed&quot;

          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.ph p4 on
          line 0

          Matt
          "Phil Powell" <soazine@erols. com> wrote in message
          news:1cdca2a7.0 404301519.50a80 8b0@posting.goo gle.com...[color=blue]
          > "Matt" <awpilotnospam@ aol.com> wrote in message[/color]
          news:<1uvkc.395 4$I%1.352887@at tbi_s51>...[color=blue][color=green]
          > > I was wondering if someone could explain why I'm receiving this error.[/color][/color]
          It's[color=blue][color=green]
          > > 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[/color][/color]
          system[color=blue][color=green]
          > > is supposed to look up the email address and send the associated[/color][/color]
          password to[color=blue][color=green]
          > > 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[/color][/color]
          error[color=blue][color=green]
          > > "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>Rateagam e.net: Forgot Password</title>
          > > <link rel=stylesheet type=text/css href=/rateagame.css>
          > > </head>
          > > <body bgcolor="#00000 0" topmargin="0" leftmargin="0" marginheight="0 "
          > > marginwidth="0" >
          > > <p align="center">
          > > <?
          > >
          > > virtual("includ es/header.inc");[/color]
          >
          > [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("inclu des/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
          >
          >[color=green]
          > >
          > > $email=$_POST['strEmail'];
          > >
          > > if ($email != "") {
          > >
          > > $dbh = mysql_pconnect( "*","*","*" );
          > >
          > > mysql_select_db ("mja674s",$dbh );
          > >
          > > $query="SELECT UserName, UserPassword, UserEmail FROM Users Where[/color][/color]
          UserEmail[color=blue][color=green]
          > > = '$email'";
          > >
          > > $result=mysql_q uery($query);
          > >
          > > $returned=mysql _num_rows($resu lt);
          > >
          > > if ($returned>0) {
          > >
          > > while($row=mysq l_fetch_array($ result)) {
          > > $data=$row["UserPasswo rd"];
          > > $td = mcrypt_module_o pen (MCRYPT_TripleD ES, "",
          > > MCRYPT_MODE_ECB ,"");
          > > $iv = mcrypt_create_i v (mcrypt_enc_get _iv_size ($td),[/color][/color]
          MCRYPT_RAND);[color=blue][color=green]
          > > $dectext = trim(mcrypt_ecb
          > > (MCRYPT_TripleD ES,(Keysize),he x2bin($data), MCRYPT_DECRYPT, $iv));
          > >
          > > $user_name = $row["UserName"];
          > >
          > > $message = "Hello $user_name!\n\n Your password is:
          > > $dectext\n\nReg ards,\n\nThe Rateagame.net[/color][/color]
          Team\nwebmaster @rateagame.net" ;[color=blue][color=green]
          > > mail($row["UserEmail"], "Your Rateagame.net Password", $message,[/color][/color]
          "From:[color=blue][color=green]
          > > webmaster@ratea game.net");
          > >
          > > $output_message = FormatText("You r password was sent to $email");
          > > echo $output_message ;
          > > }
          > >
          > > } else {
          > >
          > > $output_message = FormatText("Ema il Not Found");
          > > echo $output_message ;
          > >
          > > }
          > > } else {
          > >
          > > $output_message = FormatText("Ema il is Blank");
          > > echo $output_message ;
          > >
          > > }
          > >
          > > function hex2bin($data) {
          > > $len = strlen($data);
          > > return pack("H" . $len, $data);
          > > }
          > >
          > > function FormatText($tex t) {
          > > $output_text = "<p align='center'> <b><font face='Trebuchet MS'[/color][/color]
          size='2'[color=blue][color=green]
          > > color='#6A6AFF' >$text</font></b></p>";
          > > return $output_text;
          > > }
          > >
          > > ?>
          > > </body>
          > > </html>[/color][/color]


          Comment

          • Garp

            #6
            Re: No PHP Error. Just &quot;Page Cannot be displayed&quot;


            "Matt" <awpilotnospam@ aol.com> wrote in message
            news:1uvkc.3954 $I%1.352887@att bi_s51...[color=blue]
            > I was wondering if someone could explain why I'm receiving this error.[/color]
            It's[color=blue]
            > 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[/color]
            system[color=blue]
            > is supposed to look up the email address and send the associated password[/color]
            to[color=blue]
            > 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.
            >[/color]
            <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


            Comment

            • Matt

              #7
              Re: No PHP Error. Just &quot;Page Cannot be displayed&quot;

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

              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


              Comment

              Working...