Example #1
0
 public function insertIntoSQL($name, $content)
 {
     global $config;
     $table = C::isLocal() ? $config['message']['local_table'] : $config['message']['table'];
     $query = sprintf("INSERT INTO %s (message_name,message_content)VALUES\n\t\t\t\t\t\t('%s','%s')", $table, $name, $content);
     if (C::query($query, $this->dbc)) {
         return array('isok' => '1', 'info' => '');
     } else {
         return array('isok' => '0', 'info' => $table . '--' . $query . '--' . mysql_error($this->dbc), 'info2' => $this->dbc);
     }
 }
Example #2
0
 public function getPageByXueshuId($id)
 {
     $back = '';
     $query = sprintf("SELECT xueshu_id,huida_id,user_id,kinds,title,content,huida,filename,UNIX_TIMESTAMP(date_entered) AS time\n\t\t\t\tFROM %s WHERE xueshu_id = %d ", $this->table, $id);
     $result = C::query($query, $this->dbc);
     if ($result) {
         if (mysql_num_rows($result) > 0) {
             $rows = mysql_fetch_array($result);
             $back .= $this->wrapXueshu($rows);
             $query = sprintf("SELECT xueshu_id,huida_id,user_id,kinds,title,content,huida,filename,UNIX_TIMESTAMP(date_entered) AS time\n\t\t\t\tFROM %s WHERE huida_id = %d ORDER BY date_entered DESC", $this->table, $id);
             $result = C::query($query, $this->dbc);
             if (mysql_num_rows($result) > 0) {
                 $back .= "<h2>全部回复</h2>";
                 while ($rows2 = mysql_fetch_array($result)) {
                     $back .= $this->wrapXueshu($rows2);
                 }
             } else {
                 $back .= "<h2>还木有人回复这个帖子~</h2>";
             }
             $back .= $this->getXueshuHuidaArea($rows);
         } else {
             $back .= "<h2>Not found!</h2>";
         }
     } else {
         $back .= "<h2>Not found!</h2>";
     }
     return $back;
 }
Example #3
0
    if (isset($_GET['blog_id'])) {
        $blog_id = (int) $_GET['blog_id'];
        $query = sprintf("UPDATE blog SET blog_title = '%s', blog_desc = '%s',types='%s', blog_stamp='%s' \n\t\t\t\t\t\t\tWHERE blog_id = %d ", $title, $desc, $kinds, $stamp, $blog_id);
        if (C::query($query, $dbc)) {
            $query = "SELECT blog_file FROM blog WHERE blog_id = " . $blog_id;
            $result = C::query($query, $dbc);
            $rows = mysql_fetch_array($result);
            if (file_put_contents('../' . $config['blog']['filename'][$side] . $rows['blog_file'] . '.txt', $content)) {
                echo json_encode(array('isok' => '1', 'info' => ''));
            }
        }
    } else {
        $file = sha1(uniqid());
        file_put_contents('../' . $config['blog']['filename'][$side] . $file . '.txt', $content);
        $query = sprintf("INSERT INTO blog (blog_title,blog_desc,blog_file,types,blog_stamp) VALUES (\n\t\t\t\t\t\t\t'%s','%s','%s','%s','%s')", $title, $desc, $file, $kinds, $stamp);
        if (C::query($query, $dbc)) {
            echo json_encode(array('isok' => '1', 'info' => ''));
        } else {
            echo json_encode(array('isok' => '0', 'info' => mysql_error($dbc)));
        }
    }
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset='UTF-8' />
	<title>Upload</title>
	<style>
		textarea{