Page 10 of 35

Re: Video#5

Posted: Tue Jan 05, 2010 8:10 pm
by OldRod
You're missing a ">"

Code: Select all

<form method="POST" action="authenticate.php">
UserName <input type="text" name="player" size="21"<--------------------------------right here
Password <input type="password" name="password" size="21" mask="x">
<br>
Don't know if that's the whole problem, but I'd fix that and try again :)

Re: Video#5

Posted: Tue Jan 05, 2010 10:31 pm
by zolacat999
Well its progress my login page works correctly now thanks. However when I type in my username and password it just goes to authenticate.php but that comes up as a blank page

Re: Video#5

Posted: Tue Jan 05, 2010 11:19 pm
by hallsofvallhalla
change this

Code: Select all

$query = "select name,password from players where name='$player' and '$password' ";
to this

Code: Select all

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

Re: Video#5

Posted: Wed Jan 06, 2010 4:55 pm
by zolacat999
for some reason it is still not working I changed what you said, hmm its probobly something obvious im just missing it

here is the current code updated

<?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='$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>";
}
}
?>

Re: Video#5

Posted: Wed Jan 06, 2010 5:13 pm
by OldRod
Hmmm... I don't see anything obvious. You're not getting any errors? Just the blank page you showed above?

Re: Video#5

Posted: Wed Jan 06, 2010 5:17 pm
by zolacat999
yep just the blank page its really strange

Re: Video#5

Posted: Wed Jan 06, 2010 5:33 pm
by OldRod
Is it possible that the problem is in "connect.php"?

That program is included - maybe something in there is causing the problem. Post the code from connect.php so we can see it too please (you can hide your username/password if you need to :)

Re: Video#5

Posted: Wed Jan 06, 2010 5:34 pm
by zolacat999
here is my connect.php

<?php

$db = mysql_connect ("localhost","root","") or die ("could not connect to database");
if (!$db)
die ("no database");
if (!mysql_select_db("tutorial",$db))
die ("no database selected");
?>

p.s. Thanks for the help it is much appreciated

Re: Video#5

Posted: Wed Jan 06, 2010 5:50 pm
by hallsofvallhalla
then do some troubleshooting

remove this

Code: Select all

if (isset($_POST['submit']))
{
and the last

Code: Select all

} 


from the bottom

then sees what happens

Re: Video#5

Posted: Wed Jan 06, 2010 6:06 pm
by zolacat999
ah thats interesting that works so that is the problem does it matter if i don't have it