<?php

/* TODO: Add code here */
require_once '../lib/global.php';
$conn = new DbHelper("pg_newsclass");
$id = $_GET['id'];
$type = $_GET['type'];
$name = mysql_escape_string(stripslashes($_GET['name']));
if ($_GET['type'] == 1) {
    $conn->update($id, "name='{$name}'");
}
if ($_GET['type'] == 2) {
    if ($conn->delete($id) > 0) {
        echo "true";
    } else {
        echo "false";
    }
}
if ($_GET['type'] == 3) {
    $conn->insert('name', "'{$name}'");
}
echo "OK!";
echo "<script type='text/javascript' src='../js/common.js'></script><script>GotoOtherPage('EditNewsType.php','游戏类型修改成功!')</script>";
Exemplo n.º 2
0
<?php

/* TODO: Add code here */
require_once '../lib/global.php';
$content = mysql_escape_string(stripslashes($_POST['FCKeditor1']));
$title = mysql_escape_string(stripslashes($_POST['title']));
$author = mysql_escape_string(stripslashes($_POST['author']));
$clazz = mysql_escape_string(stripslashes($_POST['clazz']));
$tags = mysql_escape_string(stripslashes($_POST['tag']));
$clicktimes = mysql_escape_string(0);
$commentnum = mysql_escape_string(0);
$scores = mysql_escape_string(0);
$addtime = mysql_escape_string(date("Y-m-d H:i:s"));
$picurl = mysql_escape_string('testurl');
$id = mysql_escape_string(stripslashes($_POST['id']));
$conn = new DbHelper('pg_news');
$conn->update($id, "title='{$title}',content='{$content}',classid='{$clazz}',date='{$addtime}',\r\n\t\t\t\tpicurl='{$picurl}',tags='{$tags}',author='{$author}',clicktimes='{$clicktimes}',commentnum='{$commentnum}',scores='{$scores}'");
echo "OK!";
echo "<script type='text/javascript' src='../js/common.js'></script><script>GotoOtherPage('editnews.php?id={$id}','新闻修改成功!')</script>";