Jump to content
MakeWebGames

Recommended Posts

Posted
<?php
require "sglobals.php";
//This contains general thingies
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)
  {
     echo '<font color="#FF0000>403 - Unauthorized Access</font>';
     $h->endpage();
     exit;
  }
  if($_POST['TITLE'])
  {
     if(strlen($_POST['TITLE']) < 5)
     {
        echo 'Sorry, the annoucement title is too short.
[url="staff_annouce.php?addannouce"]Back[/url]';
        $h->endpage();
        exit;
     }
     $AddAnnouce = sprintf("INSERT INTO mod_announcements (`annouce_NAME`, `annouce_TEXT`, `annouce_TIME`, `annouce_URGENCY`, `annouce_TOPIC`, `annouce_POSTED`)VALUES ('{$_POST['TITLE']}', '{$_POST['TEXT']}', unix_timestamp(), '{$_POST['URGENCY']}', '{$_POST['TOPIC']}', '{$_POST['POSTED']}')");
     $db->query ($AddAnnouce);

     $db->query("UPDATE users SET `new_announcements` = `new_announcements` + 1");

     echo 'Announcement added!
> [url="annoucements.php"]View It![/url]';
     stafflog_add('Posted A New Annoucement');
     $h->endpage();
     exit;
  }
  else
  {
     echo '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 Title:<input type="text" name="TITLE">




     Announcement Text:

     <textarea name="TEXT" rows="10" cols="60"></textarea>




     Announcement Urgency:
     <select name="URGENCY" type="dropdown">
     <option value="No Ugency">No Ugency</option>
     <option value="Low">Low</option>
     <option value="Medium">Medium</option>
     <option value="High">High</option>
     <option value="Urgent">Urgent</option>
     </select>




     Announcement Topic:
     <select name="TOPIC" type="dropdown">
     <option value="Updates">Updates</option>
     <option value="General News">General News</option>
     <option value="Fun">Fun</option>
     <option value="Warnings!">Warnings!</option>
     <option value="Design Info">Design Info</option>
     <option value="Edits">Edits</option>
     </select>




     <input type="hidden" name="POSTED" value="'.$ir['username'].'">

     <input type="submit" value="Add Announcement!" />
     </form>';
  }
}

 

 

Fatal error: Call to undefined function index() in /home/strats/public_html/staff.php on line 8

Can you figure out the problem?

Posted

Re: Staff.php help

Add at the bottom

<?php // Please remove before saving
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' >
<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' >
<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>";
}

 

For some reason you removed the function without removing the case :|

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...