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;
}

Link to comment
Share on other sites

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.