function buildQuery() { // check if query is set if (empty($this->query)) { $this->error = ' NO QUERY SET '; $this->rQuery = false; } // check the mysql object if (!is_a($this->mysqlOBJ, 'mysql')) { $this->error = ' NO MYSQL OBJECT SET '; $this->rQuery = false; } // check the numbers of pages $objDb = new db(); //echo $this->query ; //echo "<br>"; $this->result = $objDb->ExecuteQuery($this->query); $this->totalRows = mysql_num_rows($this->result); if ($this->result !== false) { //$this->totalRows=$this->mysqlOBJ->num_rows; $this->totalPages = ceil($this->totalRows / $this->maxpage); } else { $this->error = ' ERROR EXECUTING QUERY '; $this->rQuery = false; } //echo "<br>"; //echo $this->totalPages ; if ($this->totalRows <= $this->maxpage) { $this->rQuery = $this->query; } else { $this->cPage = $this->cPage <= $this->totalPages ? $this->cPage : '1'; $limit = " LIMIT " . ($this->cPage - 1) * $this->maxpage . "," . $this->maxpage; $this->rQuery = $this->query . $limit; } }
function authenticate($U, $P, $recordar = 0, $by = 'usuario') { $RESULT = false; if (trim($U) != '' && trim($P) != '') { $db = new db(); $db->connect(); $sql = ' SELECT * FROM usuarios WHERE ( ' . $by . ' = "' . mysql_real_escape_string($U) . '" ) AND ( password = "******" ) '; $db->query($sql); // no existe $RESULT = false; while ($record = $db->next()) { // LOGEAR $this->creaSession($record); $RESULT = true; if ($recordar) { $two_months = time() + 30 * 24 * 3600; setcookie('id_usuario', $U, $two_months); setcookie('contrasena', $P, $two_months); } } $db->close(); } return $RESULT; }
function login2($user, $pass) { $con = new db(); $conc = $con->c(); $kcook = intval($_POST["remember"]); $q = mysqli_query($conc, "SELECT `id`,`user`,`name`,`email`,`img1`,`img2`,`img3`,`bgcolor` FROM `users` WHERE (`user` = '{$user}' OR `email` ='{$user}') AND pass = '******'"); if (mysqli_num_rows($q) == 1) { $r = mysqli_fetch_array($q); setcookie("u", $r[1], time() + 52 * 60 * 60 * 24 * 7, "/"); $_SESSION["uid"] = $r[0]; $_SESSION["user"] = $r[1]; $_SESSION["name"] = $r[2]; $_SESSION["email"] = $r[3]; $_SESSION["p"] = $pass; $_SESSION["color"] = $r[7]; $_SESSION["img1"] = $r[4]; $_SESSION["img2"] = $r[5]; $_SESSION["img3"] = $r[6]; $_SESSION["ula"] = md5("{$r['1']} {$pass} {$r['0']}"); $con->close_db_con($conc); if (!valid_name($_SESSION["user"])) { $_SESSION["set_user"] = "******"; header("location: ./?settings"); } else { if ($kcook == 1) { setcookie("um", $r[1], time() + 52 * 60 * 60 * 24 * 7, "/"); setcookie("pm", $pass, time() + 52 * 60 * 60 * 24 * 7, "/"); } return true; } } else { return false; } }
function add_youtube_video() { global $config; require_once $config["path_to_default_site_module"] . "/models/db.php"; require_once $config["path_to_default_site_module"] . "/models/video.php"; $ch = curl_init("https://gdata.youtube.com/feeds/api/videos/-/preachcaster?alt=json"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $json_string_data = curl_exec($ch); curl_close($ch); $video_data = json_decode($json_string_data, true); $db_conn = new db($config["db_connection"]); $db_resource = $db_conn->get_resource(); $video = new Video($db_resource); foreach ($video_data["feed"]["entry"] as $single_video) { //parse out ID $tmp_array = explode("/", $single_video["id"]['$t']); $video_id = $tmp_array[count($tmp_array) - 1]; //rxBS1E0KZQU //CQzUsTFqtW0 $video_params = array("video_id" => $video_id, "author" => $single_video["author"][0]["name"]['$t'], "title" => $single_video["title"]['$t'], "description" => $single_video["content"]['$t'], "date_recorded" => isset($single_video['yt$recorded']) ? $single_video['yt$recorded']['$t'] : null, "location" => isset($single_video['yt$location']) ? $single_video['yt$location']['$t'] : null, "url" => isset($single_video['media$group']['media$player']) ? $single_video['media$group']['media$player'][0]["url"] : null, "duration" => isset($single_video['media$group']['yt$duration']) ? $single_video['media$group']['yt$duration']["seconds"] : null, "comment_url" => isset($single_video['gd$comments']) && isset($single_video['gd$comments']['gd$feedLink']) ? $single_video['gd$comments']['gd$feedLink']["href"] : null, "thumbnails" => isset($single_video['media$group']) && isset($single_video['media$group']['media$thumbnail']) ? $single_video['media$group']['media$thumbnail'] : null); $video->add_video($video_params, "YouTube"); } die("here"); }
function getEventById($id) { $db = new db(EZSQL_DB_USER, EZSQL_DB_PASSWORD, EZSQL_DB_NAME, EZSQL_DB_HOST); $evVal = $db->get_row("select * from events where event_id=" . $id); $ev = getEventFromTable($evVal); return $ev; }
function snippetsOptions() { $db = new db(); $log = ADLog::getInstance(); /* * Extract all snippets for select list below */ $q = "SELECT id, snippetName\n\t\t\t\t\t\tFROM snippets \n\t\t\t\t\t\tORDER BY snippetName ASC"; $result = $db->q($q); $num_rows = mysql_numrows($result); if (!$result || $num_rows < 0) { $log->Warn("Failure: Problem Displaying snippetsOptions() options (File: " . $_SERVER['PHP_SELF'] . ")"); echo "Error displaying info for reportsOptions() function"; return; } if ($num_rows == 0) { $log->Warn("Failure: Problem Displaying snippetsOptions() - no options returned (File: " . $_SERVER['PHP_SELF'] . ")"); echo "Database table empty"; return; } for ($i = 0; $i < $num_rows; $i++) { $id = mysql_result($result, $i, "id"); $snippetName = mysql_result($result, $i, "snippetName"); echo "<option value=snippetId-" . $id . ">" . $snippetName . "</option>"; } }
function AuthFuncCheckUserSignup($username, $password) { $password = UtilFuncEncryptUserPassword($password); $db = new db(); $userid = $db->Ins('user', array('username' => $username, 'password' => $password)); return @$userid; }
function render($layout, $array, $output = "backend") { if ($output == "backend") { $extensions = new extensions(); $active = explode('/', $_SERVER['REQUEST_URI']); $activeDupe = $active; $active = isset($active[2]) ? $active[2] : false; if (strpos($active, "?") !== false) { $active = explode('?', $active)[0]; } if ($active == "extension") { $active = isset($activeDupe[3]) ? $activeDupe[3] : $active; } $array['activePage'] = strtolower($active); $array['extensions'] = $extensions->listAll(false); echo $this->backend->render("component/" . $layout . ".twig", $array); } else { $db = new db("variables"); $config = new config(); $array['config'] = $config->system->evany; $array['variables'] = $db->all(); if (strpos($layout, ".twig") !== FALSE) { $layout = $layout; } else { $layout = $layout . ".twig"; } return $this->frontend->render($layout, $array); } }
/** * Method to return the status of the AJAX transaction * * @return string A string of raw HTML fetched from the Server */ function return_response() { $db = new db(EZSQL_DB_USER, EZSQL_DB_PASSWORD, EZSQL_DB_NAME, EZSQL_DB_HOST); //$queryVars = sanitize($queryVars); $sTimeStr = $this->queryVars['st']; $eTimeStr = $this->queryVars['et']; $evName = $this->queryVars['eventName']; // Sanitize event name $evName = filter_var($evName, FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW); $desc = $this->queryVars['desc']; // Sanitize event description $desc = filter_var($desc, FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW); $allDayIndicator = $this->queryVars['allDay']; $groupId = $this->queryVars['groupId']; $db->query("insert into events(event_name,event_description, calendar_id, all_day, start_time, end_time) VALUES ('" . $evName . "', '" . $desc . "', '" . $groupId . "', " . $allDayIndicator . ", '" . $sTimeStr . "', '" . $eTimeStr . "')"); $input = array(); $input['eventName'] = $evName; $input['eventDesc'] = $desc; $input['group']['groupId'] = $groupId; if ($allDayIndicator == 0) { $input['allDay'] = false; } else { $input['allDay'] = true; } $input['eventId'] = $db->insertedId; $input['startTime'] = $sTimeStr; $input['endTime'] = $eTimeStr; return $input; }
public function SupprimerUtilisateur($id) { $rq = "DELETE FROM " . SCHEMA . ".UTILISATEURS_OSI WHERE ID=" . $id; $SCHEMA = new db(); $SCHEMA->db_connect(); $SCHEMA->db_query($rq); }
function doLogin($usu_login, $usu_senha) { $db = new db("../config.php"); $json = new Services_JSON(); $db->executa($db->getJoinRecord("funcionarios", "fun_nome='{$usu_login}' and fun_senha='{$usu_senha}'", '', 0), true, "user"); if ($db->num_rows == 1) { $id = $db->user["usu_id"]; $login = $db->user["usu_login"]; $itens = array("usu_id" => $id, "usu_login" => $login, "status" => 1); $str = $json->encode($itens); session_register("usu_nome"); session_register("usu_id"); $_SESSION["usu_modulo"] = 0; $_SESSION["usu_nome"] = $db->user["fun_nome"]; $_SESSION["usu_id"] = $db->user["fun_id"]; $_SESSION["sis_exerc"] = $exercicio; $_SESSION["usu_grpid"] = $grp_id; $_SESSION["bgcolor"] = "#EAE5DA"; $_SESSION["dtatend"] = date("d/m/Y"); if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $ip = $HTTP_SERVER_VARS['REMOTE_ADDR']; } } else { $itens = array("usu_id" => '', "usu_login" => $_GET["usu_login"], "status" => 2); $str = $json->encode($itens); } return $str; }
public function testGetUserById() { print_r($this->db->getUserById(1)); $id = 1; $this->assertFalse($this->db->getUserById(99)); $this->assertEquals('Andrew', $this->db->getUserById(1)); }
function add($postArray) { if (User::isAdmin()) { $bm = BandMember::get($postArray['member_id']); } else { $uo = User::getCurrent(); $bm = BandMember::getByUserID($uo->getID()); } if (db::isError($bm)) { return $bm; } $db = new db(); $member_id = $bm->getID(); $title = $db->sanitize_to_db($postArray['title']); $_dt = strtotime($postArray['date']); $dt = date('Y-m-d', $_dt) . ' ' . $postArray['time']; $dateTime = date("Y-m-d H:i:s", strtotime($dt)); $body = $db->sanitize_to_db($postArray['body']); if (!$title) { $title = '(untitled)'; } $r = @mysql_query("insert into Band_Diaries (title, member_id, date_time, body, is_active) values ('{$title}','{$member_id}','{$dateTime}','{$body}'," . DEFAULT_ACTIVE . ")"); if (!$r) { return Error::MySQL(); } else { $bd = BandMemberDiary::get(mysql_insert_id()); return $bd; } }
/** * Method to return the status of the AJAX transaction * * @return string A string of raw HTML fetched from the Server */ function return_response() { $db = new db(EZSQL_DB_USER, EZSQL_DB_PASSWORD, EZSQL_DB_NAME, EZSQL_DB_HOST); $allday = $this->queryVars['allDay']; $sTime = $this->queryVars['st']; $eTime = $this->queryVars['et']; $evName = $this->queryVars['eventName']; // Sanitize event name $evName = filter_var($evName, FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW); $desc = $this->queryVars['desc']; // Sanitize event description $desc = filter_var($desc, FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW); $allDayIndicator = $this->queryVars['allDay']; $eventId = $this->queryVars['eventId']; $groupId = $this->queryVars['groupId']; $input = array(); $input['eventId'] = $eventId; $input['startTime'] = $sTime; $input['endTime'] = $eTime; $input['allDay'] = $allday == 1 ? true : false; $input['group']['groupId'] = $groupId; $input['eventId'] = $eventId; //echo ($sTime."===".$eTime."update events set start_time='".$sTime."', end_time='".$eTime."', event_name='".$evName."',event_description='".$desc."', calendar_id='".$groupId."', all_day='".$allDayIndicator."' where event_id=".$eventId); $db->query("update events set start_time='" . $sTime . "', end_time='" . $eTime . "', event_name='" . $evName . "',event_description='" . $desc . "', calendar_id='" . $groupId . "', all_day='" . $allDayIndicator . "' where event_id=" . $eventId); $input['eventName'] = $evName; $input['eventDesc'] = $desc; return $input; }
function handle() { //$storage = new JingdongStorageService(accesskey, secrectkey); /* $fileName = uniqid().'.mobi'; $filePath = 'tmp/' + $fileName; $fp = fopen($filePath, 'wb+'); if($fp){ $storage->get_object(bookbucket,$this->bid,$fp, false); } else echo 'error'; */ $filePath = './jae/' . $this->bid; if (!file_exists($filePath)) { download($this->bid); } $fp = fopen($filePath, 'r'); Header("Content-type: application/octet-stream"); Header("Accept-Ranges: bytes"); Header("Accept-Length: " . filesize($filePath)); Header("Content-Disposition: attachment; filename=" . $this->bid); echo fread($fp, filesize($filePath)); fclose($fp); if (isset($_SESSION['email'])) { $email = $_SESSION['email']; $db = new db(); $db->addDownload($email, $this->bid, '下载', '成功'); } }
public function SelectAppliSearch($name, $enseigne, $irt, $trigramme) { $tabParam = array(); if ($name) { $tabParam['libelle'] = $name; } if ($enseigne) { $tabParam['enseigne'] = $enseigne; } if ($irt) { $tabParam['irt'] = $irt; } if ($trigramme) { $tabParam['trigramme'] = $trigramme; } $rq = "SELECT ID,LIBELLE,ENSEIGNE,IRT,TRIGRAMME FROM " . SCHEMA . ".APPLICATION "; $rq .= "WHERE "; $l = 1; foreach ($tabParam as $key => $value) { $or = $l != count($tabParam) ? " AND" : ""; $rq .= "UPPER(REPLACE({$key},' ','')) LIKE '%" . strtoupper(str_replace(' ', '', $value)) . "%' " . $or; $l++; } $rq .= " ORDER BY NAME"; $db = new db(); $db->db_connect(); $db->db_query($rq); $res = $db->db_fetch_array(); return $res; }
private function install() { global $db_config; if (is_array($db_config)) { redirect("/"); } $param['writable'] = file_put_contents(APP . 'writable.tmp', 'test'); if (isset($_POST['db_type'])) { $db_type = $_POST['db_type'] == 'sqlite' ? 'sqlite' : 'mysql'; $_POST['default_db'] = $db_type == 'sqlite' ? rand(100000, 999999) . '.sqlite' : $_POST['default_db']; // $cname = 'db_'.$db_type; $db = new db($_POST); $sql = file_get_contents(APP . $db_type . '_ins.sql'); $db->muti_query($sql); $base_dir = rtrim($_POST['base_dir'], '/') . '/'; $seed = randstr(); file_put_contents(APP . 'config_user.php', '<? define(\'BASE\',\'?/\'); define(\'SEED\',\'' . $seed . '\'); $db_config = array( \'host\' =>\'' . $_POST['host'] . '\', \'user\' =>\'' . $_POST['user'] . '\', \'password\' =>\'' . $_POST['password'] . '\', \'db_type\' =>\'' . $_POST['db_type'] . '\', \'default_db\'=>\'' . $_POST['default_db'] . '\' );'); redirect($_POST['base_dir'], '安装成功', '用户名 admin@b24.cn 密码 admin', '8'); } else { header("Content-type: text/html; charset=utf-8"); $base = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']); view("v/home/install", $param); } }
function username($id) { $username = new db(); $username->query("select name from accounts where id = '{$id}'"); $username->fetch(); return $username->element("name"); }
function test_quitar_item() { $compra = new compras(); $db1 = new db(); $resultado = $db1->consulta(7); $this->assertEquals($resultado - 1, $compra->quitar_inventario(7)); }
function first_login($userid) { $db = new db(); $query = $db->query("SELECT first_login from users WHERE user_id = '{$userid}'"); $row = $query->fetch_array(); return $row[0] == 0; }
function __construct($rule = 0, $permission = null) { // test to make sure that access code is legit $REQUEST = new Request(); $OUTPUT = new Output(); if ($REQUEST->avail("access_token")) { $access_token = $REQUEST->get("access_token"); $DB = new db("System"); $clientInfo = $DB->selectCollection("Accounts"); $this->client_doc = $clientInfo->findOne(array("system_info.access_token" => $access_token)); if ($rule > 0 && !isset($this->client_doc)) { $OUTPUT->error(1, "Access Code is invalid, missing, or has Expired"); } if (isset($this->client_doc["system_info"]["role"])) { $this->role = $this->client_doc["system_info"]["role"]; } if (isset($this->client_doc["system_info"]["permissions"]) && is_array($this->client_doc["system_info"]["permissions"])) { $this->permissions = $this->client_doc["system_info"]["permissions"]; } // if the clients role is less than the rule for this file $this->permission($rule, $permission); } else { if ($rule > 0) { $OUTPUT->error(1, "Access Code is invalid, missing, or has Expired."); } } }
private function detectDeviceInternal($user_agent) { if (!$user_agent) { return; } if (!$db_file = $GLOBALS['siteConfig']->getVar('MOBI_SERVICE_FILE')) { error_log('MOBI_SERVICE_FILE not specified in site config.'); die("MOBI_SERVICE_FILE not specified in site config."); } try { $db = new db(array('DB_TYPE'=>'sqlite', 'DB_FILE'=>$db_file)); $result = $db->query('SELECT * FROM userAgentPatterns WHERE version<=? ORDER BY patternorder,version DESC', array($this->version)); } catch (Exception $e) { error_log("Error with device detection"); return false; } while ($row = $result->fetch()) { if (preg_match("#" . $row['pattern'] . "#i", $user_agent)) { return $row; } } return false; }
function get_current_table($table_name, $prefix = "") { global $sql; if (!isset($sql)) { $sql = new db(); } if (!$prefix) { $prefix = MPREFIX; } // echo "Get table structure for: {$table_name}, prefix: {$prefix}<br />"; $sql->db_Select_gen('SET SQL_QUOTE_SHOW_CREATE = 1'); $qry = 'SHOW CREATE TABLE `' . $prefix . $table_name . "`"; if (!($z = $sql->db_Select_gen($qry))) { return FALSE; } $row = $sql->db_Fetch(MYSQL_NUM); $tmp = str_replace("`", "", stripslashes($row[1])) . ';'; // Add semicolon to work with our parser $count = preg_match_all("#CREATE\\s+?TABLE\\s+?`{0,1}({$prefix}{$table_name})`{0,1}\\s+?\\((.*?)\\)\\s+?(?:TYPE|ENGINE)\\s*\\=\\s*(.*?);#is", $tmp, $matches, PREG_SET_ORDER); if ($count === FALSE) { return "Error occurred"; } if (!$count) { return "No matches"; } return $matches; }
public function GuardarAlbaranes() { $db = new db(); $db->connect(); $C = new ActiveRecord('albaranes'); $C->fields["fecha"] = $this->fecha; $C->fields["operacion"] = $this->operacion; $C->fields["guia"] = $this->guia; $C->fields["remitente"] = $this->remitente; $C->fields["beneficiario"] = $this->beneficiario; $C->fields["documento"] = $this->documento; $C->fields["pais"] = $this->pais; $C->fields["direccion"] = $this->direccion; $C->fields["ciudad"] = $this->ciudad; $C->fields["telefono"] = $this->telefono; $C->fields["descripcion"] = $this->descripcion; $C->fields["peso"] = $this->peso; $C->fields["comision"] = $this->comision; $C->fields["seguro"] = $this->seguro; $C->fields["iv"] = $this->iv; $C->fields["total"] = $this->total; $C->fields["direccion_agencia"] = $this->direccion_agencia; $C->insert(); $db->close(); }
function comprobar_inventario($id) { $host = "mysql.hostinger.es"; $user = "******"; $pass = "******"; $db = "u586837674_ayd1"; $tabla = "ARTICULO"; /*$con = @mysql_connect($host,$user,$pass); return true; mysql_select_db($db); //Consulta el inventario $consulta = "SELECT cantidad FROM $tabla WHERE articulo=".$id.""; $resultado = mysql_query($consulta,$con) or die ( 'error' .mysql_errno()); $Existencia=0; while ($row = mysql_fetch_assoc($resultado)) { echo $row['cantidad']; $Existencia =$row['cantidad']; break; }*/ $db1 = new db(); $Existencia = $db1->consulta($id); if ($Existencia >= 1) { return true; } return false; }
/** * * @param db $exdb * @return array */ function read_limit_data($exdb) { $limits = array(); // Limits $limit_data = $exdb->queryAllRecords("SELECT l.id, l.limit_name, l.value FROM Limits as l"); foreach ($limit_data as $entry) { if (array_key_exists($entry['id'], $limits) == false) { $limits[$entry['id']] = array(); } $limits[$entry['id']][$entry['limit_name']] = $entry['value']; // limits that are there: /* disk_space disk_space_soft expiration max_box max_db max_dom_aliases max_maillists max_mn max_site max_site_builder max_subdom max_subftp_users max_traffic max_traffic_soft max_unity_mobile_sites max_webapps max_wu mbox_quota */ } return $limits; }
function handle($g, $s) { $this->get = $g; $this->smarty = $s; if ($_SESSION['type'] != 'customer') { header('location:index.php'); exit; } require_once 'libs/model/db.class.php'; $db = new db(); if ($_SESSION['type'] == 'customer' && !isset($this->get['email'])) { //没有带email参数 $this->display(); } else { if (isset($this->get['ajax'])) { $this->sendCoachTime($this->get['email'], $this->get['date']); } else { if (isset($this->get['email'])) { // //预定教练逻辑 $addition = $this->get['addition']; $email = $this->get['email']; $date = $this->get['date']; $time = $this->get['time']; $db->coachBook($_SESSION['email'], $email, $addition, $date, $time); $db->setRecord($_SESSION['email'], '消费', '100'); $db->subBalance($_SESSION['email'], '100'); header('location:index.php?action=coachbook'); } } } }
function availableElems() { $db = new db(); $log = ADLog::getInstance(); /* * Extract all Policy Elements for select list below */ $q = "SELECT id, elementName FROM compliancePolElem WHERE status = 1 ORDER BY elementName ASC"; $result = $db->q($q); $num_rows = mysql_numrows($result); if (!$result || $num_rows < 0) { $log->Warn("Failure: Problem Displaying compliancePolElem options (File: " . $_SERVER['PHP_SELF'] . ")"); echo "Error displaying info for availableElems() function"; return; } if ($num_rows == 0) { $log->Warn("Failure: Problem Displaying availableElems() - no options returned (File: " . $_SERVER['PHP_SELF'] . ")"); echo "Database table empty"; return; } for ($i = 0; $i < $num_rows; $i++) { $id = mysql_result($result, $i, "id"); $elementName = mysql_result($result, $i, "elementName"); echo "<option value=" . $id . ">" . $elementName . "</option>"; } }
function login($user, $pass) { $con = new db(); $conc = $con->c(); $kcook = intval($_POST["remember"]); $q = mysqli_query($conc, "SELECT `id`,`user`,`name`,`email`,`img1`,`img2`,`img3`,`bgcolor` FROM `users` WHERE (`user` = '{$user}' OR `email` ='{$user}') AND pass = '******'"); if (mysqli_num_rows($q) == 1) { $r = mysqli_fetch_array($q); setcookie("u", $r[1], time() + 52 * 60 * 60 * 24 * 7); $_SESSION["uid"] = $r[0]; $_SESSION["user"] = $r[1]; $_SESSION["name"] = $r[2]; $_SESSION["email"] = $r[3]; $_SESSION["p"] = $pass; $_SESSION["color"] = $r[7]; $_SESSION["img1"] = $r[4]; $_SESSION["img2"] = $r[5]; $_SESSION["img3"] = $r[6]; $_SESSION["ula"] = md5("{$r['1']} {$pass} {$r['0']}"); $con->close_db_con($conc); if ($kcook == 1) { setcookie("u", $r[1], time() + 2 * 60 * 60 * 24 * 7); setcookie("p", $pass, time() + 2 * 60 * 60 * 24 * 7); } return true; } else { return false; } }
function handle($g, $p, $s) { $this->smarty = $s; $this->post = $p; $this->get = $g; if ($_SESSION['type'] != 'admin') { //非管理员跳转回首页 header('location:index.php'); exit; } if (!isset($this->post['content'])) { //不带post请求 $this->display(); } else { $head = $this->post['head']; $type = $this->post['type']; //通知的对象在这里 分为 会员 管理员 教练 $content = $this->post['content']; //通知内容在这里 /* *下面需要将通知内容写进数据库 并通知成功 */ $db = new db(); $db->addNotify($head, $content, Time(), $type); $this->smarty->assign('message', '提交成功'); $this->smarty->display('libs/view/header.ctp'); $this->smarty->display('libs/view/operationSuccess.ctp'); $this->smarty->display('libs/view/sysmanag.ctp'); $this->smarty->display('libs/view/tail.ctp'); } }