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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:30:30+00:00 2026-05-11T19:30:30+00:00

This is a bit noob question but.. Its happens sometimes to everybody. I never

  • 0

This is a bit noob question but.. Its happens sometimes to everybody.

I never worked with $_SESSION so once i need a login system i’ve used Dreamweaver to do one for me.

I have a page where he asks for user name and password.
And if loggin successful its goes to other page. Else it says in the login page.

The problem its that the Login, system that once worked, now isn’t working.
Because the he stays in the login page. And i’ve done a “echo $_SESSION[‘MM_Username’];”

And nothing returned. So i think it means that i isn’t creating the cookie for access??

Right? I think that a echo on the session displays something.

Well can i have some help guys? Maybe a simple login system. Not a Dreamweaver loggin.

I will post the user login code in the login page.

// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['passe'];
  $MM_fldUserAuthorization = "power";
  $MM_redirectLoginSuccess = WWW."/administrador";
  $MM_redirectLoginFailed = WWW."/login";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_dbconnect, $dbconnect);

  $LoginRS__query=sprintf("SELECT username, passwd, power FROM `user` WHERE username=%s AND passwd=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 

  $LoginRS = mysql_query($LoginRS__query, $dbconnect) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {

    $loginStrGroup  = mysql_result($LoginRS,0,'power');

    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;       

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}

I worked. it the changes you see there that are in the $MM_redirectLoginSuccess and $MM_redirectLoginFailed and nothing changed in the database.

If its tired some. Just post a simple login user code, i’ve found some but, not good ones. That i do the rest.

Do you know whats its wierd? It worked. I saved, then turn off computer, then when i came back didn’t worked.

Thanks again.

  • 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-11T19:30:30+00:00Added an answer on May 11, 2026 at 7:30 pm

    I take it your database is running?

    Otherwise just start going through the code, when debugging variables try using var_dump($var) that way you’ll see the type (specifically if it’s null) of the variable you’re debugging.

    $LoginRS__query — echo this, and see what query is being generated. Run that through you’re database yourself and see what happens.

    header(“Location: ” . $MM_redirectLoginSuccess ); — Keep in mind that if any data has been sent ( variables echoed etc.) this wont be able to redirect the user as the headers will already have been sent.

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

Sidebar

Related Questions

This is a bit of a noob question but what do I need to
Sorry, this is a bit of a noob question, but do you need a
i think this is a bit of a noob question, but here goes. I
Apologies for this question but I am a bit of a noob with Delphi.
I guess this is a bit of a noob question but I haven't seen
This is definitely a bit of a noob question, but my searches so afar
Ok this may seem like a bit of a noob question but one many
Sorry if this is a bit of a noob question but I am still
This is going to be a bit of a noob question but I have
I'm sorry if this is a bit of a C-noob question: I know I

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.