PDA

View Full Version : Confarmation Problem


0810
08-23-2002, 02:33 AM
Hi all

Thank you for helping me all the time.

I fixed like this

my php editor says "Parse error: parse error, unexpected '{' in c:\itohideo\unko.php on line 15"

I can't find my mistake. Please help thanks

Here is code

<?php
$PHP_AUTH_USER=$_POST["PHP_AUTH_USER"];
$PHP_AUTH_PW=$_POST["PHP_AUTH_PW"];

if(!isset($PHP_AUTH_USER))
{
Header("WWW-Authenticate: Basic realm=\"My Sample Site\"");
Header("HTTP/1.0 401 Authorized Request");

$errormode=$_POST["errormode"];
$errormode = "Cancel";
}

else($PHP_AUTH_USER != "itohideo" || $PHP_AUTH_PW != "1234" )
{
$errormode=$_POST["errrormode"];
$errormode = "Error";

}

?>
<html>
<head>
</head>
<body>
<?php
if($errrormode == "Cancel")
{
print("Conformation is Canceled<br>\n");
exit;
}
elseif($errormode == "Error")
{
print("Wrong username and password");
exit;
}


?>
</body>
</html>

stuntboy
08-23-2002, 02:43 AM
this:
else($PHP_AUTH_USER != "itohideo" || $PHP_AUTH_PW != "1234" )


should either be:

else if($PHP_AUTH_USER != "itohideo" || $PHP_AUTH_PW != "1234" )

or just else

0810
08-23-2002, 02:54 AM
I added if

but I got this messages


Notice: Undefined index: PHP_AUTH_USER in c:\itohideo\unko.php on line 2

Notice: Undefined index: PHP_AUTH_PW in c:\itohideo\unko.php on line 3

Warning: Cannot add header information - headers already sent by (output started at c:\itohideo\unko.php:2) in c:\itohideo\unko.php on line 7

Warning: Cannot add header information - headers already sent by (output started at c:\itohideo\unko.php:2) in c:\itohideo\unko.php on line 8

Notice: Undefined index: errormode in c:\itohideo\unko.php on line 10

Notice: Undefined variable: errrormode in c:\itohideo\unko.php on line 27


it worse

but thanks

stuntboy
08-23-2002, 03:29 AM
Is there any whitespace above the first php tag? The headers are being sent and once sent you cant send more that is the big problem. Remove any whitespace.

the next problem I see is:

$PHP_AUTH_USER=$_POST["PHP_AUTH_USER"];
$PHP_AUTH_PW=$_POST["PHP_AUTH_PW"];

if(!isset($PHP_AUTH_USER))

the first bit is $_POST["PHP_AUTH_USER"]; probably should be
$_SERVER["PHP_AUTH_USER"];

the other problem is if(!isset($PHP_AUTH_USER)) will never be false. because you are setting $PHP_AUTH_USER and $PHP_AUTH_PW even if you are setting them empty they are still set none the less try empty instead of isset http://www.php.net/manual/en/function.empty.php

I think I may have hit on everything not sure post back if there are more problems

0810
08-23-2002, 05:00 AM
I changed your way.

but I still get this messages


Notice: Undefined index: PHP_AUTH_USER in c:\itohideo\unko.php on line 2

Notice: Undefined index: PHP_AUTH_PW in c:\itohideo\unko.php on line 3

Warning: Cannot add header information - headers already sent by (output started at c:\itohideo\unko.php:2) in c:\itohideo\unko.php on line 7

Warning: Cannot add header information - headers already sent by (output started at c:\itohideo\unko.php:2) in c:\itohideo\unko.php on line 8

Notice: Undefined index: errormode in c:\itohideo\unko.php on line 10

Notice: Undefined variable: errrormode in c:\itohideo\unko.php on line 27


stays like same

anyidea

Thanks help