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

  • Home
  • SEARCH
  • 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 67377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:15:01+00:00 2026-05-10T19:15:01+00:00

Here is a stripped down version of what I use to authenticate users, it

  • 0

Here is a stripped down version of what I use to authenticate users, it works fine on my PHP v5.0.2/MySQL 4.0.21 server, but fails on my PHP v5.1.6/MySQL v5.0.45 server.

In the code below, should I be aware of anything that might not be supported by the newer version of PHP & MySQL? Global variables have been enabled.

<?php   if(!isset($HTTP_POST_VARS['username'])&&!isset($HTTP_POST_VARS['password']))   {     //Visitor needs to enter a name and password ?>     <h1>Please Log In</h1>     This page is secret.     <form method='post' action='<?php echo $PHP_SELF;?>'>     <table border='1'>     <tr>       <th> Username </th>       <td> <input type='text' name='username'> </td>     </tr>     <tr>       <th> Password </th>       <td> <input type='password' name='password'> </td>     </tr>     <tr>       <td colspan='2' align='center'>         <input type='submit' value='Log In'>       </td>     </tr>     </table>     </form> <?php   }   else   {     // connect to mysql     include('../cgi-bin/db.php');      $username = $HTTP_POST_VARS['username'];     $password = md5($HTTP_POST_VARS['password']);      if(!$db)     {       echo 'Cannot connect to database.';       exit;     }     // select the appropriate database     $mysql = mysql_select_db('quickwebcms');     if(!$mysql)     {       echo 'Cannot select database.';       exit;     }      // query the database to see if there is a record which matches     $query = 'select count(*) from auth where               username = '$username' and               password = '$password'';      $result = mysql_query( $query );     if(!$result)     {       echo 'Cannot run query.';       exit;     }      $count = mysql_result( $result, 0, 0 );      if ( $count > 0 )     {       // visitor's name and password combination are correct       echo '<h1>Here it is!</h1>';       echo 'I bet you are glad you can see this secret page.';     }     else     {       // visitor's name and password combination are not correct       echo '<h1>Go Away!</h1>';       echo 'You are not authorized to view this resource.';     }   } ?> 
  • 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. 2026-05-10T19:15:02+00:00Added an answer on May 10, 2026 at 7:15 pm

    I’m guessing it might be because of $HTTP_POST_VARS. Try replacing that with $_POST. If it still doesn’t work, try putting the following snippet right after <?php:

     // Enable displaying errors error_reporting(E_ALL); ini_set('display_errors', '1'); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer To sanitize strings I would HTML encode all output, that… May 11, 2026 at 12:19 pm
  • added an answer Basically, create a column of type INTEGER PRIMARY KEY or… May 11, 2026 at 12:19 pm
  • added an answer Try the find function. Here is the example from the… May 11, 2026 at 12:19 pm

Related Questions

Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is a problem I've struggled with ever since I first started learning object-oriented
Lets say I have something called Stuff in my database, with a property called
My users are presented a basically a stripped down version of a spreadsheet. There

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.