Need UberCMS PHP Help

Pekka

New Member
Jun 22, 2012
6
0
So I pretty much ripped the whole code off the userlookup and made it so it shows rooms and so you can edit the room and etc, but it seems to function properly except when I edit it, it wont update when I click update, can someone review the code and see what's missing and how to fix it, I would appreciate any kind or form of help, thanks!

PHP:
<?php
if (!defined('IN_HK') || !IN_HK)
{
    exit;
}
 
if (!HK_LOGGED_IN || !$users->hasFuse(USER_ID, 'fuse_housekeeping_moderation'))
{
    exit;
}
 
$roomid = '';
 
if (isset($_POST['room'])) { $roomid = filter($_POST['room']); }
require_once "top.php";           
 
echo("<h1>Room Lookup</h1>
<br /><p>This tool can be used for looking up and editing a room!</p>");
echo '<br />
<form method="post">Room ID:<br />
<input type="text" name="room"><Br />
<input type="submit" value="Lookup">
</form>';
if (isset($roomid))
{
if (!@$_POST['update'])
{
$rooms = mysql_query("SELECT * from rooms where id = '$roomid'");
$room = mysql_fetch_array($rooms);
echo("<div align=\"center\"><form method=\"POST\">
<table width=\"100%\">
 
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Room ID:</b>
</td>
<td align=\"left\">
$room[id]
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Owner:</b>
</td>
<td align=\"left\">
$room[owner]
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Room Type:</b>
</td>
<td align=\"left\">
$room[roomtype]
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Room Name:</b>
</td>
<td align=\"left\">
<input  name=\"caption\"
value=\"$room[caption]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Room Description:</b>
</td>
<td align=\"left\">
<input  name=\"description\"
value=\"$room[description]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Room Category:</b>
</td>
<td align=\"left\">
<input  name=\"category\"
value=\"$room[category]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Room State:</b>
</td>
<td align=\"left\">
<select  name=\"state\"
value=\"$room[state]\">
<option>$room[state]</option>
<option>locked</option>
  <option>password</option>
  <option>open</option>
</select
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Password of room if passworded:</b>
</td>
<td align=\"left\">
<input  name=\"password\"
value=\"$room[password]\">
</td>
</tr>
 
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Room Model:</b>
</td>
<td align=\"left\">
<input  name=\"model_name\"
value=\"$room[model_name]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Users currently inside:</b>
</td>
<td align=\"left\">
$room[users_now]
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Max Users:</b>
</td>
<td align=\"left\">
<input  name=\"users_max\"
value=\"$room[users_max]\">
</td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>Score:</b>
</td>
<td align=\"left\">
<input  name=\"score\"
value=\"$room[score]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Tags:</b>
</td>
<td align=\"left\">
<input  name=\"tags\"
value=\"$room[tags]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Pets Allowed:</b>
</td>
<td align=\"left\">
<input  name=\"allow_pets\"
value=\"$room[allow_pets]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Allow Pets to Freeload:</b>
</td>
<td align=\"left\">
<input  name=\"allow_pets_eat\"
value=\"$room[allow_pets_eat]\">
</td>
</tr>
 
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Blocking Disabled:</b>
</td>
<td align=\"left\">
<input  name=\"allow_walkthrough\"
value=\"$room[allow_walkthrough]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Wall is Hidden:</b>
</td>
<td align=\"left\">
<input  name=\"allow_hidewall\"
value=\"$room[allow_hidewall]\">
</td>
</tr>
 
<tr>
<td align=\"right\" width=\"25%\">
<b>Achievement:</b>
</td>
<td align=\"left\">
<input  name=\"achievement\"
value=\"$room[achievement]\">
</td>
</tr>
<tr>
<td align=\"center\">
</td>
<td align=\"left\">
<input type=\"submit\" name=\"update\" value=\"Update\"></td>
</tr>
</table>
</form>
</div>");
}
else
{
 
$caption = htmlspecialchars($_POST['caption']);
$description = htmlspecialchars($_POST['description']);
$state = htmlspecialchars($_POST['state']);
$model_name = htmlspecialchars($_POST['model_name']);
$category = htmlspecialchars($_POST['category']);
$users_max = htmlspecialchars($_POST['users_max']);
$score = htmlspecialchars($_POST['score']);
$tags = htmlspecialchars($_POST['tags']);
$allow_pets = htmlspecialchars($_POST['allow_pets']);
$allow_pets_eat = htmlspecialchars($_POST['allow_pets_eat']);
$allow_walkthrough = htmlspecialchars($_POST['allow_walkthrough']);
$allow_hidewall = htmlspecialchars($_POST['allow_hidewall']);
$achievement = htmlspecialchars($_POST['achievement']);
echo ("<br /><br />Room ID .'&room[id]'. has been updated.");
$update = mysql_query("Update rooms set caption = '$caption', description = '$description', state = '$state', model_name = '$model_name', category = '$category', users_max = '$users_max', score = '$score', tags = '$tags', allow_pets = '$allow_pets', allow_pets_eat = '$allow_pets_eat', allow_walkthrough = '$allow_walkthrough', allow_hidewall = '$allow_hidewall', achievement = '$achievement', achievement = '$achievement' where id = '$roomid'");
}
}
require_once "bottom.php";
?>
 

Users who are viewing this thread

Top