Re: Video 14
Posted: Thu Aug 26, 2010 12:34 am
once I buy a weapon, I get the error "Notice: Undefined index: local in C:\wamp\www\tutorial\equipped.php on line 27"
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
$id=$playerinfo3['id'];
?>
</div>
<div id="table">
<?php
$type=$_GET['type'];
$local=$_GET['local'];
$randid=$_GET['randid'];
if ($type=="w")
{
$updateequip="Update playerweapons SET equip=0 WHERE pid='$id' AND equip=1";
mysql_query($updateequip) or die("Could not update equipment");
$reequip="Update playerweapons set equip=1 where pid='$id' AND randid='$randid'";
mysql_query($reequip) or die("Could not update equipment2");
echo "<center><big><big>Weapon Equipped<br></big></big>";
echo "<br><A href='index.php'>Go back</a>";
}
if ($type=="a")
{
$updateequip="Update playerarmor SET equip=0 WHERE pid='$id' AND equip=1 AND location='$local'";
mysql_query($updateequip) or die("Could not update armor");
$reequip="Update playerarmor set equip=1 where pid='$id' AND randid='$randid' AND location='$local'";
mysql_query($reequip) or die("Could not update armor2");
echo "<center><big><big>Armor Equipped<br></big></big>";
echo "<br><A href='index.php'>Go back</a>";
}
?>
</div>
Code: Select all
$type=$_GET['type'];
$local=$_GET['local'];
$randid=$_GET['randid'];
Code: Select all
if(isset($_GET['type'])) {$type=$_GET['type'];}
if(isset($_GET['local'])) {$local=$_GET['local'];}
if(isset($_GET['randid'])) {$randid=$_GET['randid'];}
Code: Select all
$playerinfo3[level]
Code: Select all
$playerinfo3['level']
Code: Select all
$bypass = 0;