case 'othpost': $text = $_POST['text']; $link = $_POST['link']; if ($id == 'social' || $id == 'contact' || $id == 'links') { mysql_query("INSERT INTO " . $db_prefix . "other\n (link, text, type)\n VALUES ('{$link}', '{$text}', '{$id}')", $con); $id = mysql_insert_id($con); $add = true; } else { mysql_query("UPDATE " . $db_prefix . "other\n SET link='{$link}', text='{$text}'\n WHERE id={$id}", $con); } $result = mysql_query("SELECT * FROM " . $db_prefix . "other WHERE id={$id}", $con); while ($row = mysql_fetch_array($result)) { if ($add) { echo "<li id=\"oth{$id}\">"; } formatOther($row); if ($add) { echo "</li>"; } } break; case 'othdel': mysql_query("DELETE FROM " . $db_prefix . "other WHERE id={$id}"); echo "<i>Item Removed</i>"; break; case 'comdel': mysql_query("DELETE FROM " . $db_prefix . "comments WHERE id={$id}"); echo "<i>Item Removed</i>"; break; } }
function adminOther() { global $con; global $db_prefix; sqlcon(); ?> <h2>Links</h2> <?php $types = array('links'); for ($j = 0; $j < count($types); $j++) { $type = $types[$j]; echo "<ul id=\"oth{$type}" . "list\">"; $result = mysql_query("SELECT * FROM " . $db_prefix . "other WHERE type='{$type}'", $con); while ($row = mysql_fetch_array($result)) { echo "<li id=\"oth" . $row['id'] . "\">"; formatOther($row); echo "</li>\n"; } echo "</ul>"; echo "<div id=\"oth{$type}\"><button type=\"button\" onClick=\"editOth('{$type}')\">Add New Item</button></div>"; echo "<br/>"; } }