Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
function Do_Faq_Add()
{
    global $lang, $mc1;
    $cat_id = sqlesc(intval($_POST['cat']));
    if (!is_valid_id($cat_id)) {
        stderr("Error", "No id");
    }
    if (empty($_POST['title']) || empty($_POST['text']) || strlen($_POST['title']) > 100) {
        stderr("Error", "Field is blank or length too long! <a href='staffpanel.php?tool=faq_admin'>Go Back</a>");
    }
    $title = sqlesc(strip_tags($_POST['title']));
    $text = sqlesc($_POST['text']);
    $sql = "INSERT INTO faq (type, title, text) VALUES ({$cat_id}, {$title}, {$text})";
    sql_query($sql) or sqlerr(__FILE__, __LINE__);
    if (mysqli_affected_rows($GLOBALS["___mysqli_ston"]) == -1) {
        stderr("Warning", "Couldn't complete that request");
    }
    $mc1->delete_value('faqs__');
    New_Faq_Form(1);
    exit;
}