Internal   Server   Error(apache   服务器问题

Internal   Server   Error(apache   服务器问题

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, 522362242@qq.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

我在运行由以下代码生成的login.cgi脚本,进行注册产生了以上错误,这是为什么啊?

// Fig. 19.21: login.cpp
// Program to output an XHTML form, verify the
// username and password entered, and add members.
#include <iostream>
using std::cerr;
using std::cin;
using std::cout;
using std::ios;

#include <fstream>
using std::fstream;

#include <string>
using std::string;

#include <cstdlib>
using std::getenv;
using std::atoi;
using std::exit;

void header();
void writeCookie();

int main()
{
  char query[ 1024 ] = "";
  string dataString = "";

  // strings to store username and password
  string userName = "";
  string passWord = "";

  int contentLength = 0;
  bool newMember = false;

  // data was posted
  if ( getenv( "CONTENT_LENGTH" ) )
  {
      // retrieve query string
      contentLength = atoi( getenv( "CONTENT_LENGTH" ) );
      cin.read( query, contentLength );
      dataString = query;

      // find username location
      int userLocation = dataString.find( "user=" ) + 5;
      int endUser = dataString.find( "&" );

      // find password location
      int passwordLocation = dataString.find( "password=" ) + 9;
      int endPassword = dataString.find( "&new" );

      if ( endPassword > 0 ) // new membership requested
      {
        newMember = true;
        passWord = dataString.substr(                       
            passwordLocation, endPassword - passwordLocation );
      } // end if
      else // existing member
        passWord = dataString.substr( passwordLocation );

      userName = dataString.substr(           
        userLocation, endUser - userLocation );
  } // end if

  // no data was retrieved
  if ( dataString == "" )
  {
      header();
      cout < < " <p>Please login. </p>";

      // output login form
      cout < < " <form method = \"post\" action = \"/cgi-bin/login.cgi\">"
        < < " <p>User Name: <input type = \"text\" name = \"user\"/> <br/>"
        < < "Password: <input type = \"password\" name = \"password\"/>"
        < < " <br/>New? <input type = \"checkbox\" name = \"new\""
        < < " value = \"1\"/> </p>"
        < < " <input type = \"submit\" value = \"login\"/> </form>";
  } // end if
  else // process entered data
  {
      string fileUsername = "";
      string filePassword = "";
      bool userFound = false;

      // open user data file for reading and writing       
      fstream userData( "userdata.txt", ios::in | ios::out);

      if ( !userData ) // could not open file
      {
        cerr < < "Could not open database.";
        exit( 1 );
      } // end if

      // add new member
      if ( newMember )
      {
        // read username and password from file
        while ( !userFound && userData >> fileUsername >> filePassword )
        {
            if ( userName == fileUsername ) // name is already taken
              userFound = true;                                   
        } // end while

        if ( userFound ) // user name is taken
        {
            header();
            cout < < " <p>This name has already been taken. </p>" 
              < < " <a href=\"/cgi-bin/login.cgi\">Try Again </a>";
        } // end if
        else // process data
        {
            writeCookie(); // write cookie
            header();

            // write user data to file                               
            userData.clear(); // clear eof, allow write at end of file
            userData < < "\n" < < userName < < "\n" < < passWord;       

            cout < < " <p>Your information has been processed."           
              < < " <a href=\"/cgi-bin/shop.cgi\">Start Shopping </a> </p>";
        } // end else
      } // end if
      else // search for password if entered
      {
        bool authenticated = false;

        // read in user data
        while ( !userFound && userData >> fileUsername >> filePassword )
        {
            // username was found
            if ( userName == fileUsername )
            {
              userFound = true;

              // determine whether password is correct   
              // and assign bool result to authenticated 
              authenticated = ( passWord == filePassword );
            } // end if
        } // end while

        // user is authenticated
        if ( authenticated )
        {
            writeCookie();
            header();

            cout < < " <p>Thank you for returning, " < < userName < < "! </p>"
              < < " <a href=\"/cgi-bin/shop.cgi\">Start Shopping </a>";   
        } // end if
        else // user not authenticated
        {
            header();

            if ( userFound ) // password is incorrect
              cout < < " <p>You have entered an incorrect password. "   
                  < < "Please try again. </p>"                           
                  < < " <a href=\"/cgi-bin/login.cgi\">Back to login </a>";
            else // user is not registered
              cout < < " <p>You are not a registered user. </p>"   
                  < < " <a href=\"/cgi-bin/login.cgi\">Register </a>";
        } // end else
      } // end else
  } // end else

  cout < < " </body>\n </html>\n";
  return 0;
} // end main

// function to output header
void header()
{
    cout < < "Content-Type: text/html\n\n"; // output header

    // output XML declaration and DOCTYPE
    cout < < " <?xml version = \"1.0\"?>"
      < < " <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
      < < "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">";

    // output html element and some of its contents
    cout < < " <html xmlns = \"http://www.w3.org/1999/xhtml\">"
      < < " <head> <title>Login Page </title> </head> <body>";
} // end function header

// function to write cookie data
void writeCookie()
{
  string expires = "Friday, 14-MAY-10 16:00:00 GMT";
  cout < < "Set-Cookie: CART=; expires=" < < expires < < "; path=\n";
} // end function writeCookie

以下是另外的代码
// Fig. 19.22: shop.cpp
// Program to display available books.
#include <iostream>
using std::cerr;
using std::cout;
using std::ios;

#include <fstream>
using std::ifstream;

#include <string>
using std::string;

#include <cstdlib>
using std::exit;

void header();

int main()
{
  // variables to store product information
  char book[ 50 ] = "";
  char year[ 50 ] = "";
  char isbn[ 50 ] = "";
  char price[ 50 ] = "";

  string bookString = "";
  string yearString = "";
  string isbnString = "";
  string priceString = "";
 
  ifstream userData( "catalog.txt", ios::in ); // open file for input

  // file could not be opened
  if ( !userData )
  {
      cerr < < "Could not open database.";
      exit( 1 );
  } // end if
 
  header(); // output header

  // output available books                               
  cout < < " <center> <br/>Books available for sale <br/> <br/>"
      < < " <table border = \"1\" cellpadding = \"7\" >";   

  // file is open
  while ( userData )
  {
      // retrieve data from file
      userData.getline( book, 50 );
      bookString = book;
 
      userData.getline( year, 50 );
      yearString = year;

      userData.getline( isbn, 50 );
      isbnString = isbn;

      userData.getline( price, 50 );
      priceString = price;

      cout < < " <tr> <td>" < < bookString < < " </td> <td>" < < yearString
        < < " </td> <td>" < < isbnString < < " </td> <td>" < < priceString
        < < " </td>";

      // file is still open after reads
      if ( userData )
      {
        // output form with buy button                             
        cout < < " <td> <form method=\"post\" "                       
            < < "action=\"/cgi-bin/viewcart.cgi\">"                 
            < < " <input type=\"hidden\" name=\"add\" value=\"true\"/>"
            < < " <input type=\"hidden\" name=\"isbn\" value=\""     
            < < isbnString < < "\"/>" < < " <input type=\"submit\" "   
            < < "value=\"Add to Cart\"/>\n </form> </td>\n";           
      } // end if
 
      cout < < " </tr>\n";
  } // end while
 
    cout < < " </table> </center> <br/>"
      < < " <a href=\"/cgi-bin/checkout.cgi\">Check Out </a>"
      < < " </body> </html>";
  return 0;
} // end main

// function to output header information
void header()
{
  cout < < "Content-Type: text/html\n\n"; // output header
 
  // output XML declaration and DOCTYPE
  cout < < " <?xml version = \"1.0\"?>"
      < < " <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
      < < "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">";
 
  // output html element and some of its contents
    cout < < " <html xmlns = \"http://www.w3.org/1999/xhtml\">"
      < < " <head> <title>Shop Page </title> </head> <body>";
} // end function header
Visual Basic .NET How to Program
2002
0-13-029363-6
$50.00
C# How to Program
2002
0-13-062221-4
$49.95
C How to Program 4e
2004
0-13-142644-3
$88.00
Java How to Program 6e
2005
0-13-148398-6
$88.00

以上是catalog.txt文本