PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
include("../../inc/config/connect.inc");
include("header.php");
protect();
if (member_types2($VAR[4]) != '0') {
echo "<p>Sorry, but you must be logged in as an administrator to view this area.";
}
else
{
include("menu.php");
if ($submit) {
$shortname = strip_tags($shortname);
$shortname = trim($shortname);
$title = strip_tags($title);
$title = trim($title);
$width = strip_tags($width);
$width = trim($width);
$file = strip_tags($file);
$file = trim($file);
$height = strip_tags($height);
$height = trim($height);
$miniimage = strip_tags($miniimage);
$miniimage = trim($miniimage);
$stdimage = strip_tags($stdimage);
$stdimage = trim($stdimage);
$isreverse = strip_tags($isreverse);
$isreverse = trim($isreverse);
if ($shortname == "") {
echo "<p>Please enter a category name.";
}
else if ($title == "") {
echo "<p>Please enter a valid title.";
}
else if ($description == "") {
echo "<p>Please enter a valid description.";
}
else if ($file == "") {
echo "<p>Please enter a valid .swf file name.";
}
else if ($miniimage == "") {
echo "<p>Please enter a valid mini image name.";
}
else if ($stdimage == "") {
echo "<p>Please enter a valid standard image name.";
}
else if ($isreverse == "") {
echo "<p>Please enter a valid reverse score setting.";
}
else {
$sql = "INSERT INTO `arcade_games` (shortname, title, description, file, width, height, miniimage, stdimage, isreverse) VALUES ('$shortname', '$title', '$description', '$file', '$width', '$height', '$miniimage', '$stdimage', '$isreverse')";
$result=mysql_query($sql) or die(mysql_error());
echo "Congratulations, your arcade category has been entered!";
}
}
echo"
<h2>Add a new game:</h2>
<p>In most cases, you will need to look at the <br />default install file (usually install.php or name.game.php) that <br />came with the game you are trying to install.
<p>
<form method='post' action='$PHP_SELF'>
<p><b>Shortname:</b></p>
The shortname sets what the game will be listed as inside the database. <br />This must correspond with the shortname specified in the game itself.<br /> It is usually the same as the filename.<br />
<input type='Text' name='shortname' value='$shortname' maxlength='25' size='25'>
<p><b>Title:</b></p>
<input type='Text' name='title' maxlength='25' value='$title'size='25'>
<p><b>Description:</b></p>
<input type='Text' name='description' maxlength='250' value='$description' size='100'>
<p><b>Width:</b></p>
<input type='Text' name='width' maxlength='4' value='$width' size='4'>
<p><b>Height:</b></p>
<input type='Text' name='height' maxlength='4' value='$height' size='4'>
<p><b>Miniature Image Name:</b></p>
<input type='Text' name='miniimage' maxlength='50' value='$miniimage' size='50'>
<p><b>Standard Image:</b></p>
<input type='Text' name='stdimage' maxlength='50' value='$stdimage' size='50'>
<p><b>File name</b></p>
<input type='Text' name='file' maxlength='50' value='$file' size='50'>
<p><b>Reverse Scoring:</b></p>
<br />Must be either 1 or 0. 1 for reverse scoring, 0 for normal scoring.<br /> If you dont know, it should probably be 0.<br />
<input type='Text' name='isreverse' maxlength='1' value='$isreverse' size='1'>
<p><b>Game Category:</b></p>
<select name='categoryid'>
";
$sql="SELECT * FROM `arcade_categories` ORDER BY `displayorder`";
$result=mysql_query($sql);
$catnum = mysql_num_rows($result);
for($i = 0; $i < $catnum; $i++) {
$row = mysql_fetch_array($result);
$catid = $row["catid"];
$catname = $row["catname"];
echo "
<option value='$catid'>$catname</option>
";
}
echo "
</select>
<p>
<input type='Submit' name='submit' value='Submit'></p>
</form>
";
include("footer.php");
}
?>