Jump to content

Login script not working.


jon4433

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.