function __construct($dbc) { global $config; $this->dbc = isset($dbc) ? $dbc : C::connect(); $this->url = C::isLocal() ? $config['page']['local_url'] : $config['page']['server_url']; }
function __construct($arr = null) { C::sessionStart(); //$pageXML = (C::isLocal())?C::getOutsidePath().'aj-db/aj_hfut_page.xml':C::getOutsidePath().'cgi-bin/aj_hfut_page.xml'; $pageXML = C::isLocal() ? 'config/aj_hfut_page.xml' : 'config/aj_hfut_page.xml'; $this->xml = simplexml_load_file($pageXML); $this->url = C::isLocal() ? $this->xml->config->url['local'] : $this->xml->config->url['server']; $this->dbc = C::connect(); $this->arr = isset($arr) ? $arr : null; $this->table = "aj_tumu_users"; }
<?php require_once 'config.php'; require_once 'c.php'; $dbc = C::connect(); $side = C::islocal() ? 'local' : 'server'; $rows = array(); $rows['blog_title'] = ''; $rows['blog_desc'] = ''; $rows['types'] = ''; $rows['blog_stamp'] = ''; $rows['file_content'] = ''; if (isset($_GET['blog_id']) and !isset($_POST['title'])) { $id = (int) $_GET['blog_id']; $query = "SELECT blog_title, blog_desc, blog_file, types, blog_stamp FROM blog WHERE blog_id = " . $id; $result = C::query($query, $dbc); $rows = mysql_fetch_array($result); $rows['file_content'] = file_get_contents('../' . $config['blog']['filename'][$side] . $rows['blog_file'] . '.txt'); } if ($_SERVER['REQUEST_METHOD'] == 'POST' and isset($_POST['title'])) { $title = C::safe($_POST['title'], $dbc); $desc = mysql_real_escape_string($_POST['desc']); $stamp = C::safe($_POST['stamp'], $dbc); $kinds = C::safe($_POST['kinds'], $dbc); $content = $_POST['content']; 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);