/** * Constructor for this class. * * This class manages the user-permissions, login and logout. * This function does some initial work: caching search engine user agents, detects the spiders and gets the ip of the user. */ function slog() { global $config, $scache; $this->statusdata = array(); $this->ip = getip(); $this->user_agent = iif(isset($_SERVER['HTTP_USER_AGENT']), $_SERVER['HTTP_USER_AGENT'], getenv('HTTP_USER_AGENT')); $spiders = $scache->load('spiders'); $this->bots = $spiders->get(); $this->sid = ''; $this->cookies = false; $this->cookiedata = array(0, ''); $this->cookielastvisit = 0; $this->defineGID(); $this->gFields = array('downloadfiles', 'forum', 'posttopics', 'postreplies', 'addvotes', 'attachments', 'edit', 'voting', 'admin', 'gmod', 'guest', 'members', 'profile', 'pdf', 'pm', 'wwo', 'search', 'team', 'usepic', 'useabout', 'usesignature', 'docs'); $this->fFields = array('f_downloadfiles', 'f_forum', 'f_posttopics', 'f_postreplies', 'f_addvotes', 'f_attachments', 'f_edit', 'f_voting'); $this->minFields = array('flood'); $this->maxFields = array(); $this->groups = array(); $this->permissions = array(); $this->querysid = true; $this->positive = array(); $this->negative = array(); $this->boards = array(); $this->sidload = false; }
/** * Constructor for this class. * * This class manages the user-permissions, login and logout. * This function does some initial work: caching search engine user agents, detects the spiders and gets the ip of the user. */ function slog () { global $config, $scache; $this->statusdata = array(); $this->ip = getip(); $this->user_agent = iif(isset($_SERVER['HTTP_USER_AGENT']), $_SERVER['HTTP_USER_AGENT'], getenv('HTTP_USER_AGENT')); $spiders = $scache->load('spiders'); $this->bots = $spiders->get(); $this->sid = ''; $this->cookies = false; $this->cookiedata = array(0, ''); $this->defineGID(); $this->groups = array(); $this->permissions = array(); $this->querysid = true; $this->positive = array(); $this->negative = array(); $this->boards = array(); $this->sidload = false; $this->change_mid = null; $data = unserialize(file_get_contents('data/group_fields.php')); foreach ($data as $key => $values) { $this->$key = $values; } }
public function add($array) { global $webdb; $array["ip"] = getip(); $img = upload::img('signature', false); if (!empty($img)) { $array['imgurl'] = $img['url']; } // if(isset($array['birthday_y']) && isset($array['birthday_m'])&&isset($array['birthday_d'])){ // $array['birthday']=date("Y-m-d",strtotime($array['birthday_y'].'/'.$array['birthday_m'].'/'.$array['birthday_d'])); // } $array["add_time"] = date("Y-m-d H:i:s"); $array['password'] = md5($array['password']); /*if(isset($array['is_epaper'])){ if($array['is_epaper']==1){ $epaper=array(); $epaper['email']=$array['email']; $epaper['is_show']=1; $epaper['date_added']=date("Y-m-d H:i:s"); if(!$this->checkEpaper($array['email'])){ $webdb->insert($epaper, "`_web_epaper` "); }else{ $webdb->update($epaper, "_web_epaper", "email='".$array['email']."'"); } } }*/ return $this->addData($array); }
function guestBookPost($intSpamFiler, $intIsSecret) { global $DMC, $DBPrefix, $arrSideModule; $parent = 0; $_POST['isSecret'] = !empty($_POST['isSecret']) ? $_POST['isSecret'] : 0; $author = !empty($_POST['username']) ? $_POST['username'] : $_SESSION['username']; $replypassword = !empty($_POST['replypassword']) ? md5($_POST['replypassword']) : ""; if (!empty($_POST['homepage'])) { if (strpos(";" . $_POST['homepage'], "http://") < 1) { $homepage = "http://" . $_POST['homepage']; } else { $homepage = $_POST['homepage']; } } else { $homepage = ""; } $email = !empty($_POST['email']) ? $_POST['email'] : ""; $_POST['bookface'] = !empty($_POST['bookface']) ? $_POST['bookface'] : "face1"; $sql = "insert into " . $DBPrefix . "guestbook(author,password,homepage,email,ip,content,postTime,isSecret,parent,face,isSpam) values('{$author}','{$replypassword}','" . encode($homepage) . "','" . encode($email) . "','" . getip() . "','" . encode($_POST['message']) . "','" . time() . "','" . max(intval($intIsSecret), intval($_POST['isSecret'])) . "','{$parent}','" . substr(encode($_POST['bookface']), 4) . "','" . $intSpamFiler . "')"; //echo $sql; $DMC->query($sql); //更新cache settings_recount("guestbook"); settings_recache(); recentGbooks_recache(); logs_sidebar_recache($arrSideModule); //保存时间 $_SESSION['replytime'] = time(); }
function oauth_login($config) { if (!function_exists("curl_init")) { echo "<h1>腾讯开放平台提示:请先开启curl支持</h1>"; echo "\n\t\t\t开启php curl函数库的步骤(for windows)<br />\n\t\t\t1).去掉windows/php.ini 文件里;extension=php_curl.dll前面的; /*用 echo phpinfo();查看php.ini的路径*/<br />\n\t\t\t2).把php5/libeay32.dll,ssleay32.dll复制到系统目录windows/下<br />\n\t\t\t3).重启apache<br />\n\t\t\t"; exit; } $aConfig = array('appid' => $config['appid'], 'appkey' => $config['appkey'], 'api' => 'get_user_info,add_topic,add_one_blog,add_album,upload_pic,list_album,add_share,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idollist,add_idol,del_idol,get_tenpay_addr'); $sState = md5(date('YmdHis' . getip())); $_SESSION['state'] = $sState; $server_name = strtolower($_SERVER['SERVER_NAME']); $server_port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . (int) $_SERVER['SERVER_PORT']; $secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 1 : 0; $callback = ($secure ? 'https://' : 'http://') . $server_name . $server_port; $callback = $callback . url('member/register/callback', array('app' => 'qq')); $_SESSION['URI'] = $callback; $aParam = array("response_type" => 'code', "client_id" => $aConfig["appid"], "redirect_uri" => $callback, "scope" => $aConfig["api"], "state" => $sState); $aGet = array(); foreach ($aParam as $key => $val) { $aGet[] = $key . '=' . urlencode($val); } $sUrl = "https://graph.qq.com/oauth2.0/authorize?"; $sUrl .= join("&", $aGet); header("location:" . $sUrl); }
/** * Функция обновляет статус онлайн пользователя на форуме. * Перед вызовом всех остальных функций, нужно вызвать Process вначале. * @param type $cat * @param type $topic * @return type */ public function Process($cat = '0', $topic = '0') { if (!$this->online_process) { $time = time(); $time2 = $time - $this->AliveStatusTime; System::database()->Delete('forum_online', "`time` < {$time2}"); $user_ip = getip(); if (System::user()->Auth === true) { $user_id = System::user()->Get('u_id'); } else { $user_id = 0; } $user_name = System::user()->Get('u_name'); if (!$user_name) { $user_name = ''; } $user_level = System::user()->Get('u_level'); $where = "`user_ip`='{$user_ip}'"; System::database()->Select('forum_online', $where); if (System::database()->NumRows() > 0) { System::database()->Update('forum_online', "`time`='{$time}',`user_id`='{$user_id}',`user_name`='{$user_name}',`user_level`='{$user_level}',`user_ip`='{$user_ip}',`forum_cat`='{$cat}',`forum_topic`='{$topic}'", $where); } else { System::database()->Insert('forum_online', "'{$time}','{$user_id}','{$user_name}','{$user_level}','{$user_ip}','{$cat}','{$topic}'"); } $this->online_process = true; } }
function myquery($query) { // fonction permettant d'exŽcuter une requête sql en enregistrant l'erreur s'il y a dans un fichier de log ou si debug = 1 $debug = "0"; list($usec, $sec) = explode(' ', microtime()); //debut du comptage du temps $querytime_before = (double) $usec + (double) $sec; $result = mysql_query($query); list($usec, $sec) = explode(' ', microtime()); // fin de comptage $querytime_after = (double) $usec + (double) $sec; $time = $querytime_after - $querytime_before; // temps passé pour effectuer la requête if (mysql_errno() || $debug == "1") { $dt = date("Y-m-d H:i:s (T)"); $err = "<errorentry>\n"; $err .= "\t<datetime>" . $dt . "</datetime>\n"; $err .= "\t<errornum>" . mysql_errno() . "</errornum>\n"; $err .= "\t<errormsg>" . mysql_error() . "</errormsg>\n"; $err .= "\t<errorquery>" . $query . "</errorquery>\n"; $err .= "\t<scriptname>" . $_SERVER["SCRIPT_FILENAME"] . "</scriptname>\n"; $err .= "\t<userip>" . getip() . "</userip>\n"; $err .= "\t<timepast>" . $time . "</timepast>\n"; $err .= "</errorentry>\n\n"; // sauvegarde de l'erreur, et mail si c'est critique error_log($err, 3, CONFIG_ERRORSFOLDER . "sqlerror.log"); } return $result; }
public function add() { //关闭数据库缓存 $this->db->cache_off(); $token = $this->input->post('token', TRUE); $add['neir'] = $this->input->post('neir', TRUE); $add['neir'] = filter(get_bm($add['neir'])); if (User_BookFun == 0) { $error = '10000'; } elseif (!isset($_SESSION['gbooktoken']) || $token != $_SESSION['gbooktoken']) { $error = '10001'; } elseif (empty($add['neir'])) { $error = '10002'; } else { $add['uidb'] = isset($_SESSION['cscms__id']) ? intval($_SESSION['cscms__id']) : 0; $add['cid'] = 1; $add['ip'] = getip(); $add['addtime'] = time(); $ids = $this->CsdjDB->get_insert('gbook', $add); if (intval($ids) == 0) { $error = '10003'; //失败 } else { //摧毁token unset($_SESSION['token']); $error = '10004'; } } $data['error'] = $error; echo json_encode($data); }
function user_set_user_online() { global $allgAr; if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_online WHERE sid = '" . session_id() . "'"), 0)) { db_query("INSERT INTO prefix_online (sid,uptime,ipa) VALUES ('" . session_id() . "',now(),'" . getip() . "')"); } $_SESSION['authgfx'] = $allgAr['gfx']; }
function write($key, $value) { $query = mysql_query("select * from `sessions` where `sessionkey`='" . $key . "'", $this->oDB); if (mysql_num_rows($query) == 0) { mysql_query("insert into `sessions` set `sessionkey`='" . $key . "',`sessionvalue`='" . $value . "',`sessionip`='" . getip() . "', `sessionexpiry` ='" . date("Y-m-d H:i:s", strtotime("+1800 seconds")) . "'", $this->oDB); } else { mysql_query("update `sessions` set `sessionvalue`='" . $value . "',`sessionip`='" . getIp() . "',`sessionexpiry`='" . date("Y-m-d H:i:s", strtotime("+1800 seconds")) . "' where `sessionkey`='" . $key . "'", $this->oDB); } }
function __construct($get, $post) { $this->time = time(); $this->ip = getip(); $this->get = $get; $this->post = $post; $this->init_db(); //$this->init_cache(); $this->init_user(); }
function user_set_user_online() { global $allgAr; if (0 == db_result(db_query('SELECT COUNT(*) FROM `prefix_online` WHERE `sid` = "' . session_id() . '"'), 0)) { db_query('INSERT INTO `prefix_online` (`sid`,`uptime`,`ipa`) VALUES ("' . session_id() . '", "' . date('Y-m-d H:i:s') . '", "' . getip() . '")'); } if (!isset($_SESSION['authgfx'])) { $_SESSION['authgfx'] = $allgAr['gfx']; } }
function userlogin() { global $SITE_ONLINE; unset($GLOBALS["CURUSER"]); $ip = getip(); $nip = ip2long($ip); /* $res = mysql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) { header("HTTP/1.0 403 Forbidden"); print("<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n"); die; } require_once "cache/bans_cache.php"; if(count($bans) > 0) { foreach($bans as $k) { if($nip >= $k['first'] && $nip <= $k['last']) { header("HTTP/1.0 403 Forbidden"); print("<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n"); exit(); } } unset($bans); } */ if (!$SITE_ONLINE) { return; } #If not cookie set just use guest account #Morgan if (empty($_COOKIE["uid"]) || empty($_COOKIE["pass"])) { $_COOKIE["uid"] = 4; $_COOKIE["pass"] = '******'; } $id = 0 + $_COOKIE["uid"]; if (!$id || strlen($_COOKIE["pass"]) != 32) { return; } $res = mysql_query("SELECT * FROM users WHERE id = {$id} AND enabled='yes' AND status = 'confirmed'"); // or die(mysql_error()); $row = mysql_fetch_assoc($res); if (!$row) { return; } //$sec = hash_pad($row["secret"]); if ($_COOKIE["pass"] !== $row["passhash"]) { return; } mysql_query("UPDATE users SET last_access='" . TIME_NOW . "', ip=" . sqlesc($ip) . " WHERE id=" . $row["id"]); // or die(mysql_error()); $row['ip'] = $ip; $GLOBALS["CURUSER"] = $row; }
function base(&$get, &$post) { $this->time = time(); $this->ip = getip(); $this->get =& $get; $this->post =& $post; $this->init_db(); $this->init_cache(); $this->init_user(); $this->checkcode(); $this->banned(); }
function isallowed() { $ip = getip(); $aList = array('127.0.0.1', '116.228.220.98'); if (in_array($ip, $aList)) { return true; } elseif (substr($ip, 0, 7) == '192.168') { return true; } else { return false; } }
function failedloginscheck() { global $INSTALLER09; $total = 0; $ip = sqlesc(getip()); $res = sql_query("SELECT SUM(attempts) FROM failedlogins WHERE ip={$ip}") or sqlerr(__FILE__, __LINE__); list($total) = mysql_fetch_row($res); if ($total >= $INSTALLER09['failedlogins']) { mysql_query("UPDATE failedlogins SET banned = 'yes' WHERE ip={$ip}") or sqlerr(__FILE__, __LINE__); stderr("Login Locked!", "You have been <b>Exceeded</b> the allowed maximum login attempts without successful login, therefore your ip address <b>(" . htmlspecialchars($ip) . ")</b> has been locked for 24 hours."); } }
/** * Добавляет новую запись в лог действий администраторов. * @param $Action * @return bool */ function Audit($Action) { if (System::user()->Auth == false) { return false; } $user_ip = getip(); $user_id = System::user()->Get('u_id'); $date = time(); $Action = SafeEnv($Action, 255, str); System::database()->Insert('audit', Values('', $user_id, $date, $Action, $user_ip)); return true; }
function base(&$get, &$post) { $this->time = time(); $this->ip = getip(); $this->get =& $get; $this->post =& $post; $this->init_db(); $this->init_cache(); $this->ask_config = new config(); $this->onlineConfig = getConfig(); // 获取配置文件 $this->check_login(); $this->sys_error_handle(); }
function pollCollector($pollID, $voteID, $forwarder) { global $NPDS_Prefix; if ($voteID) { global $setCookies, $al_id, $al_nom, $dns_verif; $voteValid = "1"; $result = sql_query("SELECT timeStamp FROM " . $NPDS_Prefix . "poll_desc WHERE pollID='{$pollID}'"); list($timeStamp) = sql_fetch_row($result); $cookieName = 'poll' . $NPDS_Prefix . $timeStamp; global ${$cookieName}; if (${$cookieName} == "1") { $voteValid = "0"; } else { setcookie("{$cookieName}", "1", time() + 86400); } global $user; if ($user) { global $cookie; $user_req = "OR al_uid='{$cookie['0']}'"; } else { $cookie[0] = "1"; $user_req = ''; } if ($setCookies == "1") { $ip = getip(); if ($dns_verif) { $hostname = "OR al_hostname='" . @gethostbyaddr($ip) . "' "; } else { $hostname = ""; } $sql = "SELECT al_id FROM " . $NPDS_Prefix . "appli_log WHERE al_id='{$al_id}' AND al_subid='{$pollID}' AND (al_ip='{$ip}' " . $hostname . $user_req . ")"; if ($result = sql_fetch_row(sql_query($sql))) { $voteValid = "0"; } } if ($voteValid == "1") { $ip = getip(); if ($dns_verif) { $hostname = @gethostbyaddr($ip); } else { $hostname = ''; } sql_query("INSERT INTO " . $NPDS_Prefix . "appli_log (al_id, al_name, al_subid, al_date, al_uid, al_data, al_ip, al_hostname) VALUES ('{$al_id}', '{$al_nom}', '{$pollID}', now(), '{$cookie['0']}', '{$voteID}', '{$ip}', '{$hostname}')"); sql_query("UPDATE " . $NPDS_Prefix . "poll_data SET optionCount=optionCount+1 WHERE (pollID='{$pollID}') AND (voteID='{$voteID}')"); sql_query("UPDATE " . $NPDS_Prefix . "poll_desc SET voters=voters+1 WHERE pollID='{$pollID}'"); } } Header("Location: {$forwarder}"); }
function left() { global $INSTALLER09; $total = 0; $ip = getip(); $fail = sql_query("SELECT SUM(attempts) FROM failedlogins WHERE ip=" . sqlesc($ip)) or sqlerr(__FILE__, __LINE__); list($total) = mysqli_fetch_row($fail); $left = $INSTALLER09['failedlogins'] - $total; if ($left <= 2) { $left = "<span style='color:red'>{$left}</span>"; } else { $left = "<span style='color:green'>{$left}</span>"; } return $left; }
function left() { global $INSTALLER09; $total = 0; $ip = sqlesc(getip()); $fail = sql_query("SELECT SUM(attempts) FROM failedlogins WHERE ip={$ip}") or sqlerr(__FILE__, __LINE__); list($total) = mysql_fetch_row($fail); $left = $INSTALLER09['failedlogins'] - $total; if ($left <= 2) { $left = "<font color='red' size='4'>" . $left . "</font>"; } else { $left = "<font color='green' size='4'>" . $left . "</font>"; } return $left; }
public function index() { //关闭数据库缓存 $this->db->cache_off(); $this->load->library('user_agent'); $uid = intval($this->uri->segment(2)); $userid = !empty($_SESSION['cscms__id']) ? $_SESSION['cscms__id'] : 0; if ($uid == 0) { header("Location: " . Web_Path); exit; } //判断每天上限次数 $addid = 1; if (User_Nums_Share > 0) { $times = strtotime(date("Y-m-d 0:0:0")); $nums = $this->db->query("select id from " . CS_SqlPrefix . "share where uid=" . $uid . " and addtime>" . $times . "")->num_rows(); if ($nums > User_Nums_Share) { $addid = 0; } } //增加金币和经验,过滤自己访问 if ($addid == 1 && $userid != $uid) { $edit = ''; if (User_Cion_Share > 0) { $edit .= ",cion=cion+" . User_Cion_Share . ""; } if (User_Jinyan_Share > 0) { $edit .= ",jinyan=jinyan+" . User_Jinyan_Share . ""; } if (!empty($edit)) { $edit = substr($edit, 1); $this->db->query("update " . CS_SqlPrefix . "user set " . $edit . " where id=" . $uid . ""); } } //写入分享记录 $agent = ($this->agent->is_mobile() ? $this->agent->mobile() : $this->agent->platform()) . ' / ' . $this->agent->browser() . ' v' . $this->agent->version(); $add['uid'] = $uid; $add['cion'] = $addid == 1 ? User_Cion_Share : 0; $add['jinyan'] = $addid == 1 ? User_Jinyan_Share : 0; $add['ip'] = getip(); $add['agent'] = $agent; $add['addtime'] = time(); $this->CsdjDB->get_insert('share', $add); //分享访问的地址 $shareurl = 'http://' . Web_Url . Web_Path; header("Location: " . $shareurl); exit; }
function dosave() { $author = dhtmlspecialchars($_POST['author']); $email = dhtmlspecialchars($_POST['email']); $url = dhtmlspecialchars($_POST['url']); $content = dhtmlspecialchars($_POST['content']); empty($author) && exit('昵称不能为空!'); empty($content) && exit('留言内容不能为空!'); WordFilter($author) && exit('昵称包含被系统屏蔽的字符,请返回重新填写。'); WordFilter($url) && exit('您的网址包含被系统屏蔽的字符,请返回重新填写。'); WordFilter($content) && exit('留言内容包含被系统屏蔽的字符,请返回重新填写。'); !preg_match("/^([\\w\\.-]+)@([a-zA-Z0-9-]+)(\\.[a-zA-Z\\.]+)\$/i", $email) && exit('邮箱格式错误!'); strpos($url, 'http://') === false && ($url = 'http://' . $url); iCMS_DB::query("INSERT INTO `#iCMS@__plugins_message` (`author`,`email`,`url`,`content`,`reply`,`addtime`,`ip`,`status`) VALUES ('{$author}','{$email}','{$url}','{$content}','','" . time() . "','" . getip() . "','0')"); exit('1'); }
function checklogin($a, $p, $Ret = false) { $ip = getip(); if (empty($a) && empty($p)) { $auth = get_cookie('auth'); list($a, $p) = explode('#=iCMS[' . $ip . ']=#', authcode($auth, 'DECODE')); return self::checkadmin($a, $p, $Ret); } else { $crs = self::checkadmin($a, $p, $Ret); set_cookie('auth', authcode($a . '#=iCMS[' . $ip . ']=#' . $p, 'ENCODE')); iCMS_DB::query("UPDATE `#iCMS@__admin` SET `lastip`='" . $ip . "',`lastlogintime`='" . time() . "',`logintimes`=logintimes+1 WHERE `uid`='" . self::$uId . "'"); !$Ret && javascript::dialog("登陆成功!", 'url:' . __SELF__); //UI::redirect('登陆成功, 请稍候......', __SELF__); return $crs; } }
function searchcloud_insert($word) { global $mc1, $INSTALLER09; $searchcloud = searchcloud(); $ip = getip(); $howmuch = isset($searchcloud[$word]) ? $searchcloud[$word] + 1 : 1; if (!count($searchcloud) || !isset($searchcloud[$word])) { $searchcloud[$word] = $howmuch; $mc1->cache_value('searchcloud', $searchcloud, 0); } else { $mc1->begin_transaction('searchcloud'); $mc1->update_row(false, array($word => $howmuch)); $mc1->commit_transaction(0); } sql_query('INSERT INTO searchcloud(searchedfor,howmuch,ip) VALUES (' . sqlesc($word) . ',1,' . sqlesc($ip) . ') ON DUPLICATE KEY UPDATE howmuch=howmuch+1') or sqlerr(__FILE__, __LINE__); }
public function index() { $data['ip'] = getip(); $data['ipint'] = ip2long($data['ip']); //echo $data['ip'] ; $data['dev_name'] = getconfig("./data/setting.inc.php", "dev_name", $type = "string"); $server = getconfig("./data/setting.inc.php", "monitor_url", $type = "string"); //echo $data['dev_name']; $data['dev_num'] = dev_num(); $sumary = request('summary'); $data['asc_mhs_5s'] = $sumary['SUMMARY']['MHS 5s']; //$data_array[0]; $data['asc_mhs_5m'] = $sumary['SUMMARY']['MHS 5m']; //$data_array[1]; $data['asc_mhs_15m'] = $sumary['SUMMARY']['MHS 15m']; //$data_array[2]; $data['asc_mhs_av'] = $sumary['SUMMARY']['MHS av']; $data['asc_last_share_time'] = $sumary['SUMMARY']['Last getwork']; $data['event_time'] = time(); //var_dump($sumary); //$url=$server."?ip=".$data['ip'].'&dev_name='.$data['dev_name'].'&ipint='.$data['ipint'].'&dev_num\='.$data['dev_num'].'\&asc_mhs_av\='.$data['asc_mhs_av'].'\&asc_mhs_5m\='.$data['asc_mhs_5m'].'\&asc_mhs_5s\='.$data['asc_mhs_5s'].'\&asc_mhs_15m\='.$data['asc_mhs_15m'].'\&asc_last_share_time\='.$data['asc_last_share_time'].'\&event_time\='.$data['event_time']; //echo $url; $miner_data['ip'] = $data['ip']; $miner_data['ipint'] = $data['ipint']; $miner_data['dev_name'] = $data['dev_name']; $miner_data['dev_num'] = $data['dev_num']; $miner_data['asc_mhs_5s'] = $data['asc_mhs_5s']; $miner_data['asc_mhs_5m'] = $data['asc_mhs_5m']; $miner_data['asc_mhs_15m'] = $data['asc_mhs_15m']; $miner_data['asc_mhs_av'] = $data['asc_mhs_av']; $miner_data['asc_last_share_time'] = $data['asc_last_share_time']; $miner_data['event_time'] = $data['event_time']; $miner_json = json_encode($miner_data); $url = $server . "index.php?c=home&m=getdata&data=" . $miner_json; //echo $this->curl->submit($server, $miner_data); //echo "dd";$url //$re=geturl($url); exec("sudo /usr/bin/lynx -source " . $url . " &", $command, $output); //exec('wget '.$url.' > /dev/null &') //echo $url; //var_dump($re) ;//$re; var_dump($command); //var_dump($output); }
function slog() { global $config; $this->statusdata = array(); $this->ip = getip(); $this->sid = ''; $this->cookies = FALSE; $this->cookiedata = array(0, ''); $this->cookielastvisit = 0; $this->defineGID(); $this->bots = cache_spiders(); $this->bi = BotDetection($this->bots, $_SERVER['HTTP_USER_AGENT'], TRUE); $this->gFields = array('downloadfiles', 'forum', 'posttopics', 'postreplies', 'addvotes', 'attachments', 'edit', 'voting', 'admin', 'gmod', 'guest', 'members', 'profile', 'pdf', 'pm', 'wwo', 'search', 'team', 'usepic', 'useabout', 'usesignature', 'docs'); $this->fFields = array('f_downloadfiles', 'f_forum', 'f_posttopics', 'f_postreplies', 'f_addvotes', 'f_attachments', 'f_edit', 'f_voting'); $this->minFields = array('flood'); $this->maxFields = array(); $this->groups = array(); $this->permissions = array(); $this->querysid = TRUE; $this->positive = array(); $this->negative = array(); $this->boards = array(); }
function addscore($id, $score) { if ($score <= 0 || $score > 5) { exit('score_illegal'); } $info = DB::queryFirstRow('SELECT * FROM rating WHERE itemid=' . $id); if (!$info) { //exit("$id info_not_found"); DB::insert('rating', array('itemid' => $id)); } $myscore = DB::queryFirstRow('SELECT * FROM rating_log WHERE itemid=' . $id . ' AND ip=\'' . getip() . '\' ORDER BY timestamp DESC'); if (!$myscore) { $newscore = $info['totalrate'] + $score; DB::update('rating', array('totalrate' => $newscore, 'ratenum' => $info['ratenum'] + 1), "itemid={$id}"); DB::insert('rating_log', array('ip' => getip(), 'itemid' => $id, 'score' => $score, 'timestamp' => time(), 'opt' => 1)); } else { //update $newscore = $info['totalrate'] + $score - $myscore['score']; DB::update('rating', array('totalrate' => $newscore, 'ratenum' => $info['ratenum']), "itemid={$id}"); DB::insert('rating_log', array('ip' => getip(), 'itemid' => $id, 'score' => $score, 'timestamp' => time(), 'opt' => 0)); } return true; }
public function write($id, $data) { $uid = isset($_SESSION['cscms__id']) ? $_SESSION['cscms__id'] : 0; $plub = defined('PLUBPATH') ? PLUBPATH : ''; if (strlen($data) > 255) { $data = ''; } $ip = getip(); $sessiondata = array('sessionid' => $id, 'uid' => $uid, 'ip' => $ip, 'addtime' => time(), 'plub' => $plub, 'data' => $data); $this->CI->db->where('sessionid', $id); $row = $this->CI->db->get($this->table)->row(); if ($row) { unset($sessiondata['sessionid']); $this->CI->db->where('sessionid', $id); $this->CI->db->update($this->table, $sessiondata); return true; } else { if (!empty($data)) { $this->CI->db->insert($this->table, $sessiondata); } return true; } }
public function AdminIndex($param) { $config = $this->getConfig(); if (extension_loaded('curl')) { $url = "http://yershop.com/index.php?s=/Home/Check/check.html"; $post_data = array('version' => '1.5', 'domain' => $_SERVER['HTTP_HOST'], 'auth' => sha1(C('DATA_AUTH_KEY')), 'ip' => getip(), 'domainip' => get_onlineip()); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 我们在POST数据哦! curl_setopt($ch, CURLOPT_POST, 1); // 把post的变量加上 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); $data = curl_exec($ch); curl_close($ch); } if (!empty($data) && strlen($data) < 400 && strlen($data) > 3) { $config['new_version'] = $data; } $this->assign('addons_config', $config); if ($config['display']) { $this->display('widget'); } }