My Log-In page isn't working like it does in localhost. I refactored the PHP page and relevant scripts but nothing worked until I stumbled on Apache-PHP-module configuration issue in my searches.
I've read and tried suggestions at:
- http://php.net/manual/en/features.http-auth.php
- Why are $_SERVER["PHP_AUTH_USER"] and $_SERVER["PHP_AUTH_PW"] not set?
- PHP_AUTH_USER not set?
... but none of them worked for me. Maybe, my problem's unique. Maybe not.
So far, .htaccess has:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteEngine On
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{HTTP_HOST} ^genieverse.com [NC]
RewriteRule ^(.*)$ http://www.my_site.com/$1 [L,R=301]
While log_in.php has:
//Get custom error function script
require_once('Server_Includes/scripts/common_scripts/feature_error_message.php');
if(preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches))
{ list($the_name, $the_password) = explode(':', base64_decode($matches[1]));
$_SERVER['PHP_AUTH_USER'] = strip_tags($the_name);
$_SERVER['PHP_AUTH_PW'] = strip_tags($the_password); }
//Filter incoming values
$username = (isset($_POST["username"])) ? trim($_POST["username"]) : "Username";
$password = (isset($_POST["password"])) ? trim($_POST["password"]) : "Password";
..... rest continues on to the log_in page form.
Everytime i enter Username and Password then click Submit, Log in page reloads requesting same. It's like they are never sent.
What do I need to do exactly?
PS: Web server is shared hosting, Apache 2.2.31, PHP 5.4.45