Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:56:01+00:00 2026-05-30T00:56:01+00:00

The code blow was used for authenticatin for a page (it is snippet of

  • 0

The code blow was used for authenticatin for a page (it is snippet of whole page but the main idea is here):

 if (!isset($_SERVER['PHP_AUTH_USER'])) {
        header("WWW-Authenticate: Basic realm=\"MX Administration\"");
        header("HTTP/1.0 401 Unauthorized");
        exit;
  } 
  else {
        session_start();
        if( $_SERVER['PHP_AUTH_USER'] == $login && md5($_SERVER['PHP_AUTH_PW'] ) == $password ){

                if( $_SESSION['adm'] == '' && empty($_POST) ){
                    header("Location: whmcs.php");
                    exit;
                }
                elseif( $_SESSION['adm'] == '' && !empty($_POST) ){

                    if(  $_POST['login'] == $login_in &&  md5($_POST['password']) == $password_in ){
                        $_SESSION['adm']="OK";  
                    }
                    else{
                        header("Location: whmcs.php?do=message");
                        exit;
                    }
                 }
                 else{
                    $_SESSION['adm']="OK";
                 }

        }
        else{
            header("WWW-Authenticate: Basic realm=\"MX Administration\"");
            header("HTTP/1.0 401 Unauthorized");
            echo ":)\n";
            exit;
        }
  }

?>

Now when I have transfered this code to another server, it does not authenticate, it always asks for username, password. I guess it is because of php version, php config. What you think what may br the reason. (I am sure that I am writing the correct username and password.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:56:03+00:00Added an answer on May 30, 2026 at 12:56 am

    Most likely the reason is CGI API used to run PHP scripts.
    You have to either change API to mod_php or change hosting or change HTTP auth to sessions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the blow code work fine on IE, but doesn't work on firefox, why? It's
I am using blow code for join in nhibernate, which is working fine. But
i saw a example for login form same blow code class Form_Login extends Zend_Form
code snippet: //byte[] myByteArray = byte array from database (database BLOB) myByteArray = (byte[])
Here's the relevant code: public static String[] runTeams (String CPUcolor) { boolean z =
I have the code blow for tabbing through 2 fields and it has no
I have the following code which seems to blow up if the column in
I've created this code blow that works and does what I want it to
I'm trying to build an application where the themouse cursor is used to blow
as title said,the code blow gives error with g++: error: expected specifier-qualifier-list before ‘logType’

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.