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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:18:09+00:00 2026-06-12T17:18:09+00:00

I have done enough researching ,when logging in it does not redirect me to

  • 0

I have done enough researching ,when logging in it does not redirect me to the resource page in case of correct password also.. i had tried SHA1 on passwords before but first dealing with simpler cases,i removed it.
when i ask NAME = ‘$usr’,
As i have user as username,
if i enter User too,it doenot show wrong username,on terminal also if we try this,for username ‘user’ or ‘User’,it shows the same thing.

<?php
    $con = mysql_connect("localhost","root","*****");
    session_start();
if(isset($_POST['submit1']))
    {
            if (!$con)
            {
                    die("OOPS!Could not connect to server".mysql_error());
            }
                    $passwd = $_POST['password'];
                    $usr=$_POST['username'];
                    mysql_select_db('USERS',$con) or die(mysql_error());
                    $result = mysql_query("SELECT PASSWD FROM USERS WHERE USERNAME='$usr'",$con) Or die(mysql_error());
                    $pass = mysql_result($result,0);
                    if ($pass==$passwd) {
                            header('Location : resource.html');}
                    else
                            {echo "sorry $usr wrong username or password"; }

    }
else if(isset($_POST['submit2']))
    {
            $usr = $_POST['user'];
            $passwd = $_POST['password1'];
            $name = $_POST['fullname'];
            mysql_select_db('USERS',$con) or die(mysql_error());
            $result = mysql_query("SELECT * FROM USERS WHERE USERNAME='$usr'",$con) Or die(mysql_error());
            $num = mysql_num_rows($result);
            if ($num==0) {
            mysql_query("INSERT INTO USERS(NAME,USERNAME,PASSWD) VALUES('$name','$usr','$passwd')");
            echo "congrats! you have been added.Go back to resources and log in";
            }
            else echo "Someone already has that username. Go back and try with another username";
    }

 mysql_close($con);
?>
  • 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-12T17:18:10+00:00Added an answer on June 12, 2026 at 5:18 pm

    Your missing a semicolon before an echo

    mysql_query("INSERT INTO USERS(NAME,USERNAME,PASSWD) VALUES('$name','$usr','$passwd')");//<-- right here
    echo "congrats! you have been added.Go back to resources and log in";
    

    Also you are not sanitizing your user input, look into prepared statements (PDO, mysqli)

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

Sidebar

Related Questions

I've done enough Googling to know that if I have something like class SubObject
In methodB I have done a for loop where duplicate names are not displayed.
I have done enough research and have decided to move the JavaScript to the
Guys, Well I have done enough research still I can't find the solution to
Am developing jigsaw puzzle for iphone. Here I have done the enough googling but
So I have done a few minor things with web services and had some
Ok I have done enough research on it but cant find the solution. Its
I have done enough work on the cluster. The present requirement for me is
I have done my research but have found nothing specific enough to my problem
Have done quite a bit of searching for a guide (of any substance) for

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.