Jump to content

This script will not pull data from my mysql table.


TJMAudio

Recommended Posts

Well, it pulls all but 1 row for some reason.

 

When I call this, the User ID and Username gets pulls, however the Password doesn't.  When I try to run this script, the password should be something, but it comes up blank.

 

I have no idea what is wrong with this.  My database row for the password is named 'password'.

 

<?php
$action = $_GET['a'];

switch($action)
{
case 'login':

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

	$loginquery = mysql_query("SELECT * FROM users WHERE username='$username'");

	if(mysql_num_rows($loginquery) < 1)
	{
		echo "<script>header.location.href='index.php?m=login&e=1'</script>";
		exit;
	}

	while($users = @mysql_fetch_row($loginquery))
	{
		$userid = $users['id'];
		$usern = $users['username'];
		$userpass = $users['password'];

		if($password == $userpass)
		{
			$_SESSION['username'] = $username;
			echo "<script>header.location.href='index.php?m=home'</script>";
			exit;
		}
		else
		{
			echo "<script>header.location.href='index.php?m=login&e=1'</script>";
			exit;
		}
	}
break;
}

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.