Sorry! I'm still struggling with trying to display a 'Your password failed' message nicely, preferably in a table.
Here's the code that works.
<?php
if (!isset($PHP_AUTH_USER)) {
header('WWW-Authenticate: Basic realm= "My Private Stuff"');
header ('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
else if (isset($PHP_AUTH_USER)) {
$db = mysql_connect("www.irishireland.net", "ambitire","27blink9");
mysql_select_db("ambitire",$db);
$sql = "SELECT * FROM RETHHOTEL WHERE USERNAME='$PHP_AUTH_USER' and PASSWORD='$PHP_AUTH_PW'";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
if (!$rows || $rows < 1) {
echo "We're very sorry, but that user name and password are incorrect";
exit;
}
else
{
$id = mysql_result($result,0,"id");
?>
<head>
<title>Untitled Document</title>
etc. etc.
What I want to do is display the echoed error message in a more formatted way, such as a table, but it gets very upset about the header if I try to do that
I've tried:
if (!$rows || $rows < 1) {
$message = "We're very sorry, but that user name
and password are incorrect. <br>\n<br>\nPlease either enter a new hotel <br>\nor <br>\ncontact
Reth to obtain your correct Username and Password<br>\n<br>\nIf you wish to try again, please open a new browser <br>\n<br>\nsince your browser may remember the username and password you just entered";
echo "<head><title>Titles titles titles! /title></head><body>";
?>
<table width="100%" border="1">
<tr>
<td>
<?php
$message;
?>
</td>
</tr>
</table>
<?php
exit;
}
else
{
$id = mysql_result($result,0,"id");
?>
<head>
<title>Untitled Document</title>
etc. etc.
but it doesn't work
I've also tried echoing the table, but no luck there either.
Is there any way to do this?
Thanks everyone - and for your help on this earlier.
Regards
Elizabeth