Re: mccodes error
<?php
include "sglobals.php";
switch($_GET['action'])
{
case 'basicset': basicsettings(); break;
case 'announce': announcements(); break;
default: index(); break;
}
function basicsettings()
{
global $db,$ir,$c,$h,$userid,$set;
if($ir['user_level'] != 2)
{
die("403");
}
if($_POST['submit'])
{
unset($_POST['submit']);
foreach($_POST as $k => $v)
{
$db->query("UPDATE `settings` SET conf_value='$v' WHERE conf_name='$k'");
}
print "Settings updated!
[url='staff.php?action=basicset']Back[/url]";
stafflog_add("Updated the basic game settings");
}
else
{
print "<h3>Basic Settings</h3><hr />
<form action='staff.php?action=basicset' method='post'>
<input type='hidden' name='submit' value='1' />
Game Name: <input type='text' name='game_name' value='{$set['game_name']}' />
Game Owner: <input type='text' name='game_owner' value='{$set['game_owner']}' />
Game Description:
<textarea rows='7' cols='50' name='game_description'>{$set['game_description']}</textarea>
Paypal Address: <input type='text' name='paypal' value='{$set['paypal']}' />
Gym/Crimes Validation: <select name='validate_on' type='dropdown'>";
$opt=array(
"1" => "On",
"0" => "Off"
);
foreach($opt as $k => $v)
{
if($k == $set['validate_on'])
{
print "<option value='{$k}' selected='selected'>{$v}</option>";
}
else
{
print "<option value='{$k}'>{$v}</option>";
}
}
print "</select>
Validation Period: <select name='validate_period' type='dropdown'>";
$opt=array(
"5" => "Every 5 Minutes",
"15" => "Every 15 Minutes",
"60" => "Every Hour",
"login" => "Every Login"
);
foreach($opt as $k => $v)
{
if($k == $set['validate_period'])
{
print "<option value='{$k}' selected='selected'>{$v}</option>";
}
else
{
print "<option value='{$k}'>{$v}</option>";
}
}
print "</select>
Registration CAPTCHA: <select name='regcap_on' type='dropdown'>";
$opt=array(
"1" => "On",
"0" => "Off"
);
foreach($opt as $k => $v)
{
if($k == $set['regcap_on'])
{
print "<option value='{$k}' selected='selected'>{$v}</option>";
}
else
{
print "<option value='{$k}'>{$v}</option>";
}
}
print "</select>
Send Crystals: <select name='sendcrys_on' type='dropdown'>";
$opt=array(
"1" => "On",
"0" => "Off"
);
foreach($opt as $k => $v)
{
if($k == $set['sendcrys_on'])
{
print "<option value='{$k}' selected='selected'>{$v}</option>";
}
else
{
print "<option value='{$k}'>{$v}</option>";
}
}
print "</select>
Bank Xfers: <select name='sendbank_on' type='dropdown'>";
$opt=array(
"1" => "On",
"0" => "Off"
);
foreach($opt as $k => $v)
{
if($k == $set['sendbank_on'])
{
print "<option value='{$k}' selected='selected'>{$v}</option>";
}
else
{
print "<option value='{$k}'>{$v}</option>";
}
}
print "</select>
Energy Refill Price (crystals): <input type='text' name='ct_refillprice' value='{$set['ct_refillprice']}' />
IQ per crystal: <input type='text' name='ct_iqpercrys' value='{$set['ct_iqpercrys']}' />
Money per crystal: <input type='text' name='ct_moneypercrys' value='{$set['ct_moneypercrys']}' />
Will Potion Item: ".item_dropdown($c, "willp_item", $set['willp_item'])."
<input type='submit' value='Update Settings' /></form>";
}
}
function announcements()
{
global $db,$ir,$c,$h,$userid,$set;
if($ir['user_level'] != 2)
{
die("403");
}
if($_POST['text'])
{
$db->query("INSERT INTO announcements VALUES('{$_POST['text']}', unix_timestamp())");
$db->query("UPDATE users SET new_announcements=new_announcements+1");
print "Announcement added!
> [url='staff.php']Back[/url]";
stafflog_add("Added a new announcement");
}
else
{
print "Adding an announcement...
Please try to make sure the announcement is concise and covers everything you want it to.<form action='staff.php?action=announce' method='post'>
Announcement text:
<textarea name='text' rows='10' cols='60'></textarea>
<input type='submit' value='Add Announcement' /></form>";
}
}
function index()
{
global $db,$ir,$c,$h,$userid,$set, $_CONFIG;
$pv=phpversion();
$mv=$db->fetch_single($db->query("SELECT VERSION()"));
$dv=$_CONFIG['driver'];
if($ir['user_level']==2)
{
$versionno=20200;
$version="2.0.2";
print "<h3>System Info</h3><hr />
<table width='75%' cellspacing='1' class='table'>
<tr>
<th>PHP Version:</th>
<td>$pv</td>
</tr>
<tr>
<th>MySQL Version:</th>
<td>$mv</td>
</tr>
<tr>
<th>MySQL Driver:</th>
<td>$dv</td>
</tr>
<tr>
<th>Codes Version</th>
<td>$version (Build: $versionno)</td>
</tr>
</table><hr />
<h3>Last 10 Staff Actions</h3><hr />
<table width='100%' cellspacing='1' class='table'>
<tr>
<th>Staff</th>
<th>Action</th>
<th>Time</th>
<th>IP</th>
</tr>";
$q=$db->query("SELECT s.*, u.* FROM stafflog AS s LEFT JOIN users AS u ON s.user=u.userid ORDER BY s.time DESC LIMIT 10");
while($r=$db->fetch_row($q))
{
print "<tr><td>{$r['username']} [{$r['user']}]</td> <td>{$r['action']}</td> <td>".date('F j Y g:i:s a', $r['time'])."</td> <td>{$r['ip']}</td></tr>";
}
print "</table><hr />";
}
print "<h3>Staff Notepad</h3><hr />";
if($_POST['pad'])
{
$db->query("UPDATE settings SET conf_value='{$_POST['pad']}' WHERE conf_name='staff_pad'");
$set['staff_pad']=stripslashes($_POST['pad']);
print "[b]Staff Notepad Updated![/b]<hr />";
}
print "<form action='staff.php' method='post'>
<textarea rows='10' cols='60' name='pad'>".htmlspecialchars($set['staff_pad'])."</textarea>
<input type='submit' value='Update Notepad' /></form>";
}
$h->endpage();
?>