PHP Code:
<FORM method="post" action="<? echo $PHP_SELF;?>">
<p>Character Name:
<input name="aid" type="textfield" />
<select name="sg">
<option value="33334">Donatie Shotgun 1</option>
<option value="33354">Donatie Shotgun 2</option>
<option value="33359">Donatie Shotgun 3</option>
</select>
<input type="submit" value="Buy" name="koop" />
</form>
<?
include('config.php');
$naam = anti_injection($_POST ["aid"]);
$itemid = anti_injection($_POST ["sg"]);
$cid = ("SELECT CID FROM Character where Name='$naam'");
$query = odbc_exec($connect,$cid);
odbc_fetch_row($query);
$cidnr = odbc_result($query, 1);
if (isset($_POST["koop"]))
{
if (empty($naam))
{
echo ('<br>You have to fill in a character name!');
}
else
{
echo ('<br>Sucessfully bought item!');
odbc_exec ($connect, "INSERT INTO CharacterItem (CID, ItemID) VALUES ('$cidnr', '$itemid')");
}
}
?>
AND
PHP Code:
<form method="post" action="<? echo $PHP_SELF;?>">
<p><b>Character Name:</b>
<input type="text" name="char" />
</p>
<p>
<input type="submit" value="Search" name="search" />
</p>
</form>
<?
include ('config.php');
$char = $_POST["char"];
$sql = ("SELECT Name,Level,XP,KillCount,Deathcount,Regdate,bp,sex FROM Character (nolock) where name='$char'");
$query = odbc_exec($connect,$sql);
odbc_fetch_row($query);
$sex = odbc_result($query, 8);
if( isset($_POST['search']) )
{
if (empty ($char))
{
echo("<font color=\"red\"><h1>You have not filled in a character!</h1></font>");
}
else
{ echo ('<b>Name: ');
echo odbc_result($query, 1);
echo ('<br>');
echo ('Level: ');
echo odbc_result($query, 2);
echo ('<br>');
echo ('XP: ');
echo odbc_result($query, 3);
echo ('<br>');
echo ('Kills: ');
echo odbc_result($query, 4);
echo ('<br>');
echo ('Deaths: ');
echo odbc_result($query, 5);
echo ('<br>');
echo ('Bounty: ');
echo odbc_result($query, 7);
echo ('<br>');
echo ('Registered On: ');
echo odbc_result($query, 6);
echo ('<br>');
echo ('Sex: ');
if($sex=="1")
{
echo ('Woman');
}
elseif ($sex=="0")
{
echo ('Man');
}
}
}
?></b>
Hope it helps.