function DisplayHousebyID($id) { $myquery = "Select * FROM Houses Where ID = '{$id}'"; $MyRows = GetResult($myquery); if (count($MyRows) == 0) { echo "<h1>House ID Invalid</h1>"; } foreach ($MyRows as $row) { DisplayHousePage($id, $row["Address"], $row["HouseDesc"], $row["Beds"], $row["Toilets"], $row["Garages"], $row["Image"]); } }
function PrintHouseList($query) { echo "<div id='PopList'>\n\t\t\t\t<h1> House Results </h1>\n\t\t\t\t<div class='HouseList'>"; $MyRows = GetResult($query); if (count($MyRows) == 0) { echo "<h1>No Houses Match Search Criteria</h1>"; } foreach ($MyRows as $row) { $myHouse = new House($row); PrintHouse($myHouse); } echo "</div></div></body></HTML>"; }
public function CheckStudent($realname, $sex, $classid, $classmate) { $class_arr = M('User')->field('user.id,user.realname,user.sex,user.username')->table('user user,alumnus alumnus')->where('alumnus.user_id = `user`.id AND class_id=%d', $classid)->select(); // 处理用户名 $realname = trim($realname); $classmate = trim($classmate); // 查找存在情况 $find_user = false; $find_classmate = false; $backup_user = null; // 防止出现同名用户抢占性别不确定用户的情况 $res_arr = array('userid' => -1); if ($sex != 1 && $sex != 2) { return GetResult(false, '性别数据有误'); } foreach ($class_arr as $key => $value) { // 查找姓名 if ($value['realname'] == $realname) { if ($value['username'] != null) { continue; } $find_user = true; $this->where('id=%d', $value['id'])->setField('sex', $sex); $res_arr['userid'] = $value['id']; continue; } // 查找同学 if ($value['realname'] == $classmate) { $find_classmate = true; } } if ($find_user) { if ($find_classmate) { // 完成验证 $res_arr['status'] = true; } else { // 找不到同学 $res_arr['status'] = false; $res_arr['info'] = '该班级没有该姓名的同学'; } } else { // 找不到姓名 $res_arr['status'] = false; $res_arr['info'] = '对不起,该班级未注册成员中不存在您'; } return $res_arr; }
public function ClassChange() { if (IS_POST) { $data = array('id' => I('id'), 'classname' => I('name'), 'headmaster' => I('headmaster'), 'attendandate_id' => I('attendandate')); // 判断是否存在空字段 if (CheckFieldNotNull($data) == false) { echo GetResult(false, '有字段为空'); return; } // 入库 $id = D('Class')->ChangeClass($data); if ($id > 0) { echo GetResult(); } else { echo GetResult(false, '操作失败,数据未修改或系统繁忙'); } } }
public function CreateActivity($title, $content, $classid, $aid, $options = array()) { $data = array('activitytitle' => $title, 'activitycontent' => $content, 'user_id' => session('id'), 'class_id' => $classid, 'checkidetifier' => C('ACTIVITY_CHECK_DEFAULT')); trace($data); if (CheckFieldNotNull($data) == false) { return GetResult(false, '存在未填字段'); } $data = array_merge($data, $options); if ($aid == -1) { $id = $this->add($data); } else { $this->where('id=%d', $aid)->save($data); $id = $aid; } if ($id > 0) { return GetResult(true, '操作成功', array('id' => $id)); } else { return GetResult(false); } }
function GetBookings($Username) { $select = "Select * from Bookings Where UserID = '{$Username}'"; return GetResult($select); }
* | # m h d M W * | 0,10,20,30,40,50 * * * * www-data /usr/bin/php5 -f /home/www/evegate/cron/cron_messages_forward.php * | * | */ include 'include/db.php'; include 'include/api_calls.php'; include 'include/config.php'; function SendMail($to1, $from, $subject, $message, $charset = "utf-8") { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=' . $charset . "\r\n"; $headers .= 'From: ' . $from . "\r\n"; mail($to1, $subject, $message, $headers); } $api_keys_array = GetResult("SELECT * FROM api_keys WHERE key_id>0 and forward_mail>'' "); foreach ($api_keys_array as $single_key) { $keyID = $single_key["key_id"]; $vCode = $single_key["v_code"]; $forwardmail = $single_key["forward_mail"]; $filters = unserialize($single_key['filters']); //get api user $url = 'https://api.eveonline.com/account/APIKeyInfo.xml.aspx?keyID=' . $keyID . '&vCode=' . $vCode; $xml_object = simplexml_load_string(file_get_contents($url)); $xml_array = object2array($xml_object); $characterID = $xml_array["result"]["key"]["rowset"]["row"]["@attributes"]["characterID"]; $characterNAME = getUserNameByID($characterID); //get mail headers $maildata = "https://api.eveonline.com/char/MailMessages.xml.aspx?characterID={$characterID}&keyID={$keyID}&vCode={$vCode}"; $xml_object2 = simplexml_load_string(file_get_contents($maildata)); $xml_array2 = object2array($xml_object2);
function GetUsers() { $SelectQuery = "Select * From Users"; return GetResult($SelectQuery); }