コード例 #1
0
function Do_rules_Add()
{
    if (empty($_POST['heading']) || empty($_POST['body']) || strlen($_POST['heading']) > 100) {
        Do_Error("Error", "Field is blank or length too long!");
    }
    $cat_id = (int) $_POST['cat'];
    if (!is_valid_id($cat_id)) {
        Do_Error("Error", "No heading");
    }
    $heading = sqlesc(strip_tags($_POST['heading']));
    $body = sqlesc(strip_tags($_POST['body']));
    $sql = "INSERT INTO rules (cid, heading, body, ctime) VALUES ({$cat_id}, {$heading}, {$body}, UNIX_TIMESTAMP()+(3600*24*3))";
    @mysql_query($sql);
    if (mysql_affected_rows() == -1) {
        stderr("Warning", "Couldn't forefill that request");
    }
    stdhead("Add New heading");
    New_rules_Form(1);
    stdfoot();
    exit;
}
コード例 #2
0
ファイル: rules_admin.php プロジェクト: Bigjoos/U-232-V5
function Show_Cat_Edit_Form()
{
    global $lang, $CURUSER;
    $htmlout = '';
    $maxclass = intval($CURUSER['class']);
    if (!isset($_GET['catid']) || empty($_GET['catid']) || !is_valid_id($_GET['catid'])) {
        $htmlout .= Do_Error("Error", "No Section selected");
    }
    $cat_id = (int) $_GET['catid'];
    $sql = sql_query("SELECT * FROM rules_cat WHERE id = " . sqlesc($cat_id)) or sqlerr(__FILE__, __LINE__);
    if (!mysqli_num_rows($sql)) {
        stderr("SQL Error", "Nothing doing here!");
    }
    $htmlout .= "<table class='table table-bordered table-striped'>\n                <tr>\n                <td class='colhead'>Name</td>\n                <td class='colhead'>Shortcut</td>\n                <td class='colhead'>Min Class</td></tr>";
    while ($row = mysqli_fetch_assoc($sql)) {
        $htmlout .= "<h2>Title No." . intval($row['id']) . "</h2>\n        <form name='inputform' method='post' action='staffpanel.php?tool=rules_admin'>\n        <input type='hidden' name='mode' value='takeedit_cat' />\n        <input type='hidden' name='cat' value='" . intval($row['id']) . "' />\n        <tr><td><input type='text' value='" . htmlsafechars($row['name']) . "' name='name' style='width:380px;' /></td>\n        <td><input type='text' value='" . htmlsafechars($row['shortcut']) . "' name='shortcut' style='width:380px;' /></td>\n\n        <td><select name='min_view'>";
        for ($i = 0; $i <= $maxclass; ++$i) {
            $htmlout .= '<option value="' . $i . '"' . ($row['min_view'] == $i ? " selected='selected'" : "") . '">' . get_user_class_name($i) . '</option>';
        }
        $htmlout .= "</select></td>\n        <td colspan='4'><input type='submit' name='submit' value='Edit' class='button' /></td>\n        </tr></form>";
    }
    $htmlout .= "</table>";
    echo stdhead("Edit options") . $htmlout . stdfoot();
    exit;
}
コード例 #3
0
ファイル: faqadmin.php プロジェクト: ZenoX2012/CyBerFuN-CoDeX
function Do_Faq_Add()
{
    if (empty($_POST['question']) || empty($_POST['Answer']) || strlen($_POST['question']) > 100) {
        Do_Error("Error", "Field is blank or length too long!");
    }
    $cat_id = (int) $_POST['cat'];
    if (!is_valid_id($cat_id)) {
        Do_Error("Error", "No category");
    }
    $question = sqlesc(strip_tags($_POST['question']));
    $answer = sqlesc(strip_tags($_POST['Answer']));
    $sql = "INSERT INTO faq (cid, question, answer, ctime) VALUES ({$cat_id}, {$question}, {$answer}, UNIX_TIMESTAMP()+(3600*24*3))";
    @sql_query($sql);
    if (mysql_affected_rows() == -1) {
        stderr("Warning", "Couldn't forefill that request");
    }
    stdhead("Add New Category");
    New_Faq_Form(1);
    stdfoot();
    exit;
}