Full-Demon Posted August 2, 2007 Share Posted August 2, 2007 Hi, My homeserver has php5 but my webserver php 4.4.2, I'm getting some errors when I try to run a script in php4. 1. WWW-Authenticate doesn't work. It keeps asking me my UN and PW while I filled in the correct UN and PW. Script: if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Administration area"'); header("HTTP/1.0 401 Unauthorized"); exit; } elseif (($_SERVER['PHP_AUTH_USER']==$ini['c_admin_username']) && ($_SERVER['PHP_AUTH_PW']==$ini['c_admin_password'])) { [rest of code here] Like $_SERVER['PHP_AUTH_USER'] is not set or something, wtf? 2. My error handling is redirecting me to the error page (with header(). How ever, to find out what is wrong, I add "echo 'some nonsense';" on top of the page. That way a header is already send and he will display the errors instead of redirecting me. This works in php5, but php4 just keeps redirecting me even if php already sended a header...how can this ever be possible??? Does anyone know the answer? I'm getting really frustated with the fact it DOES work in php5 but not in php4. Thanks for any advise or reply, FD Quote Link to comment https://forums.phpfreaks.com/topic/63007-php-5-to-php-4-errors/ Share on other sites More sharing options...
yarnold Posted August 2, 2007 Share Posted August 2, 2007 Try using if(!array_key_exists('PHP_AUTH_USER', $_SERVER)) { // Your code here } Quote Link to comment https://forums.phpfreaks.com/topic/63007-php-5-to-php-4-errors/#findComment-313793 Share on other sites More sharing options...
Full-Demon Posted August 2, 2007 Author Share Posted August 2, 2007 No it doesn't work. I used print_r(); to display the complete array of $_SERVER and $HTTP_SERVER_VARS. Both didn't contain any information about the authentication. Can authentication be set off in php.ini by the server administrator? Perhaps thats the problem? Same for the header(); problem, is that something the server admin could have set on in php.ini? Thanks anyway, FD Quote Link to comment https://forums.phpfreaks.com/topic/63007-php-5-to-php-4-errors/#findComment-313801 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.