Location of the Videos
coremonster
Posts: 7 Joined: Mon Jul 06, 2009 9:40 pm
Post
by coremonster » Tue Jul 07, 2009 8:57 pm
here it is:
Code: Select all
<?php
include_once 'connect.php';
session_start();
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$creature=$_GET['creature'];
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
$playerid=$playerinfo3['id']; <---line21
$counter = 0;
echo "<small>";
print "<left>";
print "<table border='1' bordercolor='blue' bgcolor='#000099' width='25%' cellspacing='25'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo= "SELECT * from inventory where id='$playerid'";
$invinfo2=mysql_query($invinfo) or die("could not select player inventory");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</font></td><td>Stat<font color='ffffff'>______</td><td>Stat Add<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>_______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[stats]</td><td>$invinfo3[statadd]</td><td>$invinfo3[type]</td><td>$invinfo3[price]</td><td><A href='battle.php?randid=$invinfo3[randid]&creature=$creature'>Use Item</a></td><td><A href='sellitem.php?randid=$invinfo3[randid]&itemname=$invinfo3[name]'>Sell Item</a></tr>";
$counter = 1;
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>You have Nothing in your inventory!<br>";
echo "<a href='battle.php?creature=$creature'>Go Back</center>";
exit;
}
echo "<center><a href='battle.php?creature=$creature'>Go Back</center>";
?>
Torniquet
Posts: 869 Joined: Sun Aug 02, 2009 6:18 am
Post
by Torniquet » Mon Aug 03, 2009 12:37 pm
correct me if i am wrong (and i usually am :p )
but the way you have done the login... doesnt it only check to see if the password and the username exsist in the table... not whether it matches to the user...
so like user Password A be used to get into user Z's account??
not got round to trying it yet as im busy with summert else lol.
JUST A FORTTT
LUBS xxx
New Site Coming Soon! Stay tuned
godfather
Posts: 8 Joined: Mon Aug 31, 2009 10:52 pm
Post
by godfather » Mon Aug 31, 2009 11:03 pm
Notice: Undefined index: player in C:\wamp\www\tutorial\authenticate.php on line 7
Notice: Undefined index: password in C:\wamp\www\tutorial\authenticate.php on line 8
Wrong username or password.Try Again
i copyed the authenticate code that is in the video#7
stil dont work
and i think the login dont work 2
i put the username and the password correctly but Wrong username or password.Try Again
godfather
Posts: 8 Joined: Mon Aug 31, 2009 10:52 pm
Post
by godfather » Tue Sep 01, 2009 3:00 pm
can you tell me whats wrong?
godfather
Posts: 8 Joined: Mon Aug 31, 2009 10:52 pm
Post
by godfather » Tue Sep 01, 2009 3:13 pm
Code: Select all
<?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 palyers 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>";
}
}
?>
i put palyers bekause i wrothe it wrong in the phpmyadmin
but its the same that is in the video#7
hallsofvallhalla
Site Admin
Posts: 12026 Joined: Wed Apr 22, 2009 11:29 pm
Post
by hallsofvallhalla » Tue Sep 01, 2009 3:22 pm
can you post a screenshot of your players table? if not export the table, open in wordpad then post it here? Screen shot would be better,
hallsofvallhalla
Site Admin
Posts: 12026 Joined: Wed Apr 22, 2009 11:29 pm
Post
by hallsofvallhalla » Tue Sep 01, 2009 3:38 pm
delete the player1 row. redo it with the register, then try agin and let me know what you get.
godfather
Posts: 8 Joined: Mon Aug 31, 2009 10:52 pm
Post
by godfather » Tue Sep 01, 2009 3:43 pm
the same
Notice: Undefined index: player in C:\wamp\www\tutorial\authenticate.php on line 7
Notice: Undefined index: password in C:\wamp\www\tutorial\authenticate.php on line 8
Wrong username or password.Try Again