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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:16:23+00:00 2026-06-09T20:16:23+00:00

Whenever verifyUser is returned true then the if statement should execute but for some

  • 0

Whenever verifyUser is returned true then the if statement should execute but for some reason instead of going to the header location, the page just refreshes and that’s all that happens. I’ve checked to be sure that the input information is correct and it is and when the information is incorrect the else statement executes perfectly fine. If anyone has any ideas as to why this is happening, please let me know. Thank you.

Here is the segment where the header() statement is made:

function validateUser($name, $pass)
{
    $check = verifyUser($name, md5($pass));

    if($check)
    {
        $_SESSION['status'] = 'authorized';


        header('location: index.php');


    } else{

        echo'Please enter a correct username and password <br />';
        echo "<a href='http://localhost/cms/admin/login.php'>Try Again?</a>";
        exit;
    }



 }

Here is the verifyUser function just in case anyone needs it.

   function verifyUser($name, $pass)
   {
// Escape strings
$username = mysql_real_escape_string($name);
 $password = mysql_real_escape_string($pass);

$result = mysql_query("select * from users where username='$username' and password='$password' limit 1");

if (mysql_num_rows($result)>0)
{
    return true;
} else{
    return false;
}

  }
  • 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-09T20:16:24+00:00Added an answer on June 9, 2026 at 8:16 pm

    The most common reason that header() doesn’t work is because something else has been output first. header() can only be called before anything else has sent output to the browser.

    If this is the case, PHP will throw an error when header() is called. If you’re not displaying errors on the page, you can check your error logs to see if this is happening.

    You should also call die() or exit() immediately after (or a soon as possible after) the header() call, to prevent anything else from happening after the redirect header. It’s unlikely but possible that something later in the program could also cause the redirect to fail even where the initial header() call succeeded.

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

Sidebar

Related Questions

Whenever I open IDEA it spends some time in indexing and then shows lots
Whenever I run this script the find part executes but the if statement causes
Whenever I start my emulator from Eclipse it loads, but I CANNOT open the
Whenever the webservice provider make some changes in the wsdl, everytime the consumer needs
Whenever I create a Temporary file in C++ Native WinAPI, the HANDLE returned is
Whenever I try to animate an image with Zepto, it works fine. But I
I know this is a pretty specific question but I managed to get some
Whenever I open some help within eclipse I get a page saying: Server Error.
Whenever I click the button I want to open google.com but it closes my
Whenever I try installing anything using gem, I get this error - murtaza@murtaza-dev:~$ sudo

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.