I have an index.html on my server. This is the first page of my site. At the moment it contains two <a> tags which basically a user selects to start different applications

<!--Index.html-->
<center><p style=font-size:200%><A href="javascript: void(window.open('login.php?app=partscatalogue','appwindow','location=0,scrollbars=0,menubar=0,toolbar=0,status=0,resizable=1,directories=0'))">Enter The Auto-Trail Parts Catalogue</a>
<center><p style=font-size:175%>or</p></center>
<center><p style=font-size:200%><A href="javascript: void(window.open('login.php?app=buyvehicle','appwindow','location=0,scrollbars=auto,menubar=0,toolbar=0,status=0,resizable=1,directories=0'))">Order A Mobile Home</a>

The javascript for both apps open a 2nd window (attributes dont matter at this point in time) with the login page. This page is the same for either app. The difference is in the URL (login.php?app=buyvehicle or login.php?app=partscatalogue).

This is login.php

<?php
$app = $_GET['app'];
include("auth.php");

?>
  <head>
  <title>Auto-Trail VR LTD - LOGGING IN</title>
  <link rel='stylesheet' type='text/css' href='css\theme.css'>
  </head>
<?

echo "<br><br><br><br><br><br><center><p style=font-size:200%><b><i>Welcome ".$_GLOBALS["custname"]."<br><br>Directing you to the main page, please wait!</i></b></p></center>";
echo "<META HTTP-EQUIV=refresh content=\"3; URL=".$app."\main.php\">";

?>

the authorisation and form is in the 'required script' auth.php as follows

<?php
// start session
session_start();
$sessionid = session_id();
session_register(sessionid);
// convert username and password from _POST or _SESSION 
if($_POST["username"]) 
{ 
  $username=$_POST["username"]; 
  $password=$_POST["password"];   
} elseif($_SESSION["username"]) { $username=$_SESSION["username"]; $password=$_SESSION["password"]; } // start and register session variables session_register("username"); session_register("password"); // connect to database include("connect.php.inc"); // query for a user/pass match $result=mysql_query("select customer.customerID, customer.name, customer.username, passes.password from customer, passes where customer.username='" . $username . "' and passes.password='" . $password . "'"); while ($record = mysql_fetch_row($result)){ $customerID = $record[0]; session_register(customerID); $customername = $record[1]; $_GLOBALS["custname"] = $customername; session_register(customername); } // retrieve number of rows resulted $num=mysql_num_rows($result); // print login form and exit if failed. if($num < 1){ session_destroy(); ?> <head> <link rel='stylesheet' type='text/css' href='css\theme.css'> <title>Auto-Trail VR LTD - AUTHORISATION REQUIRED</title> </head> <? echo "<body>"; echo "<br><br><br>"; echo "<form method=POST action=login.php> <center><p style=font-size:20px><b><i>You are not authenticated, please login below.</i></b></p></center> <hr style=color:rgb(57,47,107) <p><center><img src=autotrail.jpg width=886 height=277></center></p> <hr style=color:rgb(57,47,107)> <center><p style=font-size:16px><b><i>Username:</i></b> <input type=text name=username style=width:150px></p></center> <center><p style=font-size:16px><b><i>Password:</i></b> <input type=password name=password style=width:150px></p></center> <center><p style=font-size:16px><input type=submit value=Login></center></p> <center><p style=font-size:14px><a href='' onclick='javascript: void(window.close()); return false;'>Close Window</a></p></center> <center><p style=font-size:16px><i>Best viewed in 1024 x 768 resolution.</i></p></center> </form>"; echo "</body>"; exit; } ?>

The idea is that the application root directory will be the name of the app passed in the URL

Now for the problem

I f (for example) I chose to select the Parts Catalogue application.

login.php will be called as login.php?app=partscatalogue.

When i have completed the login process (put in password etc) the login process completes and the page forwards to the next page (if the login was incorrect; the login pge would be redisplayed) however this is where i get the Internal Server Error:

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

If i click back 2 times and refresh...the application loads up as it should do.

This happens every time i want to load the pages and scripts so i figure that there is something wrong.

Is a config error in my php.ini?
Does anyboduy have a clue??

I am using Windows 2000, Apache 1.3.23 webserver and Php 4.1.1

Thanks in advance

    I have been looking at my apache error logs and have found this error occuring all the time.

    [Tue Mar 29 12:17:28 2005] [error] [client 127.0.0.1] Premature end of script headers: c:/apache/php/php.exe

    I hope this helps further in any answers

    thanx again

      Originally posted by edwardp
      [Tue Mar 29 12:17:28 2005] [error] [client 127.0.0.1] Premature end of script headers: c:/apache/php/php.exe

      This I find is most likely to happen when PHP is asked to process a script that doesn't exist. PHP, given nothing to do, does nothing and Apache is left saying "Hey, where'dhego?"

        Write a Reply...