Jump to content

Recommended Posts

My login script doesn't seem to be working. I think I might of changed something about 2 weeks ago, but can't remember what, nor can I what...

 

Could anybody help me out, pelase? It would be much appreciated.

 

<?php

				$username = $_POST['username'];
				$password = $_POST['password'];

				if (empty($username) && (empty($password))){
					echo "<font color=\"blue\">All fields are required!</font>";	
				}else{

					if($username && $password)
					{

						require("connect_to_mysql.php");

						$query = mysql_query("SELECT * FROM login WHERE username='$username' AND password='" . md5($password) . "'");

						$numrows = mysql_num_rows($query);

						if($numrows == 1)
						{	
							header("location: index.php");
							$_SESSION['username'];
						}
					}
				}
				?>

 

It doesn't check whether the username exists, yet.

Link to comment
https://forums.phpfreaks.com/topic/263524-login-script-not-working/
Share on other sites

It checks the users username and passwords that they entered when they registered.

 

It checks their username and password that they have entered, which are stored in a variable, $username = $_POST['username']; and $password = $_POST['password']; (the mysql_real_escape_string() gives me errors for some reason).

 

The script did work before, but for some reason it isn't working now...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.