Page 26 of 35

Re: Video#5

Posted: Sat Feb 12, 2011 4:01 pm
by Xaleph
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.

Re: Video#5

Posted: Sat Feb 12, 2011 4:16 pm
by n04h
Ok ill try that out and tell you how it works out.
thanks for the help :)

Re: Video#5

Posted: Sat Feb 12, 2011 5:01 pm
by n04h
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.

Re: Video#5

Posted: Sun Feb 13, 2011 5:45 am
by PaxBritannia
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.

Re: Video#5

Posted: Sun Feb 13, 2011 5:49 am
by n04h
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.

Re: Video#5

Posted: Sun Feb 13, 2011 5:53 am
by PaxBritannia
Could we see the registration script? It might be setting the password to root regardless of the user's input.

pax.

Re: Video#5

Posted: Sun Feb 13, 2011 5:57 am
by n04h
Register:

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">
Reguser:

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>";
?>

Re: Video#5

Posted: Sun Feb 13, 2011 9:37 am
by PaxBritannia
I found this in authenticate.php which might be causing the problem:

Code: Select all

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

Code: Select all

password='$password'
pax.

Re: Video#5

Posted: Sun Feb 13, 2011 6:47 pm
by n04h
Alright, ill try that out thanks Pax.

Re: Video#5

Posted: Sun Feb 13, 2011 6:54 pm
by n04h
Pax your awesome that was the problem, I can now get back to the videos and learn some more, thanks a lot! :D