Browser MMO Video #5
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
that just means you submit button is not working. Check your login code and see why.
-
- Posts: 62
- Joined: Tue Nov 24, 2009 11:09 pm
Re: Video#5
ah should I have a submit button on login i just have to press enter because there isn't one
Re: Video#5
Looking back at the code you posted on an earlier page for your login screen:
You're missing a ">" at the end after "submit" and you also need a </form> tag closing
Code: Select all
<form method="POST" action="authenticate.php">
UserName <input type="text" name="player" size="21"<----------- add > here
Password <input type="password" name="password" size="21" mask="x">
<br>
<input type="submit" value="login" name="submit"<-------------add ></form> here
-
- Posts: 62
- Joined: Tue Nov 24, 2009 11:09 pm
Re: Video#5


Re: Video#5
hello,
i followed your tutorial video's 1 until 5 but after i do all the things in tutorial 5, i can still register, but if i log in it says:
Parse error: parse error in D:\Program Files\wamp\www\tutorial\authenticate.php on line 7
My code of authenticate.ph is:
Rowin
i followed your tutorial video's 1 until 5 but after i do all the things in tutorial 5, i can still register, but if i log in it says:
Parse error: parse error in D:\Program Files\wamp\www\tutorial\authenticate.php on line 7
My code of authenticate.ph is:
- <?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 succesfully<br>";
echo "<A href='battle.php'>Continue</a></big>";
)
else
(
echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
)
)
?>
Rowin
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
couple issues
you have ( and ) instead of { and } on your if and else statements
should be
and this
should be
you have ( and ) instead of { and } on your if and else statements
Code: Select all
if (isset($_POST['submit']))
(
$player=$_POST['player'];
Code: Select all
if (isset($_POST['submit']))
{
$player=$_POST['player'];
Code: Select all
$query = "select name,password from players where name='$player' and '$password'";
Code: Select all
$query = "select name,password from players where name='$player' and password='$password'";
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Video#5
Either of those are likely the problem. When structuring issues occur such as swapping "( )" for "{ }", you will oftentimes get "parse errors". This usually means the interpreter is completely messed up and has no idea what you are doing. A simple mistake trips it, and it just keep tripping.
The indelible lord of tl;dr
Re: Video#5
how can i make a racing game using php?
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Video#5
If you follow along with the tutorials, everything you would need to make a racing management game is there. You just have to be creative. If you are interested in making an online game where you control the cars, and actually steer them, that cannot be done with PHP. PHP is a server-side scripting language, so it can only update the player when the screen refreshes. Maybe something like that could be done with AJAX, but I would suggest against making it multiplayer, because the calculations would have to be done on the browser-side, which could easily be hacked.Jake143 wrote:how can i make a racing game using php?
The indelible lord of tl;dr
Re: Video#5
ok thx i also have a pharse problem with line 7 of authenticate page and ine 8 of battle page i followed it exactly but still errors?If you follow along with the tutorials, everything you would need to make a racing management game is there. You just have to be creative. If you are interested in making an online game where you control the cars, and actually steer them, that cannot be done with PHP. PHP is a server-side scripting language, so it can only update the player when the screen refreshes. Maybe something like that could be done with AJAX, but I would suggest against making it multiplayer, because the calculations would have to be done on the browser-side, which could easily be hacked.
ok i fixed line 7 go parse on line 18 now here is my authenticate page:
<?php
include_once 'connect.php';
session_start ();
if (isset($_POST['submit']))
{
$player=$_POST['player'];
$passwordr=$_POST['password'];
$player=strip_tags ($player);
$password=strip_tags ($password);
$password=md5 ($password);
$query = "select name,password 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 sucessfully<br>";
echo "<A href='battle.php'>Continue</a></big>";
)
else
(
echo "<big>Wrong username or Password. <A href='login.php'>Try Again</a></big>";
)
)
?>