function home() { $r['top5'] = top5(); $r['pense'] = pense(); $r['videos'] = videos(); $r['vn'] = vn(); $r['ppr'] = ppr(); return $r; }
function formulaires_register_traiter_dist() { $login = _request('login'); $name = _request('name'); $password = _request('password'); $re_password = _request('re_password'); $email = _request('email'); include_spip('inc/acces'); include_spip('auth/sha256.inc'); $alea_actuel = creer_uniqid(); $alea_futur = creer_uniqid(); $pass = _nano_sha256($alea_actuel . $password); $sql = 'Insert into spip_auteurs (nom,email,login,pass,htpass,statut,alea_actuel,alea_futur)values("' . $name . '","' . $email . '","' . $login . '","' . $pass . '","' . generer_htpass($password) . '","6forum","' . $alea_actuel . '","' . $alea_futur . '")'; sql_query($sql); $id_user = mysql_insert_id(); ppr('Новый пользователь с номером : ' . $id_user); }
function ppre($var) { ppr($var); exit; }
private function doTb($tid, $cid = 0) { if ($tid == 2610) { //彩票部分 $cacheId = 'doTb_' . $tid; $fcurl = cacheGet($cacheId); if (empty($fcurl)) { $url = 'http://www.114la.com/icai.json'; $fcurl = XUtils::fcurl($url); cacheSet($cacheId, $fcurl, 3600); } $fcurl = substr($fcurl, 17, -1); $data_arr = json_decode($fcurl, TRUE); if (!empty($data_arr)) { //对应关系 $dy = array('ssq' => array(220, 221, 222), 'dlt' => array(223, 224, 225), 'fc3d' => array(226, 227, 228), 'jx_11x5' => array(229, 230, 231)); foreach ($data_arr as $tp => $v) { $va = $v[0]; $fdata[$dy[$tp][0]] = array(0 => array('title' => '上期开奖号码', 'link' => $va['url'][0], 'opt_a' => implode(',', $va['result']), 'opt_b' => $va['phase'], 'opt_c' => $va['date'])); $fdata[$dy[$tp][1]] = array(0 => array('title' => '立即投注', 'link' => $va['url'][1]), 1 => array('title' => $va['chain'][0], 'link' => $va['chain'][1])); foreach ($va['link'] as $vl => $tu) { $tu['link'] = $tu['url']; unset($tu['url']); $va['link'][$vl] = $tu; } $fdata[$dy[$tp][2]] = $va['link']; } } if (!empty($fdata)) { foreach ($fdata as $cid => $cinfo) { Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid)); foreach ($cinfo as $info) { try { $model = new Links(); $info['catalog_id'] = $cid; $info['title'] = empty($info['title']) ? '待定' : $info['title']; $info['link'] = empty($info['link']) || $info['link'] == '#' ? 'http://www.114la.com/' : $info['link']; $info['mix'] = empty($info['mix']) ? null : base64_decode($info['mix']); $info = array_filter($info); $model->attributes = $this->_form($info); // ppr($model->attributes); $model->save(); } catch (Exception $exc) { return 'error1caipiao'; } } } } return 'ok'; // ppr($fdata,1); } elseif ($tid == 1114) { //实时热点部分 $cacheId = 'doTb_' . $tid; $fcurl = cacheGet($cacheId); if (empty($fcurl)) { $url = 'http://api4.114la.com/1114_2.json'; $fcurl = XUtils::fcurl($url); cacheSet($cacheId, $fcurl, 3600); } $fcurl = substr($fcurl, 20, -1); // ppr($fcurl,1); if (!empty($fcurl) && ($fcurl = json_decode($fcurl, 1))) { //先将对应的旧数据处理 $old = reqPost('old'); if (empty($old)) { Links::model()->updateAll(array('status_is' => 'N'), "`catalog_id`='{$cid}'"); } else { Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid)); } // ppr(Links::model()->findAll("`catalog_id`='$cid'")); foreach ($fcurl as $info) { try { $model = new Links(); $info['catalog_id'] = $cid; $info['title'] = empty($info['title']) ? '待定' : $info['title']; $info['link'] = empty($info['url']) || $info['url'] == '#' ? 'http://www.114la.com/' : $info['url']; unset($info['url']); $info = array_filter($info); $model->attributes = $this->_form($info); // ppr($model->attributes); $model->save(); } catch (Exception $exc) { return 'error1'; } } $cacheId = '_catalogAllNum'; $catalogAllNum = XXcache::refresh($cacheId); return empty($catalogAllNum[$cid]) ? 0 : $catalogAllNum[$cid] . ' ok'; } else { return 'error2'; } ppr($data_arr, 1); } elseif ($tid > 1000 && $tid < 10000) { $tid = (int) $tid; $data = $re = 0; $cacheId = 'doTb_' . $tid; $fcurl = cacheGet($cacheId); if (empty($fcurl)) { $url = 'http://www.114la.com/api/ky.php?id=' . $tid . '&' . time(); // $url = 'http://www.114la.com/api/ky.php?id='.$tid; $fcurl = XUtils::fcurl($url); cacheSet($cacheId, $fcurl, 3600); } if (!empty($fcurl) && ($fcurl = json_decode($fcurl, 1))) { //先将对应的旧数据处理 $old = reqPost('old'); if (empty($old)) { Links::model()->updateAll(array('status_is' => 'N'), "`catalog_id`='{$cid}'"); } else { Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid)); } // ppr(Links::model()->findAll("`catalog_id`='$cid'")); foreach ($fcurl as $info) { try { $model = new Links(); $info['catalog_id'] = $cid; $info['title'] = empty($info['title']) ? '待定' : $info['title']; $info['link'] = empty($info['link']) || $info['link'] == '#' ? 'http://www.114la.com/' : $info['link']; $info['mix'] = empty($info['mix']) ? null : base64_decode($info['mix']); $info = array_filter($info); $model->attributes = $this->_form($info); // ppr($model->attributes); $model->save(); } catch (Exception $exc) { return 'error1'; } } $cacheId = '_catalogAllNum'; $catalogAllNum = XXcache::refresh($cacheId); return empty($catalogAllNum[$cid]) ? 0 : $catalogAllNum[$cid] . ' ok'; } else { return 'error2'; } } else { return 'error3'; } }
public static function debug() { ppr(self::$_tree); }
function set_db_active_new($DB_CONST_NAME, $options = array()) { global $global_params; $array_const = get_defined_constants(true); echo $DB_CONST_NAME . "|"; $DB_URL_CONST = $array_const['user'][$DB_CONST_NAME]; echo $DB_URL_CONST . "|"; ppr($array_const['user']); exit; $db_type = substr($DB_URL_CONST, 0, strpos($DB_URL_CONST, '://')); $handler = CLASS_DIR . "database.class." . $db_type . ".inc.php"; if (is_file($handler)) { include_once $handler; } else { die("File " . $handler . " not found"); } $url = parse_url($DB_URL_CONST); $url['user'] = urldecode($url['user']); $url['pass'] = urldecode($url['pass']); $url['host'] = urldecode($url['host']); $url['database'] = substr(urldecode($url['path']), 1); if (isset($url['port'])) { $url['host'] = $url['host'] . ":" . $url['port']; } $global_params["db_indv_conns"][$DB_CONST_NAME] = new Database($url['host'], $url['database'], $url['user'], $url['pass'], $options); if (!$global_params["db_indv_conns"][$DB_CONST_NAME]->db_connect()) { die("<html><body><div>Unable to connect db at: <br /> Host: <b>" . $url['host'] . "</b><br />Database: <b>" . $url['database'] . "</b><br />User: <b>" . $url['user'] . "</b></div></body></html>"); return false; } else { return true; } }