Results 1 to 5 of 5
  1. #1

    Internal Server Error

    Hello,

    Having more troubles

    Why does this login script return an internal server error on submit?

    Code:

    PHP Code:
    <?

    require("../includes/common.php");

    if(
    session_is_registered("username")){
        
    header("Location: loggedin.php");
    }

    if(!
    $Submit){
        
    dosimpleheader();
    ?>
    <form method="post" action="login.php?Submit=Go" name="login">
      <b>Please enter your administrator login and password.</b><br />
      Username:
      <input type="text" name="username" />
      <br />
      Password:
      <input type="password" name="password" />
      <br />
      <input type="submit" name="Submit" value="Go" />
    </form>
    <?
        dosimplefooter
    ();
    }
    if(
    $Submit=="Go"){
        
    $result mysql_query("SELECT * FROM pp_admin WHERE password = '$password' && username = '$username'");
        
    $num_rows mysql_num_rows($result);
        if(
    $num_rows!=1){
            
    dosimpleheader();
            echo(
    "Incorrect username or password.  <a href=\"login.php\">Try again</a>.");
            
    dosimplefooter();
        } elseif(
    $num_rows==1){
            
    session_register("username");
            
    session_register("password");
            
    header("Location: loggedin.php");
        }
    }

    // EoF =======================
    ?>
    - Nick Mahon
    Vereor.com
    Professional Web Development

  2. #2
    The error I get in apache is "Premature end of script headers"
    - Nick Mahon
    Vereor.com
    Professional Web Development

  3. #3
    Join Date
    May 2001
    Location
    HK
    Posts
    3,076

    Smile

    something wrong with your apache...

    for php, when you get an error, it should show something like this for the output

    Error line 3: blah blah error


    for perl, you will get internal server error.

  4. #4
    Join Date
    Apr 2001
    Location
    Depok, Indonesia
    Posts
    988
    Probably your PHP is installed as CGI mode. Make sure your PHP script is chmoded +x.

    Try executing your PHP script from shell. If that work, try looking in your suexec log if you are using it.

  5. #5
    Yeah, I'm just working on it online now, so it's working.

    The sessions threw off PHP on Apache or something.

    Odd.
    - Nick Mahon
    Vereor.com
    Professional Web Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •