Page 11 of 35

Re: Video#5

Posted: Wed Jan 06, 2010 6:51 pm
by hallsofvallhalla
that just means you submit button is not working. Check your login code and see why.

Re: Video#5

Posted: Wed Jan 06, 2010 8:07 pm
by zolacat999
ah should I have a submit button on login i just have to press enter because there isn't one

Re: Video#5

Posted: Wed Jan 06, 2010 8:27 pm
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

Re: Video#5

Posted: Wed Jan 06, 2010 10:26 pm
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:

Re: Video#5

Posted: Fri Jan 15, 2010 9:39 pm
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

Re: Video#5

Posted: Fri Jan 15, 2010 10:07 pm
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'";

Re: Video#5

Posted: Sat Jan 16, 2010 4:38 am
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.

Re: Video#5

Posted: Mon Jan 18, 2010 5:16 pm
by Jake143
how can i make a racing game using php?

Re: Video#5

Posted: Mon Jan 18, 2010 5:26 pm
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.

Re: Video#5

Posted: Mon Jan 18, 2010 7:26 pm
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>";
)
)
?>