public function actionScrollview($text = "") { if ($text == "") { $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=" . $this->moduleComponentId; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $articleid = $row['article_modulecomponentid']; $query = "SELECT article_content,article_lastupdated FROM article_content WHERE page_modulecomponentid=" . $articleid; $result = mysql_query($query); if ($row = mysql_fetch_assoc($result)) { $text = $row['article_content']; global $PAGELASTUPDATED; $PAGELASTUPDATED = $row['article_lastupdated']; } else { return "Article not yet created."; } } $content = "<HEAD><META HTTP-EQUIV=REFRESH CONTENT=300></HEAD><body><div><div align=\"center\"><fieldset><marquee behavior=scroll scrollAmount=\"1\" scrolldelay=\"0\" onmouseover=\"this.stop()\" direction=\"up\" onmouseout=\"this.start()\" vspce=\"800px\"style=\"height:800px;width:800px;font-size:15px;color:#880000;\">" . $text . "</div></fieldset></marquee></body>"; global $sourceFolder; global $moduleFolder; require_once $sourceFolder . "/pngRender.class.php"; if (get_magic_quotes_gpc()) { $content = stripslashes($content); } $render = new pngrender(); echo $render->transform($content); disconnect(); exit; }
function fetchAllorders() { $con = connect(); $result = mysqli_query($con, "SELECT * from orders"); disconnect($con); return $result; }
function error($msg) { global $title, $header; html($title, $header, "<h2>Erro</h2>{$msg}"); disconnect(); exit(1); }
function fetchWithQuery($query) { $con = connect(); $result = mysqli_query($con, $query); disconnect($con); return $result; }
public function testConnect() { global $connection_string; $this->assertTrue(isset($connection_string), "connection string should be set"); $dbconnection = connect(); $this->assertTrue(isset($dbconnection), "DB Connection should be set"); disconnect($dbconnection); }
/** Prints the number of people that have responded to the poll */ function numberOfRespondents() { connect(); $q = "SELECT * FROM " . RESULTS_TABLE; $result = mysql_query($q) or mysql_err($q); print mysql_num_rows($result); disconnect(); }
public function reg() { $state = $this->in_get('state', None, 2, 'True'); $wx_data = base64_decode($state); $code = $this->in_get('code', None, 2, 'True'); $wx_data_arr = explode('@@', $wx_data); $schId = intval($wx_data_arr[0]); $room = in($wx_data_arr[1]); $phone = in($wx_data_arr[2]); $msg = Check::rule(array(check::mobile($phone), '手机电话号码格式不对')); if ($msg != 1) { $this->alert('您的手机号码不正确'); } $r = connectRedis($this->config['RD_HOST'], $this->config['RD_PORT'], $this->config['RD_PWD']); $apiUser = new api_userMod(); $wx_res = $apiUser->get_info_user_weixin($code, $r); if (!$wx_res) { $this->alert('请用微信登陆'); } $check_con['openid'] = $wx_res['openid']; $field = 'p_id'; $check_res = $this->model->table($this->config['info_person'])->field($field)->where($check_con)->find(); if ($check_res) { // 如果此微信号已经存在,直接登陆 $apiUser->set_login_mark($check_res['p_id'], $code, $r); disconnect($r); $this->redirect(__ROOT__ . '/order/water'); } else { // 否则插入数据 $data['s_id'] = $schId; $res = $this->model->table($this->config['school'])->where($data)->find(); if ($res) { $data['name'] = $wx_res['nickname']; $data['addr'] = $room; $data['phone'] = $phone; $data['openid'] = $wx_res['openid']; $data['pic'] = $wx_res['headimgurl']; $data['s_name'] = $res['name']; $data['sex'] = $wx_res['sex']; $data['city'] = $wx_res['city']; $data['province'] = $wx_res['province']; $data['point'] = 100; $res = $this->model->table($this->config['info_person'])->data($data)->insert(); if ($res) { $apiUser->set_login_mark($res, $code, $r); disconnect($r); setcookie('susCode', time(), time() + EX_TIME_COOKIE, __ROOT__); $this->redirect(__URL__ . '/suss'); } else { disconnect($r); $this->alert('对不起,网络暂时出了点小问题'); } } else { disconnect($r); $this->alert('对不起,贵校暂时没有开通此服务'); } } }
function get_notes($user_id) { $mysql_link = connect(); $query = sprintf("SELECT * FROM note WHERE user_id='%s'", mysql_real_escape_string($user_id, $mysql_link)); $result = mysql_query($query, $mysql_link); $notes = fetch_all($result); disconnect($mysql_link); return $notes; }
function execute_update($sql) { $db = connect(); $res = mysql_query($sql, $db); if (!$res) { trigger_error("Error executing update :" . mysql_error()); die; } disconnect($db); }
function execute_update($sql) { $db = connect(); $res = pg_query($db, $sql); if (!$res) { trigger_error("Error executing update :" . pg_last_error($res)); die; } disconnect($db); }
function execute_insert($email, $pass, $FirstName, $LastName) { $con = connect(); $sql = " INSERT INTO info (\n\t\t\t\t\t\t\t\t`Email`,\n\t\t\t\t\t\t\t\t`Pass`,\n\t\t\t\t\t\t\t\t`First`,\n\t\t\t\t\t\t\t\t`Last`)\n\t\t\t\t\t\tVALUES(\n\t\t\t\t\t\t\t\t'" . $email . "',\n\t\t\t\t\t\t\t\t'" . md5($pass) . "',\n\t\t\t\t\t\t\t\t'" . $FirstName . "',\n\t\t\t\t\t\t\t\t'" . $LastName . "'\n\t\t\t\t\t\t\t\t)"; if (!mysql_query($sql, $con)) { header("location:form.php?err=Email is already in used"); } else { disconnect($con); return true; } }
function Remove_SQLi($str) { $con = connect(); if (get_magic_quotes_gpc()) { $retStr = mysql_real_escape_string(stripslashes($str)); } else { $retStr = mysql_real_escape_string($str); } disconnect($con); return $retStr; }
function connect() { // Connects to mySQL database if ($GLOBALS['db']['connected']) { disconnect(); } $GLOBALS['db']['conn'] = new mysqli($GLOBALS['db']['server'], $GLOBALS['db']['user'], $GLOBALS['db']['pass'], $GLOBALS['db']['database']); if ($GLOBALS['db']['conn']->connect_error) { die("Connection failed: " . $GLOBALS['db']['conn']->connect_error); } $GLOBALS['db']['connected'] = true; }
function executeQueryId($query) { $this->connect(); $this->query = $query; if ($this->result = mysql_query($this->query)) { return $this->result; } else { echo "Ocorreu um erro na execu��o da SQL<BR>"; echo "Erro :" . mysql_error() . "<BR>"; echo "SQL: " . $query . "<BR>"; die; disconnect(); } }
function executeQuery($query) { $this->connect(); $this->query = $query; if ($this->result = mysql_query($this->query)) { $this->disconnect(); return $this->result; } else { echo "<b>Ocorreu um erro</b><br>"; echo "Erro: " . mysql_error(); die; disconnect(); } }
function getMemos() { $db = connect(); $result = null; try { $stmt = $db->prepare('SELECT id, title, filename, salt FROM memos ORDER BY title'); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { echo $e->getMessage(); } disconnect($db); return $result; }
/** * 进行登陆标记,设置 cookie,存入 redis,表示此用户已经登陆 * @param p_id 表示此用户在本系统的 id 编号 * @param code 表示此用户本次登陆的 code,由微信提供 * @param r 表示 redis ,若有值,表示此资源已存在,直接使用即可 */ public function set_login_mark($p_id, $code, $r = '') { $key = md5($p_id . $code); $redis_json = json_encode(array('key' => $key, 'code' => $code)); // 将用户的 p_id 、key 存进redis 中,并设置生命期 if (empty($r)) { $r = connectRedis($this->config['RD_HOST'], $this->config['RD_PORT'], $this->config['RD_PWD']); $r->set($p_id, $redis_json, EX_TIME_COOKIE); disconnect($r); } else { $r->set($p_id, $redis_json, EX_TIME_COOKIE); } setcookie('key', $key, time() + EX_TIME_COOKIE, __ROOT__); setcookie('pId', $p_id, time() + EX_TIME_COOKIE, __ROOT__); }
public function callback($controller, $action) { //---keep running in background ignore_user_abort(1); set_time_limit(0); //---just let browser disconnect disconnect(); //---fetch data,(send $_POST directly) //var_dump($controller, $action,$this->call_api($controller, $action, $_POST));exit; $products = unserialize($this->call_api($controller, $action, $_POST)); //var_dump($products);exit; //sleep(10); //---do sync(Now it will do api_update_photo) $this->do_sync($products); //---update sync status[!!!Now it will be done in do_sync()!!!] //call_api('photo_inventory', 'api_update_photo', array('photo_updated' => json_encode($photo_updated))); }
function renderEvents($event_type) { connect(); $events = mysql_query("SELECT * FROM `downtoz0_cms`.`events` WHERE `event_type` = '{$event_type}' ORDER BY `date` DESC"); $rows = mysql_num_rows($events); if ($rows > 0) { while ($data = mysql_fetch_assoc($events)) { $title = stripslashes($data['title']); $hide = $data['hide']; $date = $data['date']; $time = $data['time']; $event_type = $data['event_type']; $feature = $data['feature']; $id = $data['id']; // parse the date $month_arr = array("", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $pattern = "/(\\d)(\\d)(\\d)(\\d)(-)([0-9]+)(-)([0-9]+)/"; $month = "\$6"; $day = "\$8"; $year = "\$1\$2\$3\$4"; //$monthString = $month_arr[preg_replace($pattern, $month, $date)]; $month = preg_replace($pattern, $month, $date); $day = preg_replace($pattern, $day, $date); $year = preg_replace($pattern, $year, $date); $monthString = $month_arr[(int) $month]; $greyBg = ''; if ($hide == 0) { $hide = "hide"; $greyBg = ''; } else { $hide = "show"; $greyBg = 'greyBg'; } $isFeature = ""; if ($feature == 'on') { $isFeature = "featured"; } else { $isFeaure = ""; } echo "<div class='listitem {$isFeature} {$greyBg}'>\n \n <div class='eventDate'>{$monthString} {$day}, {$year}</div> \n <div class='listitem-title'><a href='edit-event.php?eid={$id}' title='Edit this event'>{$title}</a></div> \n <div class='utilities'>\n <div>\n <a href='edit-event.php?eid={$id}' title='Edit this event' class='button'>edit</a>\n </div>\n <div>\n <form id='hide' method='post' action='submit-event.php'>\n <input type='hidden' name='id' value='{$id}' />\n <input type='submit' name='{$hide}' value='{$hide}'>\n </form>\n </div>\n <div>\n <form id='delete' method='post' action='submit-event.php'>\n <input type='hidden' name='id' value='{$id}' />\n <input type='submit' name='delete' value='delete'>\n </form>\n </div>\n </div>\n </div>\n <hr/>\n "; } } else { echo "There are no events scheduled at this time"; } disconnect(); }
function main_f() { if (isset($_SERVER['HTTP_REFERER'])) { $ar = get_words($_SERVER['HTTP_REFERER']); connect(); if (count($ar) > 0) { foreach (array_reverse($ar, true) as $key => $val) { $sres = sql("select picture, name from ln_product where name like '%" . $key . "%' and picture is not null order by rating desc limit 0,1"); if ($ar_res = mysql_fetch_assoc($sres)) { //write_log($key); get_picture($ar_res['picture']); break; } } } disconnect(); } }
function executeQuery($query) { $this->connect(); //fazer a conexao $this->query = $query; if ($this->result = mysql_query($this->query)) { //tenta executar a instrução SQL e armazena o resultado em $result $this->disconnect(); //desconecta o banco return $this->result; //retorna o valor de $result } else { echo "Ocorreu um erro na execução da SQL"; echo "Erro :" . mysql_error(); echo "SQL: " . $query; die; disconnect(); } }
function main() { init(); connect(); switch ($GLOBALS['req']['a']) { case 'getSongs': display('songs', getSongs()); break; case 'getSongsMin': display('songsMin', getSongsMin()); break; case 'add100': add100(); display('done', 0); break; } echo json_encode($GLOBALS['final_print']); disconnect(); }
function test() { if (isset($_GET) && isset($_GET["keywords"]) && isset($_GET["target"])) { $db = connect(); $json = search($_GET["keywords"], $_GET["target"], $db); $arr = json_decode($json, true); if (isset($arr["movie"])) { $m = $arr["movie"]; echo "<h3>Movies</h3>"; $me = $m["exact"]; echo "<b>Exact Results:</b><br />"; printResult($me); $mc = $m["close"]; echo "<b>Close Results:</b><br />"; printResult($mc); $mp = $m["partial"]; echo "<b>Partial Results:</b><br />"; printResult($mp); } if (isset($arr["actor"])) { $a = $arr["actor"]; echo "<h3>Actors</h3>"; $ae = $a["exact"]; echo "<b>Exact Results:</b><br />"; printResult($ae); $ap = $a["partial"]; echo "<b>Partial Results:</b><br />"; printResult($ap); } if (isset($arr["director"])) { $d = $arr["director"]; echo "<h3>Directors</h3>"; $de = $d["exact"]; echo "<b>Exact Results:</b><br />"; printResult($de); $dp = $d["partial"]; echo "<b>Partial Results:</b><br />"; printResult($dp); } disconnect($db); } }
function getImages($id) { $db = connect(); $succes = true; $sql = "SELECT image FROM images WHERE id_images = :id "; try { $stmt = $db->prepare($sql); $stmt->bindParam(':id', $id); $stmt->execute(); } catch (PDOException $e) { echo $e->getMessage(); $succes = false; } disconnect($db); if ($succes) { return $stmt->fetchAll(PDO::FETCH_ASSOC); } else { return null; } }
public static function action($action) { global $current_user; if (get_called_class() == 'Users' && ($action == 'create' || $action == 'login') || $current_user) { db_connect(); forward_static_call(array(get_called_class(), $action)); disconnect(); // RENDER FAILURE if failure message is set if (self::$failure) { $failure = array('status' => 'failure', 'failure' => self::$failure); echo json_encode($failure); } else { if ($action != 'index') { $success = array('status' => 'success'); echo json_encode($success); } } } else { $error = array('status' => 'failure', 'failure' => 'not logged in'); echo json_encode($error); } }
function main() { init(); switch ($GLOBALS['req']['a']) { case 'getSongs': connect(); display('songs', getSongs()); break; case 'getSongsMin': connect(); display('songsMin', getSongsMin()); break; case 'add100': add100(); display('done', 0); break; case 'getMembers': connect(); display('members', getMembers()); break; case 'validate': display('valid', validate($GLOBALS['req']['text'])); break; case 'addMember': connect(); addMember(); break; case 'getNewImageName': connect(); display('done', getNewImageName()); break; case 'uploadPicture': connect(); uploadPicture(); break; } echo json_encode($GLOBALS['final_print']); disconnect(); }
function wsQuery() { // Open MySQL connect(); // GET DB DATA try { echo "case_id, case_number, actiontype, year, container, box_number, drawer_number, notes, county, court, call_number <br />"; $result = mysql_query("SELECT n.id, n.date, c.short_name, n.notes, r.short_name AS `actiontype`\r\n FROM naturalizations n, record_types r, collections c\r\n WHERE n.record_type_id = r.id AND n.collection_id = c.id"); while ($row = mysql_fetch_assoc($result)) { echo $row['id'] . ','; #case id echo ','; #casenumber echo $row['actiontype'] . ','; #actiontype echo $row['date'] . ','; #year echo ','; #container echo ','; #box_number echo ','; #drawer_number echo $row['notes'] . ','; #county echo $row['short_name'] . ','; #county echo 'Circuit Court,'; #court echo ''; #call_number echo '<br />'; } } catch (Exception $e) { echo "GET Error"; } // Close MySQL disconnect(); }
function fill_out_sch($user_num, $start, $end) { $conect = connect_acc(); $date_time_s = explode(' ', $start); $date_time_e = explode(' ', $end); $date_end = $date_time_e[0]; $date = $date_time_s[0]; $specific_val = "S"; while ($date <= $date_end) { if ($date == $date_time_s[0]) { $lim_s = $date . " " . $date_time_s[1]; $lim_e = inc_day($date) . " 23:59:59"; } elseif ($date == $date_end) { $lim_s = $date . " 00:00:00"; $lim_e = inc_day($date) . " " . $date_time_e[1]; } else { $lim_s = $date . " 00:00:00"; $lim_e = inc_day($date) . " 23:59:59"; } if ($result = $conect->query("SELECT `Name`,`Start`,`End` FROM `Schedule` WHERE `User_#`='{$user_num}' AND `TYPE`='D' AND `Start`>='{$lim_s}' AND `End`<='{$lim_e}' ORDER BY 'Start' ASC")) { if ($result->num_rows == 0) { $y_m_d = explode('-', $date); $weekday = dayoftheweek($y_m_d[0], $y_m_d[1], $y_m_d[2]); $result = $conect->query("SELECT `Name`,`Start`,`End` FROM `Schedule` WHERE `User_#`='{$user_num}' AND `TYPE`='{$weekday}' ORDER BY 'Start' ASC"); } if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $ds_date_time_s = explode(' ', $row["Start"]); $ds_date_time_e = explode(' ', $row["End"]); $specific_val = $specific_val . $row["Name"] . "/" . $date . " " . $ds_date_time_s[1] . "/" . $date . " " . $ds_date_time_e[1] . "//"; } } } $specific_val = $specific_val . "||"; $date = inc_day($date); } disconnect($conect); return $specific_val; }
function getInfoID($id, $sitio) { global $usertable; $conexion = connect(); mysqli_set_charset($conexion, "utf8"); $query = 'SELECT * FROM ' . $usertable . ' WHERE Nombre = "' . $id . '" AND Provincia = "' . $sitio . '"'; $result = mysqli_query($conexion, $query); if ($result) { $rawdata = array(); $i = 0; while ($row = mysqli_fetch_array($result)) { for ($x = 0; $x < count($row); $x++) { unset($row[$x]); } $rawdata[$i] = $row; $i++; } } else { print "Base de Datos NO encontrada."; } disconnect($conexion); return $rawdata; }
function wsQuery() { $data = ''; // Open MySQL connect(); // GET DB DATA try { echo "case_id, entity, prefix, lastname, firstname, middlename, suffix, alternatename, role <br />"; $result = mysql_query("SELECT n.id, n.last_name, n.first_name, n.middle_name, n.alternate_name, r.name\r\n FROM naturalizations n, record_types r, collections c\r\n WHERE n.record_type_id = r.id AND n.collection_id = c.id"); while ($row = mysql_fetch_assoc($result)) { echo $row['id'] . ','; #case id echo $row['last_name'] . ','; #entity echo ','; #prefix echo $row['last_name'] . ','; #lastname echo $row['first_name'] . ','; #firstname echo $row['middle_name'] . ','; #middlename echo ','; #suffix echo $row['alternate_name'] . ','; #alternatename echo 'Immigrant'; #role echo '<br />'; } } catch (Exception $e) { echo "GET Error"; } // Close MySQL disconnect(); }