Browser MMO Video #5
Re: Video#5
Default user for the mysql db is root with password root. There is also a default user called root with password empty. So i recommend you go to your config file and change the default password to something else then root. 
You can do this looking in the X/W/ etc AMP map, mysql and the conf directory. There should be a file called config.inc.php or something like that. If you open that one, just look for something with password, and change that to a real password. If you did that, you have to log in using that password, and i recommend deleting all other accounts, except the main admin ( with the newly changed password obviously ) and add 1 account which has limited options ( like the usual Insert, delete, update and select ) the rest is not needed for this user, and assign this user to 1 database.
			
			
									
						
										
						You can do this looking in the X/W/ etc AMP map, mysql and the conf directory. There should be a file called config.inc.php or something like that. If you open that one, just look for something with password, and change that to a real password. If you did that, you have to log in using that password, and i recommend deleting all other accounts, except the main admin ( with the newly changed password obviously ) and add 1 account which has limited options ( like the usual Insert, delete, update and select ) the rest is not needed for this user, and assign this user to 1 database.
Re: Video#5
Ok so I changed the default password of root but im still having the problem of when I register a new character they cant log in with there password.
			
			
									
						
							
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Video#5
Wait...
Are you talking about MySQL database accounts, or accounts for your game? 
 
You don't need to create a new database account for every user in your game. Most often, only one database account is used to access everyone's records in the game.
pax.
			
			
									
						
										
						Are you talking about MySQL database accounts, or accounts for your game?
 
 You don't need to create a new database account for every user in your game. Most often, only one database account is used to access everyone's records in the game.
pax.
Re: Video#5
I am speaking of in-game characters, I already have a sql account but it is my in-game chars that cant login unless they use the password root.
			
			
									
						
							
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Video#5
Could we see the registration script? It might be setting the password to root regardless of the user's input.
pax.
			
			
									
						
										
						pax.
Re: Video#5
Register:
Reguser:
			
			
									
						
							Code: Select all
<?php
include 'connect.php';
?>
<center>Your Information</center>
<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 Adress Here: <input type="text" name="email" size "60"><br>
<input type="submit" value="Done">Code: Select all
<?php
include 'connect.php';
?>
<?php
$player=$_POST['player'];
$password=$_POST['password'];
$pass2=$_POST['pass2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);
$classchoice=$_POST['classchoice'];
if ($email == "")
{
echo "You didn't enter a email address!<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
if ($password==$pass2)
{
$isplayer="SELECT * from players where name='$player'";
$isplayer2=mysql_query($isplayer) or die("Could not query players table");
$isplayer3=mysql_fetch_array($isplayer2);
if(!$_POST['password'] || !$_POST['pass2'])
{
print "You did not enter a password<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
else if($isplayer3 || strlen($player)>21 || strlen($player)<1)
{
print "There is already a player of that name or the name you specified is over 16 letters or less than 1 letter";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$isaddress="SELECT * from players where email='$email'";
$isaddress2=mysql_query($isaddress) or die("not able to query for password");
$isaddress3=mysql_fetch_array($isaddress2);
if($isaddress3)
{
print "There is already a player with that e-mail address";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$password=md5($password);
$SQL = "INSERT into players(name, password, email, level, exper,attack,defense,hpoints) VALUES('$player','$password','$email','1','0','5','5','30')";
mysql_query($SQL) or die ("could not register");
print "Thank you for registering!<br>";
}
}
}
else
{
	print "Your password didn't match or you did not enter a password<br>";
	echo "<A href='register.php'>Go back</a><br>";
	exit;
}
echo " <A href='login.php'>Login Page</a><br>";
?>

- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Video#5
I found this in authenticate.php which might be causing the problem:
It's missing 
pax.
			
			
									
						
										
						Code: Select all
  $query = "select name,password from players where name='$player' and '$password'";Code: Select all
password='$password'Re: Video#5
Pax your awesome that was the problem, I can now get back to the videos and learn some more, thanks a lot! 
			
			
									
						
							


