pax.
Browser MMO Video #5
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Video#5
No problem. Just glad to be of help.   
 
pax.
			
			
									
						
										
						pax.
Re: Video#5
I am just starting this, everything has been fine till now, after I log in I get the goblin stats but none for  the player just shows this.
Hit points =
Attack =
Defense =
Goblin
Hit points = 5
Attack = 3
Defense = 3
Attack!
			
			
									
						
										
						Hit points =
Attack =
Defense =
Goblin
Hit points = 5
Attack = 3
Defense = 3
Attack!
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Video#5
Hi Watcher!
Welcome to indie-resource. 
 
As for the problem, I'm sorry, but I can't do much to help you without any code to work with.
Although it sounds like a database data issue, could you post the code onto here?
pax.
			
			
									
						
										
						Welcome to indie-resource.
As for the problem, I'm sorry, but I can't do much to help you without any code to work with.
Although it sounds like a database data issue, could you post the code onto here?
pax.
Re: Video#5
The reason is, that you do not have your characters info put in. Go into your DB and find your players tab than find the character you want to add stats for and click insert and add all the stats for that player. Hope that helped.
			
			
													
					Last edited by n04h on Tue Feb 22, 2011 3:41 pm, edited 1 time in total.
									
			
						
							
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Video#5
Well there you have it. 
Thanks no4h. 
 
Let us know if it works out. 
 
pax.
			
			
									
						
										
						Thanks no4h.
Let us know if it works out.
pax.
Re: Video#5
Um... I tried to make the login system, but for some reason, the authenticate.php page displays nothing at all
			
			
									
						
										
						- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
strange, post your code here, though if I was you I would keep watching the videos as it may fix itself on its own.
			
			
									
						
										
						Re: Video#5
My authenticate.php code is as listed below, but when I try to login at localhost/tutorial/login.php I get this... 
( ! ) Notice: Undefined index: password in C:\wamp\www\Tutorial\authenticate.php on line 8
Call Stack
# Time Memory Function Location
1 0.0017 681496 {main}( ) ..\authenticate.php:0
Wrong username or password.Try Again
I made a new account with a password just to make sure it was correct, but still no luck.
<?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>";
}
}
?>
			
			
									
						
										
						( ! ) Notice: Undefined index: password in C:\wamp\www\Tutorial\authenticate.php on line 8
Call Stack
# Time Memory Function Location
1 0.0017 681496 {main}( ) ..\authenticate.php:0
Wrong username or password.Try Again
I made a new account with a password just to make sure it was correct, but still no luck.
<?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>";
}
}
?>
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
your issue is here
nothing is being passed to it from register.php
check your register.php and make sure your form's password field is spelled right.
i recommend watching all the videos up to around 14 before attempting any code.
			
			
									
						
										
						Code: Select all
$password=$_POST['password'];check your register.php and make sure your form's password field is spelled right.
i recommend watching all the videos up to around 14 before attempting any code.
Re: Video#5
Here is my register.php. I don't see anything wrong, but maybe im just missing it.
<?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: <input type="text" name="pass2" size="15"><br>
Type E-mail address: <input type="text" name="email" size="60"><br>
<input type="submit" value="submit">
</form>
			
			
									
						
										
						<?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: <input type="text" name="pass2" size="15"><br>
Type E-mail address: <input type="text" name="email" size="60"><br>
<input type="submit" value="submit">
</form>