Browser MMO Video #5

Location of the Videos
jman2o2
Posts: 2
Joined: Mon Mar 22, 2010 1:36 am

Re: Video#5

Post by jman2o2 »

Will you please post the source code to the login.php and the other file forgot the name right now.
jman2o2
Posts: 2
Joined: Mon Mar 22, 2010 1:36 am

Re: Video#5

Post by jman2o2 »

Will you please post the source code for both files
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Video#5

Post by Jackolantern »

All of the scripts are posted. I think login and reguser are listed under the video file in the thread for Video 3.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post by hallsofvallhalla »

i strongly recommend you watch teh videos all the way to video 14 at least then work with the code.
andreidav
Posts: 1
Joined: Fri Mar 26, 2010 8:57 am

Re: Video#5

Post by andreidav »

I'm having some problems with the 5# video

here is the code

authenticate.php

Code: Select all

<?php
include_once "coonetct.php";
session_start();

if (isset($_POST['submit']))
(
$player=$_POST['player'];
$password=$_POST['password'];
$player=strip_tags($player);
$player=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 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>";
)
)
?>
I'm having a parse on line 7
can you please post the code?
I couldn't find it.
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Video#5

Post by OldRod »

A couple of things - not sure if they are your problem or not

include_once "coonetct.php"; <-- should probably be "connect.php"

Change: $query="select name,password from players where name= '$player' and '$password'";

to: $query="select name,password from players where name= '$player' and password='$password'";
jpoisson
Posts: 245
Joined: Sun Aug 02, 2009 5:12 pm

Re: Video#5

Post by jpoisson »

why are you using () braces in your initial if statement? it seems to be more confusing to read.

Code: Select all

if (foo)
(
 echo "foo";
)
I am not sure if php interprets it any different then curly braces but curly braces allow for you to keep your code clean and know where statements end and begin with less confusion.

Code: Select all

if (foo)
{
 echo "foo";
}
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post by hallsofvallhalla »

it will error out of you try to use (

)

use {

}
jpoisson
Posts: 245
Joined: Sun Aug 02, 2009 5:12 pm

Re: Video#5

Post by jpoisson »

Thanks for clarifying that halls.
jskinman
Posts: 56
Joined: Mon Mar 22, 2010 10:21 pm

Re: Video#5

Post by jskinman »

keep getting could not query players can someone help??? :evil:
Post Reply

Return to “Older Browser MMO Videos”