Page 4 of 35

Re: Video#5

Posted: Tue Sep 01, 2009 4:43 pm
by hallsofvallhalla
ah i think i see the problem, post your login.php

Re: Video#5

Posted: Tue Sep 01, 2009 4:53 pm
by godfather
<form method="POST" action="authenticate.php">
User Name <input type="text" name="players" size="21"><br>
Password <input type="password" name="passowrd" size="21" mask="x">
<br>
<input type="submit" value="Login" name="submit">

Re: Video#5

Posted: Tue Sep 01, 2009 5:07 pm
by godfather
lol...done

thnks

but now i have another problem
in the store table and the inventory table...i cant go to browse

Re: Video#5

Posted: Tue Sep 01, 2009 5:25 pm
by hallsofvallhalla
so you seen the mistake, the passowrd :)



thats because there is nothing there, you need to go to insert and insert data

Re: Video#5

Posted: Tue Sep 01, 2009 5:29 pm
by godfather
yes :)

Re: Video#5 HELP ME

Posted: Fri Sep 04, 2009 9:51 pm
by noahqw
help me! I need the authenticate code... Mine has errors an said this over and over when i tried to login: Parse error: parse error in C:\wamp\www\game\authenticate.php on line 7
Somone please give me the authenticate code!

Re: Video#5

Posted: Fri Sep 04, 2009 10:00 pm
by dave3460
Also sent it via pm if you needed


<?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 successfully<br>";
echo "<A href='index.php'>Continue</a></big>";
}
else
{
echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
}
}
?>

Re: Video#5

Posted: Fri Sep 04, 2009 10:16 pm
by hallsofvallhalla
if you are still having errors show us your players table and your code.

Re: Video#5

Posted: Sun Sep 06, 2009 9:03 pm
by noahqw
Somone please help me... I get a error saying the following below when I go to the battle.php screen...
error: Parse error: parse error in C:\wamp\www\game\battle.php on line 7

battle.php code:
<?php
include_once 'connect.php';
session_start();

if (isset($_SESSION['player']))
(
$player=$_SESSION['player'];
)


$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];

if (isset($_GET['creature']))
{
$creature=$_GET['creature'];
$creatureinfo="SELECT * from creatures where name = '$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);

}
else
{
$creatureinfo="SELECT * from creatures order by rand() limit 1";
$creatureinfo2=mysql_query($creatureinfo) or die("could get a creature!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];

/////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Hit points = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";

///////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Hit points = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";

echo "<a href='attack.php?creature=$creature'>Attack!";

?>

Re: Video#5

Posted: Sun Sep 06, 2009 10:42 pm
by hallsofvallhalla

Code: Select all

if (isset($_SESSION['player']))
(
$player=$_SESSION['player'];
)
should be

Code: Select all

if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}