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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:15:56+00:00 2026-05-16T02:15:56+00:00

Im writing a login script. My db.php doesnt echo/print anything so why doesnt header(Location:

  • 0

Im writing a login script. My db.php doesnt echo/print anything so why doesnt header(“Location: index.php”); redirect upon successful login? the login info is correct. I know i need to sanitize the input but that is not a problem at the moment.

 <?php
        require('db.php');
        $username = $_POST['un'];
        $password = $_POST['pw'];
        $qry="SELECT uid FROM users WHERE name='$username' AND pass='".md5($password)."'";
        $result=mysql_query($qry);
        if(mysql_num_rows($result) == 1){
            session_regenerate_id();
            $user = mysql_fetch_assoc($result);
            $_SESSION['S_UID'] = $user['uid'];
            session_write_close();
            header("Location: index.php");
            exit();
        }else{
            echo "<center><form action='index.php' name='login'>Login failed! Please try again with correct username and password.<br><input type='submit' name='failed' value='Return to Login'></form></center>";
            exit();
        }
    ?>
  • 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-16T02:15:56+00:00Added an answer on May 16, 2026 at 2:15 am

    the function header will only work if no output has been sent by the script before the function is called. Check if any codes above has echoed something.

    If not, check that the include files above do not have an extra space or newline after the closing “?>” tag. Otherwise this space or newline will be sent to the browser before your header.

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

Sidebar

Related Questions

I am currently re-writing my functions script (PHP) for my login system. Is the
I'm currently writing a PHP login script and trying to make it as secure
I have writing some changes at index.php and index_form.php to login in my mambo
I'm writing a jquery login. If the php login script (checklogin.php) echoes true then
i am writing web-services for login script. Which i have to keep on HTTPS
I am writing a perl script that should login to Gowalla, fetch some information
I am writing a script to capture the login time. In the final production,
I am writing a login script for my website. I've written the login script,
I'm writing a script to login to Hotmail. It asks the user to enter
I am writing python script to login to ssh server using paramiko. I wrote

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.