Browser MMO Video #5

Location of the Videos
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Video#5

Post 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 :)
zolacat999
Posts: 62
Joined: Tue Nov 24, 2009 11:09 pm

Re: Video#5

Post 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
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post 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' ";
zolacat999
Posts: 62
Joined: Tue Nov 24, 2009 11:09 pm

Re: Video#5

Post 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>";
}
}
?>
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Video#5

Post by OldRod »

Hmmm... I don't see anything obvious. You're not getting any errors? Just the blank page you showed above?
zolacat999
Posts: 62
Joined: Tue Nov 24, 2009 11:09 pm

Re: Video#5

Post by zolacat999 »

yep just the blank page its really strange
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Video#5

Post 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 :)
zolacat999
Posts: 62
Joined: Tue Nov 24, 2009 11:09 pm

Re: Video#5

Post 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
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post 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
zolacat999
Posts: 62
Joined: Tue Nov 24, 2009 11:09 pm

Re: Video#5

Post by zolacat999 »

ah thats interesting that works so that is the problem does it matter if i don't have it
Post Reply

Return to “Older Browser MMO Videos”