コード例 #1
3
ファイル: Index.php プロジェクト: klsf/kldns
 public function index()
 {
     $action = I("post.action");
     if ($action == "login") {
         $user = I("post.user");
         $pwd = I("post.pwd");
         if (strlen($user) < 3 || strlen($pwd) < 5) {
             $this->assign("alert", sweetAlert("温馨提示", "用户名或者密码格式不正确!", "warning"));
         } else {
             $pwd = md5Pwd($pwd);
             if ($user = $this->pdo->find("select uid from pre_users where (user=:user or email=:user) and pwd=:pwd limit 1", array(":user" => $user, ":pwd" => $pwd))) {
                 $sid = getSid();
                 $this->pdo->execute("update pre_users set sid=:sid where uid=:uid limit 1", array(":uid" => $user['uid'], ":sid" => $sid));
                 Cookie::set("userSid", $sid, array("path" => "/", "expire" => 3600 * 24));
                 $this->assign("alert", sweetAlert("登录成功!", "欢迎回来,进入控制面板!", "success", U("/index/Panel/index")));
                 return $this->fetch("common/sweetAlert");
             } else {
                 $this->assign("alert", sweetAlert("温馨提示", "用户名或者密码不正确!", "warning"));
             }
         }
     } elseif ($action == "reg") {
         $this->assign("isReg", true);
         $user = I("post.user");
         $pwd = I("post.pwd");
         $email = strtolower(I("post.email"));
         $code = I("post.code");
         if (strlen($user) < 3) {
             $this->assign("alert", sweetAlert("温馨提示", "用户名太短!", "warning"));
         } elseif (strlen($pwd) < 5) {
             $this->assign("alert", sweetAlert("温馨提示", "密码太简单!", "warning"));
         } elseif (strlen($code) != 4 || !isset($_COOKIE['verification']) || md5(strtolower($code)) !== $_COOKIE['verification']) {
             $this->assign("alert", sweetAlert("温馨提示", "验证码错误!", "warning"));
         } elseif (!preg_match('/^[a-zA-Z0-9\\-\\_]+@[a-zA-Z0-9\\-]+\\.[a-zA-Z]+$/', $email)) {
             $this->assign("alert", sweetAlert("温馨提示", "邮箱格式不正确!", "warning"));
         } elseif ($this->pdo->find("select uid from pre_users where user=:user limit 1", array(":user" => $user))) {
             $this->assign("alert", sweetAlert("温馨提示", "用户名已存在!", "warning"));
         } elseif ($this->pdo->find("select uid from pre_users where email=:email limit 1", array(":email" => $email))) {
             $this->assign("alert", sweetAlert("温馨提示", "邮箱账号已存在!", "warning"));
         } else {
             setCookie('verification', null, -1, '/');
             //销毁验证码
             $insert = array();
             $insert[':user'] = $user;
             $insert[':pwd'] = md5Pwd($pwd);
             $insert[':email'] = $email;
             $insert['sid'] = getSid();
             if ($this->pdo->execute("INSERT INTO `pre_users` (`user`, `email`, `pwd`, `sid`, `regtime`) VALUES (:user, :email, :pwd, :sid, NOW())", $insert)) {
                 $this->assign("alert", sweetAlert("注册成功!", "马上登录!", "success", U("index")));
                 return $this->fetch("common/sweetAlert");
             } else {
                 $this->assign("alert", sweetAlert("温馨提示", "注册失败,请稍候再试!", "warning"));
             }
         }
     }
     $this->assign("webTitle", C("webTitle") ? C("webTitle") : "网站首页");
     return $this->fetch();
 }
コード例 #2
0
ファイル: input.php プロジェクト: mjiong/framework
 static function cookie()
 {
     $param = func_get_args();
     if (func_num_args() === 1) {
         $key = $param[0];
         if (is_array($param[0])) {
             $key = $param[0][0];
             if (isset($param[0][1]) && $param[0][1]) {
                 $key = secure::token($param[0][0]);
             }
         }
         if (isset($_COOKIE[$key])) {
             if (is_numeric($_COOKIE[$key]) && $_COOKIE[$key] <= 2147483647) {
                 return $_COOKIE[$key] + 0;
             }
             return secure::symbol(trim(htmlspecialchars(strip_tags($_COOKIE[$key]))));
         }
         return null;
     }
     list($key, $value) = $param;
     $expire = isset($param[2]) ? $param[2] : 31536000;
     if (isset($param[3]) && $param[3]) {
         $key = secure::token($key);
     }
     $expire += time();
     return setCookie($key, $value, $expire, '/', trim(SITE_DOMAIN, 'www.'));
 }
