public function login() { global $tpl, $user; //設定 Action 相關參數 set_status($controller); //error_log("login start"); //error_log("session: ".$_SESSION['auth_id'].", cookie:".$_COOKIE['auth_id']); if (empty($_SESSION['auth_id']) && $_COOKIE['auth_id']) { $user_profile = $user->get_user_profile($_COOKIE['auth_id']); $users = $user->get_user($_COOKIE['auth_id']); unset($users['passwd']); $users['profile'] = $user_profile; if (md5($users['userid'] . $users['name']) == $_COOKIE['auth_secret']) { $_SESSION['user'] = $users; //error_log("login pass"); // Set session and cookie information. $_SESSION['auth_id'] = $users['userid']; $_SESSION['auth_email'] = $_COOKIE['auth_email']; $_SESSION['auth_secret'] = md5($users['userid'] . $users['name']); //error_log("session:".$_SESSION['auth_id'].", cookie:".$_COOKIE['auth_id']); } // Set local publiciables with the user's info. $user->user_id = $users['userid']; $user->name = $users['profile']['nickname']; $user->email = ''; $user->ok = true; $user->is_logged = true; } }
public function home() { global $tpl, $member, $user, $history, $config; //login_required(); //設定 Action 相關參數 set_status($this->controller); $tpl->set_title(''); $tpl->render("contact", "home", true); }
public function detail() { global $tpl, $faq; //設定 Action 相關參數 set_status($this->controller); if (empty($_GET['fid'])) { return_to('site/tech'); } else { //資料 $get_faq = $faq->faq_detail($_GET['fid']); $tpl->assign('detail', $get_faq); } $tpl->set_title(''); $tpl->render("tech", "detail", true); }
/** * Default home page. */ public function home() { global $tpl, $googlemap; //設定 Action 相關參數 set_status($this->controller); //資料 $gmap = urldecode($_GET['k']); $tpl->assign('gmap', $gmap); //print_r($gmap);exit; mb_regex_encoding('UTF-8'); mb_internal_encoding('UTF-8'); $location_array = mb_split("到", mb_substr($_GET['k'], 1)); //print_r($_GET['k']); //print_r($location_array);exit; $maplocation['from'] = $location_array[0]; if (count($location_array) == 1) { $mapstate = "loc"; } else { if (count($location_array) > 1) { $mapstate = "nav"; $maplocation['to'] = end($location_array); array_shift($location_array); //去頭 array_pop($location_array); //去尾 $maplocation['waypoint'] = implode(",", $location_array); if (!empty($maplocation['waypoint'])) { $maplocation['waypoint'] = "waypoint: ['" . $maplocation['waypoint'] . "'], "; } } else { if (count($location_array) < 1) { $mapstate = ""; return_to('site/'); } } } $tpl->assign('mapstate', $mapstate); $tpl->assign('maplocation', $maplocation); $tpl->set_title(''); $tpl->render("googlemap", "home", true); }
$this->model->query($query); $osid = $this->model->_con->insert_id; } if ($this->io->input["post"]["type"] == 'back') { //訂單狀態: 2 缺貨退費 set_status($this->config, $this->model, '2', $this->io->input["post"]["orderid"]); //退還 紅利點數 //參考 saja_exchange.saja_exchange_bonus_history, saja_cash_flow.saja_bonus back_bonus($this->config, $this->model, $this->io->input["post"]["orderid"]); //目前無退貨部分 $sql = "`backtime`='{$this->io->input["post"]["backtime"]}',\n\t`backmemo`='{$this->io->input["post"]["backmemo"]}',\n\t"; } else { if ($this->io->input["post"]["type"] == 'shipping') { //訂單狀態: 1 已出貨(已扣除 紅利點數) //參考 saja_exchange.saja_exchange_bonus_history, saja_cash_flow.saja_bonus set_status($this->config, $this->model, '1', $this->io->input["post"]["orderid"]); } $sql = "`outtime`='{$this->io->input["post"]["outtime"]}', \n\t`outtype`='{$this->io->input["post"]["outtype"]}',\n\t`outcode`='{$this->io->input["post"]["outcode"]}',\n\t`outmemo`='{$this->io->input["post"]["outmemo"]}', \n\t"; } $query = "UPDATE `{$this->config->db[3]['dbname']}`.`{$this->config->default_prefix}order_shipping` SET \n\t{$sql} \n\t`modifyt`=now() \nWHERE\n\t`prefixid` = '{$this->config->default_prefix_id}'\n\tAND `orderid`='{$this->io->input["post"]["orderid"]}'\n"; $this->model->query($query); $query = "UPDATE `{$this->config->db[3]['dbname']}`.`{$this->config->default_prefix}order` SET \n\t`memo`='{$this->io->input["post"]["outmemo"]}', \n\t`modifyt`=now() \nWHERE\n\t`prefixid` = '{$this->config->default_prefix_id}'\n\tAND `orderid`='{$this->io->input["post"]["orderid"]}'\n"; $this->model->query($query); function back_bonus($config, $model, $orderid) { //取得扣除紅利點數記錄 $query = "SELECT b.* \n\tFROM `{$config->db[3]['dbname']}`.`{$config->default_prefix}exchange_bonus_history` bh\n\tLEFT OUTER JOIN `{$config->db[1]['dbname']}`.`{$config->default_prefix}bonus` b ON \n\t\tbh.prefixid = b.prefixid\n\t\tAND bh.bonusid = b.bonusid\n\tWHERE \n\t\tbh.`prefixid` = '{$config->default_prefix_id}' \n\t\tAND bh.`switch` = 'Y'\n\t\tAND bh.`orderid` = '{$orderid}'\n\t\tAND b.bonusid IS NOT NULL\n\tLIMIT 1\t\n\t"; $rs = $model->getQueryRecord($query); if (!empty($rs['table']['record'])) { $userid = $rs['table']['record'][0]['userid']; $countryid = $rs['table']['record'][0]["countryid"];
<?php include_once 'hw_function.php'; session_start(); if (get_condition() == '1') { if (isset($_POST['status']) && !isset($_POST['apply'])) { if (get_status() == '1') { set_status('<0>'); $_SESSION['message'] = "Device has been turned off"; header('Location: /danzsecurity/setting'); } else { if (get_status() == '0') { set_status('<1>'); $_SESSION['message'] = "Device has been turned on"; header('Location: /danzsecurity/setting'); } } } if (isset($_POST['apply'])) { set_attempts("<{$_POST['password_attempts']}>"); $_SESSION['message'] = "Password Attempts has been changed"; header('Location: /danzsecurity/setting'); } } else { if (!isset($_POST['condition'])) { $_SESSION['error'] = "Setting cannot be changed while device is locked"; header('Location: /danzsecurity/setting'); } } if (isset($_POST['condition'])) { set_condition('<1>');
function end_status($process) { global $wp_restore, $complete; set_status($process, $complete, false); $wp_restore->save_process_status($process, 'completed'); }
$user = new User($pdo_link); $user->username = $data["username"]; $user->password = $data["password"]; $success = $user->create(); $response["debug"] = $success; /** * Switch won't work in this situation * Thanks php */ if ($success === 1056) { set_status(403, $STR["username_taken"]); } elseif ($success === true) { $session = new Session($pdo_link); $session->user = $user; $response["session_token"] = $session->grant_token(); set_status(201, $STR["account_created"]); } else { set_status(403, $STR["register_failed"]); } } break; case 'GET': if ("notes" == array_shift($path) && $SESSION_STARTED) { $note_list = $CURRENT_USER->fetch_user_notes(); $response["notes"] = $note_list; } break; default: set_status(501, $STR["unsupported_method"]); break; }
function CreateMysqlAdmin($arrayconfig) { $server_database = $arrayconfig["DB"]; $mysql_password = $arrayconfig["password"]; $user = $arrayconfig["uid"]; $sql = "SELECT User FROM user WHERE User='******'"; $q = new mysql(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'mysql')); $userfound = $ligne["User"]; $q = new mysql(); $sql = "DELETE FROM `mysql`.`db` WHERE `db`.`Db` = '{$server_database}'"; $q->QUERY_SQL($sql, "mysql"); if (!$q->ok) { write_events("Failed to set privileges \"{$q->mysql_error}\""); set_status("{failed}"); return false; } if ($userfound == null) { $sql = "CREATE USER '{$user}'@'%' IDENTIFIED BY '{$mysql_password}';"; $q->QUERY_SQL($sql, "mysql"); if (!$q->ok) { write_events("Failed to set privileges operation - Create user -\"{$q->mysql_error}\""); set_status("{failed}"); return false; } } else { write_events("{$user} already exists"); } $sql = "GRANT USAGE ON `{$server_database}`. * \n\tTO '{$user}'@'%' IDENTIFIED BY '{$mysql_password}' \n\tWITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;"; $q->QUERY_SQL($sql); if (!$q->ok) { write_events("Failed to set privileges - GRANT usage -\"{$q->mysql_error}\""); set_status("{failed}"); return false; } $sql = "GRANT ALL PRIVILEGES ON `{$server_database}` . * TO '{$user}'@'%' WITH GRANT OPTION ;"; $q->QUERY_SQL($sql); if (!$q->ok) { write_events("Failed to set privileges \"{$q->mysql_error}\""); set_status("{failed}"); return false; } write_events("success set privileges on {$server_database}"); return true; }
//массив живых rpc $good_pings = 0; //массив успешных пингов foreach ($rpc_arr as $rpc_url) { $rpc_url = trim($rpc_url); if ($rpc_url == '') { continue; } if ($rss_url == 'no') { $rss_url = ""; $ret = ping_rss($domen, $rpc_url, '1'); } else { $rss_url = "http://{$domen}/{$rss_url}"; $ret = ping_rss($domen, $rpc_url, '2'); if ($ret == '405') { $ret = ping_rss($domen, $rpc_url, '1'); } } if (in_array($ret, $good_codes)) { $good_rpc[] = $rpc_url; $good_pings++; } } $ping_date = date("Y-m-d"); set_status('ping_rss_tasks', $id_task, 'task_status', 'done'); set_status('ping_rss_tasks', $id_task, 'ping_date', $ping_date); set_status('ping_rss_tasks', $id_task, 'good_pings', $good_pings); //file_put_contents('data/ping/error_log.txt',$error); //file_put_contents('data/ping/bad_rpc.txt',$bad_rpc); //file_put_contents('data/ping/good_rpc.txt',$good_rpc); //unset($bad_rpc,$good_rpc,$error);
//Генерим одностраничную карту сайта со ссылками на все страницы дора sitemap.html generate_upload_full_html_site_map(); //Заливаем папку со скриптами редиректа на хост upload_script_folder_to_host(); //Сохраняем ссылки на страницы дора в файл # save_dor_pages_links_to_file(); //Генерация robots.txt и заливка на хост generate_upload_robots_txt(); //генерация sitemap.xml и заливка на хост generate_upload_xml_site_map(); //Генерация и заливка rss generate_upload_rss_xml(); //Заносим запись в таблицу `dors` и заносим туда ссылки на индекс на карту и др. характеристики дора add_ready_dor_to_base(); //Меняем статус хоста на 'used' set_status('hosts', $id_host, 'host_status', 'used'); //Увеличиваем заюзанность шаблона на 1 и вставляем значение в базу $used_num++; $result = mysql_query("UPDATE `dor_tpls` SET `usednum` = '{$used_num}' WHERE `id` = '{$id_dor_tpl}' LIMIT 1;"); if (!$result) { echo mysql_error(); exit; } //добавляем задание на пинг rss, если нужно if ($ping_rss) { add_ping_rss_task($dor_md5, $dor_name, 'rss.xml'); } mysql_close($cn); unset($used_num); //пингуем xml sitemap, если нужно if ($ping_map) {
public function vendorCommitTx() { global $db, $config, $tpl, $mall; set_status($this->controller); date_default_timezone_set('Asia/Shanghai'); $tx_check_code = $_POST['tx_check_code']; $evrid = $this->getSafeStr($_POST['evrid']); $vendor_name = $this->getSafeStr($_POST['vendor_name']); $vendorid = $this->getSafeStr($_POST['vendorid']); $prod_pn = $this->getSafeStr($_POST['prod_pn']); $prod_name = $this->getSafeStr($_POST['prod_name']); $vendor_prodid = $this->getSafeStr($_POST['vendor_prodid']); $tx_quantity = $this->getSafeStr($_POST['tx_quantity']); $tx_currency = $this->getSafeStr($_POST['tx_currency']); $total_price = $this->getSafeStr($_POST['total_price']); $unit_price = $this->getSafeStr($_POST['unit_price']); $total_bonus = $this->getSafeStr($_POST['total_bonus']); $tx_type = $this->getSafeStr($_POST['tx_type']); $bg_notify_url = $this->getSafeStr($_POST['bg_notify_url']); $memo = $this->getSafeStr($_POST['memo']); $reqin_timestamp = time(); $reqin_time = date('YmdHis', $reqin_timestamp); $retArr = array(); if (empty($evrid)) { $retArr['retCode'] = '-1'; $retArr['retMsg'] = urlencode('交易序號缺誤 !!'); $this->replyAndExit($retArr); } $retArr['evrid'] = $evrid; if (empty($tx_check_code)) { $retArr['retCode'] = '-2'; $retArr['retMsg'] = urlencode('交易驗證碼缺誤 !!'); $this->replyAndExit($retArr); } $arrCond = array(); $arrCond['evrid'] = $evrid; $arrCond['tx_status'] = '1'; $record = $mall->getQrcodeTxRecord($arrCond); if (empty($record['evrid'])) { $retArr['retCode'] = '-100'; $retArr['retMsg'] = urlencode('交易資料缺誤 !!'); $this->replyAndExit($retArr); } // tx_check_code 驗證 $tx_code = $record['tx_code']; error_log("[vendorCommitTx] tx_code : " . $tx_code); if ($tx_check_code != md5($tx_code)) { $retArr['retCode'] = '-100'; $retArr['retMsg'] = urlencode('交易碼驗證失敗 !!'); $this->replyAndExit($retArr); } // 交易時效驗證 $t = new DateTime($record['qrcode_time']); $qrcode_timestamp = $t->getTimestamp(); if ($reqin_timestamp - $qrcode_timestamp > 63) { $retArr['retCode'] = '-102'; $retArr['retMsg'] = urlencode('商家確認時效已過 !!'); $this->replyAndExit($retArr); } //各項資料驗證...ToDoList //商家名稱 if (!empty($vendor_name)) { $arrUpd['vendor_name'] = $vendor_name; } else { $retArr['retCode'] = '-4'; $retArr['retMsg'] = urlencode('商家名稱缺誤 !!'); $this->replyAndExit($retArr); } // 交易類別 if (!empty($tx_type)) { $arrUpd['tx_type'] = $tx_type; } else { $retArr['retCode'] = '-11'; $retArr['retMsg'] = urlencode('交易類別缺誤 !!'); $this->replyAndExit($retArr); } //商品名稱 if (!empty($prod_name)) { $arrUpd['prod_name'] = $prod_name; } else { $retArr['retCode'] = '-102'; $retArr['retMsg'] = urlencode('商品名稱缺誤 !!'); $this->replyAndExit($retArr); } //交易幣別 if (!empty($tx_currency)) { $arrUpd['tx_currency'] = $tx_currency; } else { $retArr['retCode'] = '-103'; $retArr['retMsg'] = urlencode('交易幣別缺誤 !!'); $this->replyAndExit($retArr); } //商品交易數量 if (!empty($tx_quantity)) { if (is_numeric($tx_quantity)) { $arrUpd['tx_quantity'] = $tx_quantity; } else { $retArr['retCode'] = '-108'; $retArr['retMsg'] = urlencode('商品交易數量格式異常 !!'); $this->replyAndExit($retArr); } } else { $retArr['retCode'] = '-7'; $retArr['retMsg'] = urlencode('商品交易數量缺誤 !!'); $this->replyAndExit($retArr); } //交易總金額 if (!empty($total_price)) { if (is_numeric($total_price)) { $arrUpd['total_price'] = $total_price; } else { $retArr['retCode'] = '-109'; $retArr['retMsg'] = urlencode('交易總金額格式異常 !!'); $this->replyAndExit($retArr); } } else { $retArr['retCode'] = '-8'; $retArr['retMsg'] = urlencode('交易總金額缺誤 !!'); $this->replyAndExit($retArr); } //所需紅利點數 if (!empty($total_bonus)) { if (is_numeric($total_bonus)) { $arrUpd['total_bonus'] = $total_bonus; } else { $retArr['retCode'] = '-110'; $retArr['retMsg'] = urlencode('所需紅利點數格式異常 !!'); $this->replyAndExit($retArr); } } else { $retArr['retCode'] = '-9'; $retArr['retMsg'] = urlencode('所需紅利點數缺誤 !!'); $this->replyAndExit($retArr); } if (!empty($bg_notify_url)) { $arrUpd['bg_notify_url'] = $bg_notify_url; } if (!empty($unit_price)) { $arrUpd['unit_price'] = $unit_price; } if (!empty($vendorid)) { $arrUpd['vendorid'] = $vendorid; } if (!empty($vendor_prodid)) { $arrUpd['vendor_prodid'] = $vendor_prodid; } if (!empty($prod_pn)) { $arrUpd['prod_pn'] = $prod_pn; } if (!empty($memo)) { $arrUpd['memo'] = $memo; } // 驗證通過, 修改交易資料 $arrUpd['keyin_time'] = $reqin_time; $arrUpd['tx_status'] = '2'; $retCode = $mall->updQrcodeTxRecord($arrUpd, $arrCond); if ($retCode) { // $ws=new Client($config['wss_url']); // $ws->send('NTFY|'. $arrCond['evrid'].'|'.$arrUpd['tx_status']); $retArr['retCode'] = '1'; $retArr['retMsg'] = urlencode('確認完成!!'); $this->replyAndExit($retArr); } exit; }
function create_upload_redirect() { //Создаем файл редиректа и заливаем на хост global $tmp, $script_fname, $redir_code, $ftp_con, $ftp_dir, $id_task; $fr = fopen("tmp/{$tmp}/{$script_fname}", 'w+'); fputs($fr, $redir_code); fclose($fr); //заливаем редирект на хост $upload_page = @upload_page_to_host($script_fname, $ftp_con, $ftp_dir); unlink("tmp/{$tmp}/{$script_fname}"); if (!$upload_page) { echo "Невозможно залить редирект на хост"; set_status('dorgen_tasks', $id_task, 'dor_status', 'error'); exit; } }
write_warning_status('106'); } //Rename backup folder if (!$wp_backup->rename_backup_folder()) { $backup_job->set_task_error('109'); write_fatal_error_status('109'); //cleanup_on_failure( $wp_backup->backup_project_path ); end_backup(109, false); } //Take an inventory of the zip files created $file_system = new WPBackItUp_FileSystem($logger); $zip_files = $file_system->get_fileonly_list($wp_backup->backup_project_path, 'zip'); $wp_backup->save_file_list_inventory(WPBACKITUP__SQL_BULK_INSERT_SIZE, $backup_job->backup_id, 'backups', $wp_backup->backup_project_path, $zip_files); //Combine the zip files into one file // $zip_remaining_files_count = $wp_backup->backup_files( $backup_job->backup_id, $wp_backup->backup_project_path, 'backup-files', 'combined' ); set_status('finalize_backup', $complete, false); $backup_job->set_task_complete(); $logger->log('**END FINALIZE BACKUP**'); } //If we get this far we have a finalized backup so change the path $wp_backup->set_final_backup_path(); if ($backup_job->get_job_status() == 'complete') { //SUCCESS- End Job! $wp_backup->update_job_control_complete($backup_job->backup_id); //write response file first to make sure it is there write_response_file_success(); set_status_success(); $WPBackitup->increment_successful_backup_count(); end_backup(null, true); } exit;
function ScanRules() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid"; if (!$GLOBALS["FORCE"]) { $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { build_progress("Process {$pid} already exists", 110); echo "Process {$pid} already exists\n"; return; } } if (system_is_overloaded(basename(__FILE__))) { echo "Overloaded system, aborting\n"; build_progress("Overloaded system", 110); return; } @file_put_contents($pidfile, getmypid()); include_once dirname(__FILE__) . '/ressources/class.mysql.squid.builder.php'; $q = new mysql_squid_builder(); $base = "/home/squid/rttsize"; $YEAR = date("Y"); $MONTH = date("m"); $DAY = date("d"); $HOUR = date("H"); $WEEK = date("W"); $baseHour = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$WEEK}/{$DAY}/{$HOUR}"; $baseDay = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$WEEK}/{$DAY}"; $baseWeek = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$WEEK}"; $baseMonth = "/home/squid/rttsize/{$YEAR}/{$MONTH}"; $during[60] = $baseHour; $during[1440] = $baseDay; $during[10080] = $baseWeek; $GLOBALS["MUST_RELOAD_SQUID"] = false; $GLOBALS["STATUS"] = array(); $sql = "SELECT ID,PatternGroup FROM bandquotas_status WHERE `freeze`=1"; $results = $q->QUERY_SQL($sql); while ($ligne = mysql_fetch_assoc($results)) { $key = "{$ligne["ID"]}-{$ligne["PatternGroup"]}"; $GLOBALS["STATUS"][$key]["FREEZE"] = 1; } $sql = "SELECT * FROM bandquotas WHERE enabled=1"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error . "\n"; build_progress("MySQL error", 110); return; } if (mysql_num_rows($results) == 0) { build_progress("{no_rule}", 110); set_status(); return; } while ($ligne = mysql_fetch_assoc($results)) { $QuotaSizeBytes = $ligne["QuotaSizeBytes"]; $GroupType = $ligne["GroupType"]; $PatternGroup = $ligne["PatternGroup"]; $TimeFrame = $ligne["TimeFrame"]; $basePath = $during[$TimeFrame]; $RuleName = $ligne["RuleName"]; $FileAcls = "/etc/squid3/bandwidths/Group{$ligne["ID"]}.acl"; build_progress("{Scanning} Rule:{$ligne["ID"]}", 50); events("[INFO]: Analyze {$RuleName}", __LINE__); if ($GroupType == 0) { if ($GLOBALS["VERBOSE"]) { echo "Scanning {$PatternGroup} [Active Directory] ({$RuleName})\n"; } ScanActiveDirectoryGroups($ligne["ID"], $RuleName, $PatternGroup, $basePath, $QuotaSizeBytes, $FileAcls); continue; } if ($GroupType == 2) { ScanIpAddr_single($ligne["ID"], $RuleName, $PatternGroup, $basePath, $QuotaSizeBytes, $FileAcls); continue; } if ($GroupType == 1) { if ($GLOBALS["VERBOSE"]) { echo "Scanning {$PatternGroup} [Simple Member] ({$RuleName})\n"; } Scan_member_single($ligne["ID"], $RuleName, $PatternGroup, $basePath, $QuotaSizeBytes, $FileAcls); continue; } if ($GroupType == 3) { if ($GLOBALS["VERBOSE"]) { echo "Scanning {$PatternGroup} [Simple MAC] ({$RuleName})\n"; } ScanMacAddr_single($ligne["ID"], $RuleName, $PatternGroup, $basePath, $QuotaSizeBytes, $FileAcls); continue; } if ($GroupType == 4) { if ($GLOBALS["VERBOSE"]) { echo "Scanning {$PatternGroup} [Full network] ({$RuleName})\n"; } ScanNetwork($ligne["ID"], $RuleName, $PatternGroup, $basePath, $QuotaSizeBytes, $FileAcls); continue; } } build_progress("{Scanning} {status}", 90); set_status(); if ($GLOBALS["MUST_RELOAD_SQUID"]) { build_progress("{reloading_proxy_service}", 95); $squidbin = $unix->LOCATE_SQUID_BIN(); shell_exec("{$squidbin} -f /etc/squid3/squid.conf -k reconfigure"); } build_progress("{done}", 100); }
function check_file($id) { //echo VIDEO_STORAGE_DIR.$fname."<br>"; $fname = $id . ".mpg"; //if (file_exists(KARAOKE_STORAGE_DIR.$fname)){ //var_dump(get_status($id)); $color_status = get_status($id); if ($color_status == 1) { $color = 'green'; set_status($id, 1); } else { if ($color_status == 0) { $color = 'red'; set_status($id, 0); } else { if ($color_status == 2) { $color = 'blue'; } } } return "<font id='path_{$id}' color='{$color}'>{$fname}</font>"; }
function xml_crud($xml, $tax_args, $meta_args, $post, $status) { switch ($status) { /* -------------------------------------------------------- *\ ADD \* -------------------------------------------------------- */ case 'add': global $wpdb; $querystr = "\n SELECT * FROM wp_posts\n WHERE post_type = 'occasions'\n "; $result = $wpdb->get_results($querystr); // check if we have occasions in db if (count($result) < 1) { // controles uitvoeren check_vehicle($xml); // create the taxonomies create_tax($tax_args); $post_id = wp_insert_post($post); // insert post taxonomies insert_post_tax($post_id, $tax_args); // insert post meta values insert_meta_values($post_id, $meta_args); // foto's opslaan process_photos($post_id, $xml->afbeeldingen['afbeelding']); // set status set_status(1); } else { global $wpdb; $querystr = "\n SELECT * FROM wp_postmeta \n WHERE meta_key = 'occasion_hexon_nr' \n AND meta_value = '{$xml->voertuignr_hexon}'\n "; $result = $wpdb->get_results($querystr); if (count($result) < 1) { // controles uitvoeren check_vehicle($xml); // create the taxonomies create_tax($tax_args); $post_id = wp_insert_post($post); // insert post taxonomies insert_post_tax($post_id, $tax_args); // insert post meta values insert_meta_values($post_id, $meta_args); // foto's opslaan process_photos($post_id, $xml->afbeeldingen['afbeelding']); // set status set_status(1); } // set status set_status(0); } break; /* -------------------------------------------------------- *\ UPDATE \* -------------------------------------------------------- */ /* -------------------------------------------------------- *\ UPDATE \* -------------------------------------------------------- */ case 'change': // Controles uitvoeren check_vehicle($xml); global $wpdb; $querystr = "\n SELECT * FROM wp_postmeta \n WHERE meta_key = 'occasion_hexon_nr' \n AND meta_value = '{$xml->voertuignr_hexon}'\n LIMIT 1\n "; $result = $wpdb->get_results($querystr); $post_id = $result[0]->post_id; if ($post_id) { $post['ID'] = $post_id; create_tax($tax_args); insert_post_tax($post_id, $tax_args); wp_update_post($post); delete_post_media($post_id); foreach ($meta_args as $key => $val) { update_post_meta($post_id, $key, $val); } // foto's opslaan process_photos($post_id, $xml->afbeeldingen['afbeelding']); set_status(1); } else { set_status(0); } break; /* -------------------------------------------------------- *\ DELETE \* -------------------------------------------------------- */ /* -------------------------------------------------------- *\ DELETE \* -------------------------------------------------------- */ case 'delete': // Voertuig verwijderen uit database global $wpdb; // TODO: Use constant in query $querystr = "SELECT post_id \n FROM {$wpdb->postmeta} \n WHERE meta_key = 'occasion_hexon_nr' AND meta_value = '{$xml->voertuignr_hexon}'\n LIMIT 1\n "; $result = $wpdb->get_results($wpdb->prepare($querystr)); $post_id = $result[0]->post_id; if ($post_id) { delete_post_media($post_id); foreach ($meta_args as $key => $val) { delete_post_meta($post_id, $key); } wp_delete_post($post_id, true); set_status(1); } else { set_status(0); } break; } }
public function hinetpts_exc() { global $tpl, $config, $deposit; set_status($this->controller); login_required(); $serial_no = addslashes($_POST['serial_no']); if (empty($serial_no)) { echo '<script>alert("序号不可为空白, 请重新输入 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; exit; } if ($serial_no != $_POST['serial_no']) { echo '<script>alert("序号格式錯誤, 请重新输入 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; exit; } $passwd = addslashes($_POST['passw']); if (empty($passwd)) { echo '<script>alert("密码不可为空白, 请重新输入 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; exit; } if ($passwd != $_POST['passw']) { echo '<script>alert("密码格式錯誤, 请重新输入 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; exit; } $userid = $_SESSION['auth_id']; $ch_serial = $deposit->get_ch_serial($serial_no); if (!$ch_serial) { echo '<script>alert("序号错误, 请重新输入 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; exit; } if ($passwd != $ch_serial['passw']) { $arr_update = array(); $arr_update['userid'] = $userid; $arr_update['err_num'] = $ch_serial['err_num'] + 1; if ($arr_update['err_num'] < 3) { echo '<script>alert("密码错误 : ' . $arr_update['err_num'] . ' 次, 请重新输入 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; } else { $arr_update['switch'] = 'L'; echo '<script>alert("密码输入错误 3 次,序号已锁定暂停兑换,请洽客服人员 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; } $deposit->update_ch_serial($serial_no, $arr_update); exit; } if ($ch_serial['switch'] == 'L') { echo '<script>alert("本序号已暂时停用,请洽客服人员 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; exit; } if ($ch_serial['switch'] == 'Y') { echo '<script>alert("本序号已使用过, 无法再兑换杀币 !!"); window.location = "/site/deposit2/confirm2/?drid=7"; </script>'; exit; } if ($passwd == $ch_serial['passw']) { $arr_update = array(); $drid = $_POST['drid']; $spoint = $ch_serial['point']; error_log("[hinetpst_exc] drid={$drid}, spoint={$spoint} ..."); $deposit_rule = $deposit->deposit_rule_test($drid); if ($deposit_rule) { $deposit_rule_item = $deposit->get_deposit_rule_item_by_drid_spoint($drid, $spoint); if ($deposit_rule_item) { $driid = $deposit_rule_item['driid']; error_log("[hinetpst_exc] driid={$driid} ..."); // 產生訂單及儲值資料 $depositid = $deposit->add_deposit($userid, $deposit_rule_item['amount']); $spointid = $deposit->add_spoint($userid, $deposit_rule_item['spoint']); $dhid = $deposit->add_deposit_history($userid, $driid, $depositid, $spointid); error_log("[hinetpst_exc] dhid={$dhid}, spointid={$spointid}, depositid={$depositid} ..."); // 修改訂單及儲值狀態 $get_deposit_history = $deposit->get_deposit_history($dhid); $get_deposit_id = $deposit->get_deposit_id($depositid); error_log("[hinetpts_exc] saja_deposit switch : " . $get_deposit_id[0]['switch']); if ($get_deposit_history[0]['dhid'] && $get_deposit_id[0]['switch'] == 'N') { $hinet_array['out_trade_no'] = $get_deposit_history[0]['dhid']; $hinet_array['spoints'] = $spoint; $hinet_array['userid'] = $userid; $hinet_array['serialno'] = $serial_no; $deposit->set_deposit_history($hinet_array, $get_deposit_history[0], "hinet"); $deposit->set_deposit($get_deposit_history[0]['depositid']); $deposit->set_spoint($get_deposit_history[0]['spointid']); $get_deposit_rule_item = $deposit->get_deposit_rule_item($get_deposit_history[0]['driid']); $get_scode_promote = $deposit->get_scode_promote_rt_test($get_deposit_rule_item[0]['driid']); if (!empty($get_scode_promote)) { foreach ($get_scode_promote as $sk => $sv) { if ($sv['productid'] == 0) { $socde = $deposit->add_scode($userid, $sv); $deposit->add_scode_history($userid, $socde, $sv); } if ($sv['productid'] > 0 && !empty($sv['productid'])) { for ($i = 0; $i < $sv['num']; $i++) { $deposit->add_oscode($userid, $sv); } } } } $arr_update = array(); $arr_update['userid'] = $userid; $arr_update['switch'] = 'Y'; $arr_update['dhid'] = $dhid; $arr_update['modifyerid'] = $userid; $deposit->update_ch_serial($serial_no, $arr_update); echo '<script>alert("兑换成功, 新增杀币 ' . $spoint . ' 点 !!");window.location = "/site/member?channelid=1"</script>'; } } } } exit; }
public function test() { global $tpl; //設定 Action 相關參數 set_status($this->controller); $post_data = array(); if (is_array($_POST)) { foreach ($_POST as $key => $value) { if ($key != "_tourl") { $post_data[$key] = $value; } } } $tpl->assign('post_data', $post_data); $tpl->set_title(''); $tpl->render("enterprise", "test", true); }
public function genBidDetailHtml() { global $tpl, $bid; //設定 Action 相關參數 set_status($this->controller); //成交狀態 $type = $_GET['type']; $productid = $_GET['productid']; $channelid = $_GET['channelid']; // 由scheduler 呼叫的 $bg = $_GET['bg']; $ret = "OK"; error_log("[bid/genBidDetailHtml] Gen /var/www/html" . APP_DIR . "/static/html/BidDetail_" . $productid . ".html ...."); //成交狀態 if (empty($type) || $type == 'deal') { //商品資料 $product = $bid->get_info($productid); //下標人數&下標金額 $get_bid_Arr = $bid->get_bid_info($productid); $i = 0; if (is_array($get_bid_Arr)) { foreach ($get_bid_Arr as $key => $value) { if ($value['price'] <= $product['price']) { $bid_info[$key] = $get_bid_Arr[$key]; } else { if ($i < 10) { $bid_info[$key] = $get_bid_Arr[$key]; $i++; } } } } } else { //商品資料 $product = $bid->get_cancelled_info($productid); //下標人數&下標金額 $bid_info = $bid->get_cancelled_bid_info($productid); } $html = '<div class="article">' . '<ul data-role="listview" data-inset="true" data-icon="false">' . '<li>' . '<div id="tagBox">'; if (!empty($product['thumbnail'])) { $img_src = BASE_URL . APP_DIR . '/images/site/product/' . $product['thumbnail']; } elseif (!empty($product['thumbnail_url'])) { $img_src = $product['thumbnail_url']; } $html .= '<img src="' . $img_src . '" >' . '</div>' . '<h3>' . $product['name'] . '</h3>' . '<h2>商品市价:RMB ' . $product['retail_price'] . ' 元</h2>'; if ($type == '' || $type == 'deal') { $html .= '<h2>中标金额:RMB ' . $product['price'] . ' 元</h2>' . '<h2>中标者:'; if (!empty($product['nickname'])) { $html .= $product['nickname']; } else { $html .= '无'; } $html .= '</h2>'; } else { $html .= '<h2>流标原因:' . $product['memo'] . '</h2>'; } if (is_array($bid_info)) { $html .= '<h2 style="float:left;width:70px;text-align:center;">下标金额</h2> <h2 style="float:left;width:70px;text-align:center;">下标人数</h2><h2 style="clear:both;">(仅列出部份下标情况)</h2>'; foreach ($bid_info as $rk => $rv) { if ($product['price'] == $rv['price']) { $html .= '<h2 style="float:left;width:70px;text-align:center;color:red;">' . sprintf("%.2f", $rv['price']) . '</h2> <h2 style="float:left;width:70px;text-align:center;color:red;">' . $rv['num'] . '</h2><h2 style="clear:both;"></h2>'; } else { $html .= '<h2 style="float:left;width:70px;text-align:center;">' . sprintf("%.2f", $rv['price']) . '</h2> <h2 style="float:left;width:70px;text-align:center;">' . $rv['num'] . '</h2><h2 style="clear:both;"></h2>'; } } } $html .= '</li>'; $html .= '</ul>'; $html .= '</div><!-- /article -->'; try { // error_log($html); $fp = fopen('/var/www/html' . APP_DIR . '/static/html/BidDetail_' . $productid . '.html', 'w+'); fwrite($fp, $html); fclose($fp); } catch (Exception $e) { error_log($e->getMessage()); $ret = $e->getMessage(); } finally { if ($bg == 'Y') { echo $ret; } else { return $ret; } } }
public function edit() { global $tpl, $member; login_required(); //設定 Action 相關參數 set_status($this->controller); if ($_POST) { if ($member->update($_POST)) { $tpl->set_msg($member->msg, $member->ok); } $tpl->set_msg($member->msg, $member->ok); } $tpl->assign('user_email', $user->email); $tpl->assign('user_name', $user->name); $tpl->set_title(''); $tpl->render("member", "edit", true); }
$count = 1; foreach ($my_quotes_list as $res) { $user_id = $res->user_id; $quote_id = $res->quote_id; $user_fname = $res->user_fname; $registration_no = $res->registration_no; $subject_name = $res->subject_name; $status = $res->status_id; echo "<tr>"; echo "<td>" . $count++ . "</td>"; echo "<td>" . $res->user_fname . "</td>"; echo "<td>" . $res->registration_no . "</td>"; echo "<td>" . $res->subject_name . "</td>"; echo "<td> <center> {$res->no_of_license} " . set_add_button($user_fname, $registration_no, $subject_name, $status) . "</center></td>"; echo "<td>" . $res->discount_amount . "</td>"; echo "<td> <center><small class='badge " . bgcolor($status) . "'>" . set_status($status) . "</small></center></td>"; // echo "<td> <button type='button' class='btn btn-success' onclick='associate_subscribe_subject(\"$quote_id\");'> Pay </button>"; // echo "<button type='button' class='btn btn-danger' onclick='remove_aoi(\"$quote_id\");'> Delete </button> </td>"; echo "</tr>"; } } function set_add_button($user_fname, $registration_no, $subject_name, $status) { switch ($status) { case '6': return "<button class='btn btn-success' data-toggle='modal' data-target='#addLicense' onClick='request_license(\"{$user_fname}\",\"{$registration_no}\",\"{$subject_name}\")'> <i class='fa fa-plus'></i></button>"; break; default: # code... break; }
public function used() { global $tpl, $scodeModel; //設定 Action 相關參數 set_status($this->controller); login_required(); $get_list = $scodeModel->used_list($this->userid); $tpl->assign('row_list', $get_list); //設定分頁 if (empty($get_list['table']['page'])) { $page_content = array(); } else { $page_path = $tpl->variables['status']['status']['path']; $page_content = $this->set_page($get_list, $page_path); } $tpl->assign('page_content', $page_content); $tpl->set_title(''); $tpl->render("scode", "used", true); }
$schedid = intval($schedid); if ($schedid > 0) { system("sudo /usr/share/ossim/scripts/vulnmeter/cancel_scan.pl {$schedid}"); } break; case "play_task": $omp->play_task($job_id); break; case "pause_task": $omp->pause_task($job_id); break; case "stop_task": $omp->stop_task($job_id); break; case "resume_task": $omp->resume_task($job_id); break; case "delete_task": $omp->delete_task($job_id); break; case "delete": delete_sched($schedid); break; case "setstatus": set_status($schedid, $enabled); break; default: main_page(1, $sortby, $sortdir); break; } require_once "footer.php";
public function twcreditcard_pay_success($callType = "async") { // async=異步 global $tpl, $config, $deposit; set_status($this->controller); if ($callType == "async") { // 讓sync的先跑完 ... for ($i = 0; $i <= 100000; ++$i) { continue; } } error_log("[twcreditcard_pay_success] SendType=" . $callType); $result_array = array(); foreach ($_POST as $key => $value) { error_log("[twcreditcard_pay_success] {$key} = {$value}"); $result_array[$key] = $value; } if (!empty($result_array['Td'])) { $get_deposit_history = $deposit->get_deposit_history($result_array['Td']); if ($get_deposit_history) { $userid = $get_deposit_history[0]['userid']; $orderid = $get_deposit_history[0]['dhid']; $depositid = $get_deposit_history[0]['depositid']; error_log("[twcreditcard_pay_success] userid:" . $userid . ", orderid:" . $orderid . " depositid:" . $depositid); if (!empty($depositid)) { $get_deposit = $deposit->get_deposit_id($depositid); if ($get_deposit) { $amount = floatval($get_deposit[0]['amount']); error_log("[twcreditcard_pay_success]amount:" . $get_deposit[0]['amount'] . "==>" . $amount); $my_chkvalue = $config['creditcard']['merchantnumber'] . $config['creditcard']['code'] . $result_array['buysafeno'] . $amount . $result_array['errcode']; error_log("[twcreditcard_pay_success] My Ori ChkValue=" . $my_chkvalue); $my_chkvalue = strtoupper(sha1($my_chkvalue)); error_log("[twcreditcard_pay_success] My ChkValue=" . $my_chkvalue); if ($my_chkvalue == $result_array['ChkValue']) { // 驗證ok, 修改訂單及加入贈送 $switch = $get_deposit[0]['switch']; $status = $get_deposit_history[0]['status']; $spointid = $get_deposit_history[0]['spointid']; $driid = $get_deposit_history[0]['driid']; $nickname = $get_deposit_history[0]['modifiername']; error_log("[twcreditcard_pay_result] orderid: " . $orderid . "/status: " . $status . "/switch: " . $switch); if ($orderid && $switch == 'N') { // 將json形式的資訊轉為Associated array $arr_data = json_decode($get_deposit_history[0]['data'], true); // 添加資訊到data欄位 $arr_data['out_trade_no'] = $result_array['Td']; $arr_data['vendor_no'] = $result_array['buysafeno']; $arr_data['merchant_id'] = $result_array['web']; $arr_data['amount'] = $result_array['MN']; $arr_data['ApproveCode'] = $result_array['ApproveCode']; $arr_data['Card_NO'] = $result_array['Card_NO']; $arr_data['Card_Type'] = $result_array['Card_Type']; $arr_data['SendType'] = $result_array['SendType']; $arr_data['errcode'] = $result_array['errcode']; // $arr_data['errmsg']=$result_array['errmsg']; // $arr_data['ChkValue']=$result_array['ChkValue']; if ($callType == "sync") { $arr_data['modifierid'] = $userid; $arr_data['modifiername'] = $nickname; $arr_data['modifiertype'] = "User"; } else { if ($callType == "async") { $arr_data['modifierid'] = "0"; $arr_data['modifiername'] = "twcreditcard_pay_success"; $arr_data['modifiertype'] = "System"; } } $deposit->set_deposit_history($arr_data, $get_deposit_history[0], $config['creditcard']['paymenttype']); if ($result_array['errcode'] == '00') { // 不管異步同步, 回傳errorcode='00' 才表示成功 $deposit->set_deposit($depositid); $deposit->set_spoint($spointid); $get_deposit_rule_item = $deposit->get_deposit_rule_item($driid); $get_scode_promote = $deposit->get_scode_promote_rt($get_deposit_rule_item[0]['driid']); if (!empty($get_scode_promote)) { foreach ($get_scode_promote as $sk => $sv) { /* if ($sv['productid'] == 0) { $socde = $deposit->add_scode($userid, $sv); $deposit->add_scode_history($userid, $socde, $sv); } if ($sv['productid'] > 0 && !empty($sv['productid'])) { for ($i = 0; $i < $sv['num']; $i++) { $deposit->add_oscode($userid, $sv); } } */ if ($this->is_house_promote_effective($sv['productid'])) { // 判定是否符合萬人殺房資格, 符合者送殺價券 $this->register_house_promote($sv['productid'], $userid); for ($i = 0; $i < $sv['num']; $i++) { $deposit->add_oscode($userid, $sv); } // 推薦者送殺價券 $this->add_oscode_to_user_src($userid, $sv['productid'], $sv['amount'] / 500); } else { // 不是房子(2854), 就直接送殺價券 for ($i = 0; $i < $sv['num']; $i++) { $deposit->add_oscode($userid, $sv); } } } } $ret = "0000"; } } else { error_log("Duplicated Update, do nothing !!"); $ret = "0000"; } } else { $ret = "Data Consistency Check Error !!"; } } } else { $ret = "Empty deposit id of " . $orderid . " !!"; } } else { $ret = "Cannot find the data of " . $orderid . " !!"; } } else { $ret = "Empty order id !!"; } error_log($ret); if ($callType == "async") { echo "0000"; exit; } else { // if $callType="sync" return $ret; } }
public function getBroadcastInfo() { global $tpl, $product; set_status($this->controller); $latitude = $_REQUEST['lat']; $longitude = $_REQUEST['lng']; error_log("[c\\product\\getBroadcastInfo] Latitude:" . $latitude . "|Longitide:" . $longitude); $broadcast_info = $product->getBroadcastInfo($latitude, $longitude); if (!empty($broadcast_info)) { echo json_encode($broadcast_info); } exit; }
$fh = fopen($file, 'w+'); fputs($fh, md5(mt_rand(10, 789))); fclose($fh); //Подключаемся к фтп-хосту $ftp_con = @ftp_connect($ftp_host); $login = @ftp_login($ftp_con, $ftp_login, $ftp_pass); if (!$ftp_con || !$login) { //echo'Невозможно соединиться с удаленным хостом'; set_status('hosts', $id, 'host_status', 'error'); continue; } ftp_pasv($ftp_con, $passive_mode); //flush; //Заливаем файл на хост. if ($ftp_dir != '') { $remote_file_path = $ftp_dir . '/' . $fname; // print_r($remote_file_path); } else { $remote_file_path = $fname; } $upload = @ftp_put($ftp_con, $remote_file_path, $file, FTP_BINARY); if (!$upload) { echo 'Не удается залить файл на хост'; set_status('hosts', $id, 'host_status', 'error'); } else { set_status('hosts', $id, 'host_status', 'allow'); } } unlink($file); header("Location: http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); }
if ($action == 'delete') { $id = $_GET['id']; $server = server_delete($link, $id, $game_name); if ($game_name == 'orders') { header("Location: index.php?orders=true"); } else { header("Location: index.php?game=" . $game_name); } } else { if ($action == 'edit') { $id = (int) $_GET['id']; if (!empty($_POST) && $id > 0) { server_edit($link, $id, $game_name, $_POST['server_name'], $_POST['1kk'], $_POST['100kk'], $_POST['1000kk']); header("Location: index.php?game={$game_name}"); } $server = server_get($id, $link, $game_name); //include("../views/server_admin.php"); } } } if (isset($_GET['orders'])) { if (isset($_POST['data'])) { $data = json_decode($_POST['data'], true); set_status($link, $data[1], $data[0]); } $orders = orders_get($link); include "../views/admin_panel_orders.php"; } else { $servers = servers_all($link, $game_name); include_once "../views/admin_panel.php"; }
{ foreach ($params as $param) { if (!isset($_POST[$param])) { return false; } } return true; } switch ($method) { case "POST": $data = $_POST; break; case "PUT": $data = []; parse_str(file_get_contents("php://input"), $data); break; default: $data = NULL; break; } if (in_array($endpoint, $valid_endpoints)) { include "endpoints/" . $endpoint . ".php"; } else { set_status(404, $STR["endpoint_404"]); } $json = json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); if (isset($_GET["callback"])) { $json = $_GET["callback"] . "({$json});"; } print $json; exit;
function change_dor_status($ids) { foreach ($ids as $id) { set_status('dors', $id, 'dor_status', 'posted'); } }