Browser MMO Video #5

Location of the Videos
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post by hallsofvallhalla »

that just means you submit button is not working. Check your login code and see why.
zolacat999
Posts: 62
Joined: Tue Nov 24, 2009 11:09 pm

Re: Video#5

Post by zolacat999 »

ah should I have a submit button on login i just have to press enter because there isn't one
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Video#5

Post by OldRod »

Looking back at the code you posted on an earlier page for your login screen:

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
You're missing a ">" at the end after "submit" and you also need a </form> tag closing
zolacat999
Posts: 62
Joined: Tue Nov 24, 2009 11:09 pm

Re: Video#5

Post by zolacat999 »

:o i should be shot, thanks so much for the help I carn't believe i keep making so many stupid mistakes. Il see you in video 6 probably :lol:
rowinboc
Posts: 12
Joined: Fri Jan 15, 2010 9:31 pm

Re: Video#5

Post by rowinboc »

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:
  • <?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>";
    )
    )
    ?>
i hope u can help me, thanks.

Rowin
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post by hallsofvallhalla »

couple issues
you have ( and ) instead of { and } on your if and else statements

Code: Select all

if (isset($_POST['submit']))
(
$player=$_POST['player'];
should be

Code: Select all

if (isset($_POST['submit']))
{
$player=$_POST['player'];
and this

Code: Select all

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

Code: Select all

$query = "select name,password from players where name='$player' and password='$password'";
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Video#5

Post by Jackolantern »

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
Jake143
Posts: 3
Joined: Mon Jan 18, 2010 5:12 pm

Re: Video#5

Post by Jake143 »

how can i make a racing game using php?
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Video#5

Post by Jackolantern »

Jake143 wrote:how can i make a racing game using php?
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.
The indelible lord of tl;dr
Jake143
Posts: 3
Joined: Mon Jan 18, 2010 5:12 pm

Re: Video#5

Post by Jake143 »

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

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>";
)
)
?>
Post Reply

Return to “Older Browser MMO Videos”