コード例 #3
0
ファイル: AgentManager.php プロジェクト: Symbiota/Symbiota
 public function reset()
 {
     global $clientRoot;
     setCookie("colltaxa", "", time() - 3600, $clientRoot ? $clientRoot : '/');
     setCookie("collsearch", "", time() - 3600, $clientRoot ? $clientRoot : '/');
     setCookie("collvars", "", time() - 3600, $clientRoot ? $clientRoot : '/');
     $this->reset = 1;
     if (array_key_exists("db", $this->searchTermsArr) || array_key_exists("oic", $this->searchTermsArr)) {
         //reset all other search terms except maintain the db terms
         $dbsTemp = "";
         if (array_key_exists("db", $this->searchTermsArr)) {
             $dbsTemp = $this->searchTermsArr["db"];
         }
         $clidTemp = "";
         if (array_key_exists("clid", $this->searchTermsArr)) {
             $clidTemp = $this->searchTermsArr["clid"];
         }
         unset($this->searchTermsArr);
         if ($dbsTemp) {
             $this->searchTermsArr["db"] = $dbsTemp;
         }
         if ($clidTemp) {
             $this->searchTermsArr["clid"] = $clidTemp;
         }
     }
 }
コード例 #4
0
ファイル: gcms.php プロジェクト: boyatomic32/movie
 /**
  * โหลด GCMS เพื่อแสดงผลหน้าเว็บไซต์
  */
 public function run()
 {
     /**
      * inint session
      */
     session_start();
     if (!ob_get_status()) {
         if (extension_loaded('zlib') && !ini_get('zlib.output_compression')) {
             // เปิดใช้งานการบีบอัดหน้าเว็บไซต์
             ob_start('ob_gzhandler');
         } else {
             ob_start();
         }
     }
     /**
      * โหลด GCMS
      */
     $this->inint();
     /**
      * save variable
      */
     setCookie('gcms_language', LANGUAGE, time() + 3600 * 24 * 365);
     /**
      * create Router
      */
     self::createClass('Core\\Router');
     /**
      * return current instance
      */
     return self::$instance;
 }
コード例 #5
0
ファイル: Response.php プロジェクト: locphp/rsf
 protected function send()
 {
     if (!headers_sent()) {
         $code = $this->getStatusCode();
         $version = $this->getProtocolVersion();
         if ($code !== 200 || $version !== '1.1') {
             header(sprintf('HTTP/%s %d %s', $version, $code, $this->getReasonPhrase()));
         }
         foreach ($this->headers as $key => $value) {
             $key = ucwords(strtolower($key), '-');
             if (is_array($value)) {
                 $value = implode(',', $value);
             }
             header(sprintf('%s: %s', $key, $value));
         }
         foreach ($this->cookies as $cookie) {
             list($name, $value, $expire, $path, $domain, $secure, $httponly) = $cookie;
             setCookie($name, $value, $expire, $path, $domain, $secure, $httponly);
         }
     }
     $body = $this->getBody();
     if ($body instanceof IteratorStream) {
         foreach ($body->iterator() as $string) {
             echo $string;
         }
     } else {
         echo (string) $body;
     }
 }
