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 7892233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:49:07+00:00 2026-06-03T06:49:07+00:00

<?php //Login Module (Updated, isset now correct) session_start(); if(!(isset($_SESSION[‘login’]) && ($_SESSION[‘login’] != ))) {

  • 0
<?php
//Login Module (Updated, isset now correct)
session_start();
if(!(isset($_SESSION['login']) && ($_SESSION['login'] != ""))) {
    include('processor/ProcessLogout.php');
} else {
    include('processor/ProcessLog.php');
}
?>

Problem is…it doesn’t work. I can’t seem to get it to validate to true T_T. I set $_SESSION[‘login’] in processor/assess_login.php. ProcessLog is merely a container for some divs and a form the form passes information to asssess_login (which then tells me whether a login has been successful or not). One displays a login form the other displays a logout form. Unfortunately, even though I get “Login Successful”… it’s rather worrying that $_SESSION[‘login’] refuses to change to ‘1’. (That’s what I do in assess_login if the login is successful. if it fails I set it to an empty string.

Now as far as I’m aware session_start() is supposed to remember this, but for some reason…it doesn’t o.o; So any tips on my bug hunting

There are compilation errors and taking away the ! does infact display the alternative, so I know that bit ‘is’ working it just isn’t evaluating to true.

Now… as for the assess_login…

           if ($db_found) {
        $member_username = quote_smart($member_username, $db_handle);
        $member_password = quote_smart($member_password, $db_handle);

        $sql = "SELECT * FROM $tblname WHERE username=$member_username AND passphrase=$member_password";
        $result = mysql_query($sql);
        $num_rows = mysql_num_rows($result);

        //Validate there is a user
        if($result) {
            if($num_rows == 1) {
                session_start();
                $_SESSION['login'] = '1';
                header("location: ../login_success.php");

            } else {
                session_start();
                $_SESSION['login'] = "";
                header("location: ../login_fail.php");

            }
        } else {
            $error_msg = "Error Validating User! -1";
        }           
    mysql_close($db_handle);
    }

Bearing in mind it is buried somewhat. As I’ve said before I can’t get the login to stick and I know I’m missing something obvious I’ll be damned if I can figure out what though.

  • 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-06-03T06:49:09+00:00Added an answer on June 3, 2026 at 6:49 am

    Your if statement is not correct:

    if(!(isset($_SESSION['login'])) && ($_SESSION['login'] != ""))
    

    should be

    if(!(isset($_SESSION['login']) && $_SESSION['login'] != ""))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wrote a PHP login script, and what I'm trying to accomplish is
I have a PHP login which sets 2 cookies once someone login. The problem
Following is my php login script, There are one problem. If i put any
I'm getting errors with the PHP login script I am using on my site.
I am trying to make a php login page that allows users to access
I'm looking for a good PHP login class via MySQL, and I'm not yet
I am developing a PHP-based login system. Each user has an ID(a number) and
I am working on a php/mysql login system for a webproject. After looking through
Php novice. 1.Is there anything wrong with this PHP & MySQL code? include_once db_login.php
I am using CodeIgniter and I have two different controllers - login.php and site.php

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.