Yet another error

Location of the Videos
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Yet another error

Post by Rob »

Well, I log in to the mmorpg yet it always says its the wrong username or password even if its right.

Code: Select all

<?php
include_once 'connect.php';
session_start();

if (isset($_POST['submit']))
{
	$player=$_POST['player'];
	$password=$_POST['password'];
	$player=strip_tags($player);
	$password=strip_tags($password);
	$password=md5($password);
	
	$query = "select name,password from players where name='$player' and 'password'";
	$result = mysql_query($query) or die("Could not query players");
	$result2 = mysql_fetch_array($result);
	if ($result2)
	{
		$_SESSION['player']=$player;
		
		echo "<big>Logged in successfully<br>";
		echo "<a href='battle.php'>Continue</a></big>";
	}
	else
	{
		echo "<big>Wrong username or password. <a href='login.php'>Try again.</a></big>";
	}
}
?>
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Yet another error

Post by Torniquet »

my guess would be the following line..


$query = "select name,password from players where name='$player' and 'password'";



try

$query = "select name,password from players where name='$player' and password='$password'";
New Site Coming Soon! Stay tuned :D
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Yet another error

Post by Noctrine »

You guys' queries always look so nasty ><
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

Its still not logging in.

Code: Select all

<?php
include_once 'connect.php';
session_start();

if (isset($_POST['submit']))
{
	$player=$_POST['player'];
	$password=$_POST['password'];
	$player=strip_tags($player);
	$password=strip_tags($password);
	$password=md5($password);
	
	$query = "select name,password from players where name='$player' and password='$password'";
	$result = mysql_query($query) or die("Could not query players");
	$result2 = mysql_fetch_array($result);
	if ($result2)
	{
		$_SESSION['player']=$player;
		
		echo "<big>Logged in successfully<br>";
		echo "<a href='battle.php'>Continue</a></big>";
	}
	else
	{
		echo "<big>Wrong username or password. <a href='login.php'>Try again.</a></big>";
	}
}
?>
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Yet another error

Post by hallsofvallhalla »

is it actually saying "wrong username or password"?

check you database and make sure all feilds in the players table are exactly the same, no capitals, ect... This has been 95% of the erros we have seen so far from users. take a screen shot of your players table in your database.
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

Image

as you can see, i even put player one's email the same as the tutorial, but I dont use him to login I use the others

http://img16.imageshack.us/img16/5238/l ... tmmorp.png
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Yet another error

Post by hallsofvallhalla »

what happens if you just put player1 as username and nothing for the password?

also post your register.php here
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

Code: Select all

<?php
include 'connect.php';

?>

<form method="post" action="reguser.php">
Type Username Here: <input type="text" name="player" size="21"><br>
Type Password Here: <input type="text" name="password" size="15"><br>
ReType Password Here: <input type="text" name="pass2" size="15"><br>
Type Email Address: <input type="text" name="email" size="55"><br>

<input type="submit" value="Submit">
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Yet another error

Post by hallsofvallhalla »

very strange indeed, what happens when you try to use player1 login?
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

the same, Wrong username and password...

do you want my ip so you can try it out?
Post Reply

Return to “Older Browser MMO Videos”