function Admin_Login() {
$results = array();
$results['pageTitle'] = "Admin Login - Admin";
$results['pageHeading'] = "Admin Login";
$results['pageHeading_p'] = "Login must be provided in order to gain administrative access.";
if (isset($_POST['Admin_Login'])) {
// User Has Posted The Login Form: Attempt To Log The User In
if ($_POST['username'] == ADMIN_USERNAME && $_POST['password'] == ADMIN_PASSWORD) {
// Admin Logged In - Create Session
$_SESSION['username'] = ADMIN_USERNAME;
// UseT Bad Sessions & Resume To Admin
if (isset($_SESSION['suspect_user'])) { unset($_SESSION['suspect_user']);unset($_SESSION['login_count']);}header("Location: Admin.php");
} elseif ($_POST['username'] != ADMIN_USERNAME && $_POST['password'] != ADMIN_PASSWORD) {
// User Triggered Session Bad User
$_SESSION['suspect_user'] = 'Suspect User Bad';
$results['errorMessage'] = "Incorrect username & password. Please attempt again using the correct username & password.";
require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
} elseif ($_POST['username'] != ADMIN_USERNAME || $_POST['password'] != ADMIN_PASSWORD) {
// User Triggered Session Possible User	
$_SESSION['suspect_user'] = 'Suspect User Good';
$results['errorMessage'] = "Incorrect username/password. Please attempt login again.";
require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
} if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] = 'Suspect User Bad') {
// Login failed Under Session Bad User - Block The User
$HTAccess_file = fopen(ROOT."/.htaccess", "a+");
$htaccess_log =PHP_EOL."<Files Admin.php>".PHP_EOL."Order Allow,Deny".PHP_EOL."Deny from ".$_SERVER['REMOTE_ADDR'].PHP_EOL."</Files>".PHP_EOL;fwrite($HTAccess_file, $htaccess_log);fclose($HTAccess_file);
} if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] = 'Suspect User Good') {
// Login failed Under Possible User - Show Captcha
$results['errorMessage'] = "Use Captcha!!!!!!!.";
} else { $_SESSION['login_count'] ++;}
} else {   // User Not Logged In: Display Admin Login Form - Default Action On Start
require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");}}

I'm going crossed eye over here lol! It's been awhile since I've been in my dev workspace & I'm feeling lost. Anyways thanks in advance for any help on this thread.

    This is the problem

    if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] = 'Suspect User Good') {
    [COLOR="#008000"]// Login failed Under Possible User - Show Captcha[/COLOR]
    $results['errorMessage'] = "Use Captcha!!!!!!!.";

      It's something very simple yet I can't get it to work. It would be awesome to get some help on this. I'm a very busy person so anyone who can help me to get this fix would be a great help. I get so caught up on styling with css and using graphics editors as well as gui implementation that I loose track with simple things. I'm way overworked. It's crazy. Anyways thanks in advance for a quick fix.

        if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] = 'Suspect User Good') {

        here's one problem - this part:
        $_SESSION['suspect_user'] = 'Suspect User Good'

        sets $SESSION['suspect_user'] to be 'Suspect User Good'
        you want
        $
        SESSION['suspect_user'] == 'Suspect User Good'

        Double equals for a comparison.
        You may have some others in that upper chunk of code , I haven't looked

        Not surprised you're going cross eyed - indent your code and add line spaces to make it readable!
        Also you may be busy but so's everyone.
        You think the PHP is simple and HTML /CSS complex advanced stuff? Hmm, which makes the site work?

          Obviously you would know html & css are for displaying purposes only. The core is the server side hence php. Sorry about how I displayed the code. How would this be written to do as I want though because your answer did not help at all. I did put "==". There's more going on than actually being displayed here but on a development setup this is the core of the problem. So if you aren't going to help with it don't post a comment. If the suspect is user bad do the block on the htaccess else do the captcha.

            Any takers on the help....

            	// Admin Login Function
            	function Admin_Login() {
            		$results = array();
            		$results['pageTitle'] = "Admin Login - Admin";
            		$results['pageHeading'] = "Admin Login";
            		$results['pageHeading_p'] = "Login must be provided in order to gain administrative access.";
            		if (isset($_POST['Admin_Login'])) {
            			// User Has Posted The Login Form: Attempt To Log The User In
            			if ($_POST['username'] == ADMIN_USERNAME && $_POST['password'] == ADMIN_PASSWORD) {
            				// Admin Logged In - Create Session
            				$_SESSION['username'] = ADMIN_USERNAME;
            				// UseT Bad Sessions & Resume To Admin
            				if (isset($_SESSION['suspect_user'])) { unset($_SESSION['suspect_user']);unset($_SESSION['login_count']);}header("Location: Admin.php");
            				} elseif ($_POST['username'] != ADMIN_USERNAME && $_POST['password'] != ADMIN_PASSWORD) {
            				// User Triggered Session Bad User
            				$_SESSION['suspect_user'] = 'Suspect User Bad';
            				$results['errorMessage'] = "Incorrect username & password. Please attempt again using the correct username & password.";
            				require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
            				} elseif ($_POST['username'] != ADMIN_USERNAME || $_POST['password'] != ADMIN_PASSWORD) {
            				// User Triggered Session Possible User	
            				$_SESSION['suspect_user'] = 'Suspect User Good';
            				$results['errorMessage'] = "Incorrect username/password. Please attempt login again.";
            				require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
            				} if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] == 'Suspect User Bad') {
            				// Login failed Under Session Bad User - Block The User
            				$HTAccess_file = fopen(ROOT."/.htaccess", "a+");
            				$htaccess_log =PHP_EOL."<Files Admin.php>".PHP_EOL."Order Allow,Deny".PHP_EOL."Deny from ".$_SERVER['REMOTE_ADDR'].PHP_EOL."</Files>".PHP_EOL;fwrite($HTAccess_file, $htaccess_log);fclose($HTAccess_file);
            				} if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] == 'Suspect User Good') {
            				// Login failed Under Possible User - Show Captcha
            				$results['errorMessage'] = "Use Captcha!!!!!!!.";
            			} else { $_SESSION['login_count'] ++;}
            			} else {   // User Not Logged In: Display Admin Login Form - Default Action On Start
            		require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");}}

              Here is my problem to the point -

              // Admin Login Function
              	function Admin_Login() {
              		$results = array();
              		$results['pageTitle'] = "Admin Login - Admin";
              		$results['pageHeading'] = "Admin Login";
              		$results['pageHeading_p'] = "Login must be provided in order to gain administrative access.";
              		$results['foo'] = "foo";
              		if (isset($_POST['Admin_Login'])) {
              			         // User Has Posted The Login Form: Attempt To Log The User In
              			if ($_POST['username'] == ADMIN_USERNAME && $_POST['password'] == ADMIN_PASSWORD) {
              				      // Admin Logged In - Create Session
              				$_SESSION['username'] = ADMIN_USERNAME;
              				      // UseT Bad Sessions & Resume To Admin
              				if (isset($_SESSION['suspect_user'])) { unset($_SESSION['suspect_user']);unset($_SESSION['login_count']);}header("Location: Admin.php");
              				} elseif ($_POST['username'] != ADMIN_USERNAME && $_POST['password'] != ADMIN_PASSWORD) {
              				    // User Triggered Session Bad User
              				$_SESSION['suspect_user'] = 'Suspect User Bad';
              				$results['errorMessage'] = "Incorrect username & password. Please attempt again using the correct username & password.";
              				require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
              				} elseif ($_POST['username'] != ADMIN_USERNAME || $_POST['password'] != ADMIN_PASSWORD) {
              				    // User Triggered Session Possible User	
              				$_SESSION['suspect_user'] = 'Suspect User Good';
              				$results['errorMessage'] = "Incorrect username/password. Please attempt login again.";
              				require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");
              				} if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] == 'Suspect User Bad') {
              				   // Login failed Under Session Bad User - Block The User
              				$HTAccess_file = fopen(ROOT."/.htaccess", "a+");
              				$htaccess_log =PHP_EOL."<Files Admin.php>".PHP_EOL."Order Allow,Deny".PHP_EOL."Deny from ".$_SERVER['REMOTE_ADDR'].PHP_EOL."</Files>".PHP_EOL;fwrite($HTAccess_file, $htaccess_log);fclose($HTAccess_file);
              				} if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] == 'Suspect User Good') {
              				   // Login failed Under Possible User - Show Captcha
              				$results['foo'] = "bar";
              			} else { $_SESSION['login_count'] ++;}
              			} else {   // User Not Logged In: Display Admin Login Form - Default Action On Start
              		require(ROOT.Admin_INCLUDES."/Forms/Admin_Login.php");}}

              Why is bar not being echoed -

              echo $results['foo'];

              Result is always:
              foo

              I want it to be:
              bar

              I hope this is much more clear to anyone who gets the picture. Because what I really am doing in that case is My custom Captcha. LOL my fellow webmasters

                Here on this line this line:

                if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] == 'Suspect User Good') {
                				   // Login failed Under Possible User - Show Captcha
                				$results['foo'] = "bar";

                I really want:

                if ($_SESSION['login_count'] >= 3 && $_SESSION['suspect_user'] == 'Suspect User Good') {
                				   // Login failed Under Possible User - Show Captcha
                				require(ROOT.Admin_INCLUDES."/Forms/Captcha.php");

                Developers Sharing Knowledge...... We have this awesome comunity so......

                  2 years later

                  [FONT=Comic Sans MS]New Member Bites Hands That Feeds Him, Thread Languishes --- film at 11[/FONT]

                    Write a Reply...