コード例 #6
0
ファイル: system.php プロジェクト: notzen/ImpressPages-CMS
 public function catchEvent($moduleGroup, $moduleName, $event, $parameters)
 {
     global $session;
     global $parametersMod;
     if (!isset($session) || $session->loggedIn()) {
         //in admin.php $session is not defined on time of this event.
         return;
     }
     if (!$parametersMod->getValue('community', 'user', 'options', 'enable_autologin')) {
         return;
     }
     if ($moduleGroup == 'administrator' && $moduleName == 'system' && $event == 'init') {
         if (isset($_COOKIE[Config::$autologinCookieName])) {
             $jsonData = $_COOKIE[Config::$autologinCookieName];
             $data = json_decode($jsonData);
             if ($data && isset($data->id) && isset($data->pass)) {
                 $tmpUser = Db::userById($data->id);
                 if ($tmpUser) {
                     if (md5($tmpUser['password'] . $tmpUser['created_on']) == $data->pass) {
                         $session->login($tmpUser['id']);
                         setCookie(Config::$autologinCookieName, json_encode(array('id' => $tmpUser['id'], 'pass' => md5($tmpUser['password'] . $tmpUser['created_on']))), time() + $parametersMod->getValue('community', 'user', 'options', 'autologin_time') * 60 * 60 * 24, Config::$autologinCookiePath, Config::getCookieDomain());
                     }
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: AuthMiddleware.php プロジェクト: Soul0806/MyWeb
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Session::has('role')) {
         return redirect('/login');
     }
     if (!isset($_COOKIE['login'])) {
         $visitorCount = 1;
     }
     $setTime = time() + 3600;
     if (isset($_COOKIE['login'])) {
         $visitorCount = $_COOKIE['login'] + 1;
         setCookie('login', $visitorCount, $setTime);
     } else {
         setCookie('login', $visitorCount, $setTime);
     }
     if (!Session::has('anchor')) {
         session(['anchor' => '2']);
     }
     assert_options(ASSERT_ACTIVE, 1);
     assert_options(ASSERT_WARNING, 0);
     assert_options(ASSERT_QUIET_EVAL, 1);
     assert_options(ASSERT_CALLBACK, 'my_assert_handler');
     $old_error_handler = set_error_handler("myErrorHandler");
     return $next($request);
 }
コード例 #8
0
ファイル: tSession.php プロジェクト: longmonhau/Half-Life
 public static function clear()
 {
     $session = Factory::make('session');
     $user_login_key_old = $session->get("_login_cookie_key");
     setCookie($user_login_key_old, '', time() - 1, '/');
     $session->clear();
 }
コード例 #9
0
ファイル: twitese.php プロジェクト: BGCX261/zlbnc-svn-to-git
function verify($name, $password, $remember)
{
    $t = new twitter($name, $password, user_type());
    $user = $t->veverify();
    if (!isset($user->error) && isset($user->name)) {
        $time = $remember ? time() + 3600 * 24 * 365 : 0;
        setEncryptCookie('twitterID', $name, $time, '/');
        setEncryptCookie('twitterPW', $password, $time, '/');
        setcookie('friends_count', $user->friends_count, $time, '/');
        setcookie('statuses_count', $user->statuses_count, $time, '/');
        setcookie('followers_count', $user->followers_count, $time, '/');
        setcookie('imgurl', $user->profile_image_url, $time, '/');
        setcookie('name', $user->name, $time, '/');
        $twDM = $t->directMessages(false, false, 1);
        if ($twDM === false) {
        } else {
            if (count($twDM) == 0) {
            } else {
                setCookie("meSinceId", $twDM[0]->id);
            }
        }
        return true;
    } else {
        return false;
    }
}
コード例 #10
0
ファイル: response.php プロジェクト: neoisldl/Onion
 public function sendHeader()
 {
     // session必须要先于header处理
     // 否则会覆盖header内对于Cache-Control的处理
     if ($this->session) {
         if (!isset($_SESSION)) {
             session_start();
         }
         foreach ($this->session as $sess) {
             list($path, $val) = $sess;
             array_set($_SESSION, $path, $val);
         }
         $this->session = array();
     }
     foreach ($this->cookie as $name => $config) {
         list($value, $expire, $path, $domain, $secure, $httponly) = $config;
         setCookie($name, $value, $expire, $path, $domain, $secure, $httponly);
     }
     $this->cookie = array();
     if (is_integer($this->code) && $this->code != 200) {
         if ($status = self::httpStatus($this->code)) {
             header($status);
         }
     }
     foreach ($this->header as $name => $value) {
         $header = $value === null ? $name : $name . ': ' . $value;
         header($header);
     }
     $this->header = array();
     return $this;
 }
コード例 #11
0
ファイル: Cookie.php プロジェクト: visor/nano
 /**
  * @return void
  * @param string $name
  */
 public function erase($name)
 {
     if (!headers_sent()) {
         setCookie($name, null, -1, '/', $this->domain, $this->secure, $this->httpOnly);
     }
     unset($_COOKIE[$name]);
 }
コード例 #12
0
ファイル: log.php プロジェクト: extendgears/php-components
function logUserOut()
{
    setSessionVar('login', false);
    setCookie('keep_log', '0', time() - 3600, '/', $_SERVER['HTTP_HOST'], false, true);
    unset($_COOKIE['keep_log']);
    quitSession();
}
コード例 #13
0
 private function setAuthCookie($md5_pw)
 {
     $remember_time = time() + 60 * 60 * 24 * 30;
     $user = $this->getSessionUser();
     $auth_token = $this->createAuthToken($user->userid, $user->email, $md5_pw);
     setCookie("sc_auth", $auth_token, $remember_time);
 }
コード例 #14
0
ファイル: index.class.php プロジェクト: justinyaoqi/qyhr
 function index_action()
 {
     if ($_COOKIE['uid'] != "" && $_COOKIE['username'] != "") {
         if ($_GET['type'] == "out") {
             if ($this->config['sy_uc_type'] == "uc_center") {
                 $M = $this->MODEL();
                 $M->uc_open();
                 $logout = uc_user_synlogout();
             } elseif ($this->config['sy_pw_type']) {
                 include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php";
                 $username = $_SESSION['username'];
                 $pw = new PwClientAPI($username, "", "");
                 $logout = $pw->logout();
                 $this->unset_cookie();
             } else {
                 $this->unset_cookie();
             }
         } else {
             $this->ACT_msg("index.php", "您已经登录了!");
         }
     }
     if ($_GET['backurl'] == '1') {
         setCookie("backurl", $_SERVER['HTTP_REFERER'], time() + 60);
     }
     if (!$_GET['usertype']) {
         $_GET['usertype'] = 1;
     }
     $this->yunset("usertype", $_GET['usertype']);
     $this->yunset("loginname", $_COOKIE['loginname']);
     $this->seo("login");
     $this->yun_tpl(array('index'));
 }
コード例 #15
0
ファイル: user.php プロジェクト: istrwei/hu60wap6
 /**
 * 设置身份验证Cookie(sid)
 */
 public function setCookie()
 {
     if (!self::$data[$this->uid]['islogin']) {
         throw new userexception('用户未登陆,不能设置身份验证Cookie。', 2503);
     }
     return setCookie(COOKIE_A . 'sid', self::$data[$this->uid]['sid'], $_SERVER['REQUEST_TIME'] + DEFAULT_LOGIN_TIMEOUT, COOKIE_PATH, COOKIE_DOMAIN);
 }
コード例 #16
0
ファイル: image.php プロジェクト: andripriyanto/WebTKJ-BPI
 function counter()
 {
     $hits = get_option('simplevisitorcounter_data');
     if (is_404()) {
         if (!get_option('simplevisitorcounter_count_404')) {
             // if its a 404 page and theres no explicit rule to count 404s, lets bail
             return;
         }
     }
     if (get_option('simplevisitorcounter_count_only_unique')) {
         if (!$_COOKIE['simplevisitorcounter_seen']) {
             setCookie("simplevisitorcounter_seen", "1", time() + 3600 * 24);
         } else {
             // bail if non unique and we're only counting uniques
             return;
         }
     }
     /* check if hit comes from wp-admin */
     if (is_admin()) {
         if (get_option('simplevisitorcounter_count_admin')) {
             update_option('simplevisitorcounter_data', $hits + 1);
         }
     } else {
         $exclude_list = split("\n", get_option('simplevisitorcounter_exclude_ips'));
         if (!in_array($_SERVER['REMOTE_ADDR'], $exclude_list)) {
             update_option('simplevisitorcounter_data', $hits + 1);
         }
     }
 }
コード例 #17
0
 public static function generateCookie($jabberId, $secret)
 {
     $id = trim($jabberId . ":" . $secret);
     $cookie = setCookie("tokboxId", $id, 0);
     $url = Site_Config::BASE_SITE . "index.php";
     header("Location: {$url}");
 }
コード例 #18
0
ファイル: Panel.php プロジェクト: klsf/kldns
 public function index()
 {
     $action = I("post.action");
     if ($action == 'addrecord') {
         $this->assign("isAdd", true);
         $domain_id = I("post.domain_id");
         $name = trim(strtolower(I("post.name")));
         $type = I("post.type");
         $value = I("post.value");
         $code = I("post.code");
         if (strlen($code) != 4 || !isset($_COOKIE['verification']) || md5(strtolower($code)) !== $_COOKIE['verification']) {
             $this->assign("alert", sweetAlert("温馨提示", "验证码不正确", "warning"));
         } elseif (C("allowNum") == -1) {
             $this->assign("alert", sweetAlert("温馨提示", "站长已经关闭用户自助解析功能!", "warning"));
         } elseif (!$this->checkAllow($name)) {
             $this->assign("alert", sweetAlert("温馨提示", "对不起,前缀{$name}不允许用户解析!", "warning"));
         } elseif (C("allowNum") && $this->pdo->getCount("select record_id from pre_records where uid=:uid", array(":uid" => $this->userInfo['uid'])) >= C("allowNum")) {
             $this->assign("alert", sweetAlert("温馨提示", "你最大允许解析" . C("allowNum") . "条记录!", "warning"));
         } elseif (!($row = $this->pdo->find("select dns,name from pre_domains where domain_id=:id and level <= :level limit 1", array(":id" => $domain_id, ":level" => $this->userInfo['level'])))) {
             $this->assign("alert", sweetAlert("温馨提示", "所选择域名不存在!", "warning"));
         } else {
             setCookie('verification', null, -1, '/');
             //销毁验证码
             $klsfDns = KlsfDns::getApi($row['dns']);
             if ($ret = $klsfDns->addRecord($domain_id, $name, $type, $value, $row['name'])) {
                 $insert = array(':record_id' => $ret['record_id'], ':uid' => $this->userInfo['uid'], ':domain_id' => $domain_id, ':name' => $ret['name'], ':type' => $type, ':value' => $value);
                 if ($this->pdo->execute("INSERT INTO `pre_records` (`record_id`, `uid`, `domain_id`, `name`, `type`, `value`, `updatetime`) VALUES (:record_id, :uid, :domain_id, :name, :type, :value, NOW())", $insert)) {
                     $this->assign("isAdd", false);
                     $this->assign("alert", sweetAlert("添加成功", "添加记录成功!", "success"));
                 } else {
                     $this->assign("alert", sweetAlert("温馨提示", "解析成功,保存数据库失败!", "warning"));
                 }
             } else {
                 $info = $klsfDns->getErrorInfo();
                 $this->assign("alert", sweetAlert("温馨提示", $info['msg'], "warning"));
             }
         }
     }
     //获取记录列表
     $records = $this->pdo->selectAll("select a.*,b.name as domain,b.dns from pre_records as a left join pre_domains as b on b.domain_id=a.domain_id where a.uid=:uid", array(":uid" => $this->userInfo['uid']));
     //获取域名列表
     $domains = $this->pdo->selectAll("select * from pre_domains where `level` <= :level", array(":level" => $this->userInfo['level']));
     //遍历记录检查是否还存在,不存在则从数据库删除
     $newRecords = array();
     foreach ($records as $record) {
         $klsfDns = KlsfDns::getApi($record['dns']);
         if ($re = $klsfDns->getRecordInfo($record['domain_id'], $record['record_id'])) {
             $re['domain'] = $record['domain'];
             $newRecords[] = $re;
         } else {
             //不存在则删除记录
             $this->pdo->execute("delete from pre_records where record_id=:id limit 1", array(":id" => $record['record_id']));
         }
     }
     $this->assign("records", $newRecords);
     $this->assign("domains", $domains);
     $this->assign("webTitle", "控制面板");
     return $this->fetch();
 }
コード例 #19
0
 function ModulePage()
 {
     global $PIO;
     $err = '';
     // 錯誤資訊
     $res = isset($_GET['r']) ? intval($_GET['r']) : 0;
     // 回應編號
     if (isset($_GET['dm'])) {
         // 是否進入設定模式
         $ss = $ms = $ls = '';
         switch ($this->displayMode) {
             case 's':
                 $ss = ' selected="selected"';
                 break;
             case 'm':
                 $ms = ' selected="selected"';
                 break;
             case 'l':
                 $ls = ' selected="selected"';
                 break;
         }
         $this->mobileHead($err, TITLE . ' - 設定');
         $err .= '<div>[<a href="' . $this->thisPage . '">回首頁</a>]<br/><form action="' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $this->thisPage) . '" method="post">顯示模式:<br/><select name="dm"><option value="s"' . $ss . '>精簡 (無圖,裁字)</option><option value="m"' . $ms . '>一般 (無圖,全字)</option><option value="l"' . $ls . '>完整 (有圖,全字)</option></select><br/><input type="submit" value="儲存"/></form></div><div id="f">-Pixmicat!m-</div></body></html>';
     } else {
         if (isset($_POST['dm'])) {
             setCookie('dm', $this->displayMode = $_POST['dm'], time() + 604800);
         }
         if ($res !== 0) {
             $pageMax = $page = null;
             // Not in use
             if (!$PIO->isThread($res)) {
                 $err = 'Thread Not Found';
             } else {
                 $post = $PIO->fetchPosts($PIO->fetchPostList($res));
             }
         } else {
             $pageMax = ceil($PIO->threadCount() / $this->THREADLIST_NUMBER) - 1;
             // 分頁最大編號
             $page = isset($_GET['p']) ? intval($_GET['p']) : 0;
             // 目前所在分頁
             if ($page < 0 || $page > $pageMax) {
                 $err = 'Page Out of Range';
             } else {
                 $post = $PIO->fetchPosts($PIO->fetchThreadList($this->THREADLIST_NUMBER * $page, $this->THREADLIST_NUMBER, true));
             }
             // 編號由大到小排序取出
         }
     }
     if ($err) {
         echo $err;
     } else {
         $dat = '';
         // HTML Buffer
         $this->mobileHead($dat, TITLE);
         $this->mobileBody($dat, $pageMax, $page, $res, $post);
         $this->mobileFoot($dat);
         echo $dat;
     }
 }
コード例 #20
0
 public function logOut()
 {
     setCookie('username', '', 0, '/');
     setCookie('pwd', '', 0, '/');
     unset($_SESSION);
     session_destroy();
     $this->redirect('Login/index');
 }
コード例 #21
0
ファイル: auth.php プロジェクト: eharmon/yelly
function setAuthToken($uid)
{
    $rnd = md5(uniqid(rand(), true));
    $sql = "UPDATE lylina_users\n                   SET magic = '{$rnd}'\n                 WHERE id = {$uid}";
    runSQL($sql);
    setCookie('lylina_auth', $rnd, time() + 60 * 60 * 24 * 365);
    setCookie('lylina_uid', $uid, time() + 60 * 60 * 24 * 365);
}
コード例 #22
0
function destroySession()
{
    $_SESSION = [];
    if (session_id() != '' || isset($_SESSION)) {
        setCookie(session_name(), '', time() - 2592000);
    }
    session_destroy();
}
コード例 #23
0
ファイル: functions.inc.php プロジェクト: dalinhuang/shopexts
function saveUsers($aUsers)
{
    global $sModule;
    $iTime = time() + 31536000;
    foreach ($aUsers as $sKey => $aValue) {
        setCookie("ray_" . $sModule . "_" . $sKey, implode(",", $aValue), $iTime);
    }
}
コード例 #24
0
ファイル: KurogoStats.php プロジェクト: nncsang/Kurogo
 private static function setVisitCookie($visitID = null)
 {
     if (empty($visitID)) {
         $visitID = md5(uniqid(rand(), true));
     }
     setCookie('visitID', $visitID, time() + Kurogo::getOptionalSiteVar('KUROGO_VISIT_LIFESPAN', 1800), COOKIE_PATH);
     return $visitID;
 }
コード例 #25
0
ファイル: sso.php プロジェクト: uinerd/Code
 /**
  * Delete the SSO cookie
  */
 public static function delCookie()
 {
     $config = JFactory::getConfig();
     $domain = $config->get('lgCookieDomain', '');
     $d = $domain ? " ({$domain})" : '';
     lgDebug("SSO cookie deleted{$d}: " . substr($_COOKIE[self::$cookie], 0, 5));
     unset($_COOKIE[self::$cookie]);
     setCookie(self::$cookie, '', time() - 3600, '/', $domain);
 }
コード例 #26
0
ファイル: Login.php プロジェクト: Tobuk/barcode_warrior
 public function logout()
 {
     $this->load->library('facebook');
     // Logs off session from website
     $this->facebook->destroySession();
     // Make sure you destory website session as well.
     setCookie("code", "", 1, "/", "barcode.geo7.me");
     redirect('Welcome/login');
 }
コード例 #27
0
ファイル: model.php プロジェクト: xupnge1314/sscpms
    /**
     * Create the select code of products. 
     * 
     * @param  array     $products 
     * @param  int       $productID 
     * @param  string    $currentModule 
     * @param  string    $currentMethod 
     * @param  string    $extra 
     * @access public
     * @return string
     */
    public function select($products, $productID, $currentModule, $currentMethod, $extra = '')
    {
        if(!$productID) return;

        setCookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot);
        $currentProduct = $this->getById($productID);
        $output = "<a id='currentItem' href=\"javascript:showDropMenu('product', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$currentProduct->name} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
        return $output;
    }
コード例 #28
0
ファイル: ResetPass.php プロジェクト: noikiy/cxe
function ResetPass()
{
    global $msql, $SiteUrl;
    global $strLostpassNtc1, $strLostpassNtc2, $strLostpassNtc3, $strLostpassNtc4, $strLostpassNtc5;
    global $strLostpassNtc6, $strLostpassNtc7, $strLostpassNtc8, $strLostpassNtc9;
    $coltitle = $GLOBALS["PLUSVARS"]["coltitle"];
    $tempname = $GLOBALS["PLUSVARS"]["tempname"];
    $Temp = LoadTemp($tempname);
    $step = $_REQUEST["step"];
    if ($step == "checkmail") {
        $codestr = $_GET["codestr"];
        $username = $_GET["username"];
        $tm = $_GET["tm"];
        if (!isset($_COOKIE["NEWPASSWD"]) || $_COOKIE["NEWPASSWD"] == "") {
            $PageMain = err($strLostpassNtc7, "lostpass.php", "");
            return $PageMain;
        }
        $md5 = md5($username . "Z(o)C~LoSbZ8Tj7MvBAs(8)!nn^Lp^12345^Pm" . $_COOKIE["NEWPASSWD"] . $tm);
        if ($md5 == $codestr) {
            $mdpass = md5($_COOKIE["NEWPASSWD"]);
            $msql->query("update {P}_member set password='******' where user='******'");
            $PageMain = SayOk($strLostpassNtc8, "login.php", "");
            return $PageMain;
        } else {
            $PageMain = err($strLostpassNtc9, "lostpass.php", "");
            return $PageMain;
        }
    } elseif ($step == "2") {
        $username = $_POST["username"];
        $newpass = $_POST["newpass"];
        if (!isset($username) || $username == "" || $newpass == "") {
            $str = err($strLostpassNtc1, "", "");
            return $str;
        } else {
            $msql->query("select email from {P}_member where user='******'");
            if ($msql->next_record()) {
                $email = $msql->f('email');
                $tm = time();
                setCookie("NEWPASSWD", $newpass, time() + 7200);
                $md5 = md5($username . "Z(o)C~LoSbZ8Tj7MvBAs(8)!nn^Lp^12345^Pm" . $newpass . $tm);
                $link = $SiteUrl . "lostpass.php?step=checkmail&username="******"&codestr=" . $md5 . "&tm=" . $tm;
                $message = $username . $strLostpassNtc2 . "\r\n \r\n" . $strLostpassNtc3 . "\r\n \r\n" . $link . "\r\n \r\n" . $GLOBALS["CONF"]["SiteName"] . "\r\n" . $GLOBALS["CONF"]["SiteHttp"];
                include ROOTPATH . "includes/ebmail.inc.php";
                ebmail($email, $GLOBALS["CONF"]["SiteEmail"], $strLostpassNtc4, $message);
                $str = SayOk($strLostpassNtc5 . "<br><br>" . $email, "", "");
                return $str;
            } else {
                $str = err($strLostpassNtc6, "", "");
                return $str;
            }
        }
    } else {
        $var = array('coltitle' => $coltitle);
        $str = ShowTplTemp($Temp, $var);
        return $str;
    }
}
コード例 #29
0
ファイル: cookies.php プロジェクト: soengle/BringIt
 public function renew_cookie($user_id)
 {
     if (!isset($_COOKIE['session'])) {
         return;
     }
     setCookie("session", $_COOKIE['session'], time() + self::$logintime, self::$path, self::$domain, self::$secure);
     //			setCookie("expire", time()+1800, time()+self::$logintime, self::$path, self::$domain, self::$secure);
     DB::update("accounts", array("logintime" => strval(time())), "uid=%s", $user_id);
 }
コード例 #30
0
ファイル: common.class.php プロジェクト: justfu/Microclass1.0
 public function getLastTime()
 {
     if (!empty($_COOKIE['time'])) {
         echo "你上次访问的时间为" . $_COOKIE['time'];
         setCookie("time", date("Y-m-d : H:i:s"), time() + 3600);
     } else {
         echo "你是第一次访问啊,欢迎光临本网站";
         setCookie("time", date("Y-m-d:H-m-s"), time() + 3600);
     }
 }