Page 16 of 35

Re: Video#5

Posted: Mon Mar 22, 2010 9:20 pm
by jman2o2
Will you please post the source code to the login.php and the other file forgot the name right now.

Re: Video#5

Posted: Mon Mar 22, 2010 9:21 pm
by jman2o2
Will you please post the source code for both files

Re: Video#5

Posted: Mon Mar 22, 2010 9:39 pm
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.

Re: Video#5

Posted: Tue Mar 23, 2010 2:36 am
by hallsofvallhalla
i strongly recommend you watch teh videos all the way to video 14 at least then work with the code.

Re: Video#5

Posted: Fri Mar 26, 2010 9:08 am
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.

Re: Video#5

Posted: Fri Mar 26, 2010 12:25 pm
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'";

Re: Video#5

Posted: Fri Mar 26, 2010 1:11 pm
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";
}

Re: Video#5

Posted: Sat Mar 27, 2010 1:22 am
by hallsofvallhalla
it will error out of you try to use (

)

use {

}

Re: Video#5

Posted: Sat Mar 27, 2010 2:05 am
by jpoisson
Thanks for clarifying that halls.

Re: Video#5

Posted: Sat Apr 03, 2010 8:39 pm
by jskinman
keep getting could not query players can someone help??? :evil: