• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP setrawcookie函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中setrawcookie函数的典型用法代码示例。如果您正苦于以下问题:PHP setrawcookie函数的具体用法?PHP setrawcookie怎么用?PHP setrawcookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setrawcookie函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: s_cookie_set

function s_cookie_set($key, $val, $exp, $path)
{
    if (s_bad_string($key)) {
        return false;
    }
    return setrawcookie($key, $val);
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:7,代码来源:devinc.cookie.php


示例2: retrieveByCredentials

 /**
  * Retrieve a user by the given credentials.
  *
  * @param  array $credentials
  * @return $userModel|null
  */
 public function retrieveByCredentials(array $credentials = array())
 {
     if (empty($credentials)) {
         if ($this->isTokenValid($this->tokenId)) {
             $this->setUser($this->tokenId);
             return $this->userModel;
         } else {
             return null;
         }
     }
     $authenticateUri = "/openam/json/authenticate";
     if (!is_null($this->realm)) {
         $authenticateUri = "/openam/json/" . $this->realm . "/authenticate";
     }
     $ch = curl_init($this->serverAddress . $authenticateUri);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-OpenAM-Username: ' . $credentials['username'], 'X-OpenAM-Password: ' . $credentials['password'], 'Content-Type: application/json'));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, false);
     $output = curl_exec($ch);
     if ($output === false) {
         $curlError = curl_error($ch);
         curl_close($ch);
         throw new Exception('Curl error: ' . $curlError);
     } else {
         $json = json_decode($output);
         $this->tokenId = $json->tokenId;
         $this->setUser($this->tokenId);
         curl_close($ch);
         setrawcookie($this->cookieName, $this->tokenId, 0, $this->cookiePath, $this->cookieDomain);
         return $this->userModel;
     }
 }
开发者ID:azamtav,项目名称:openamauth,代码行数:39,代码来源:OpenAmUserProvider.php


示例3: processConnection

 /**
  * process form data for submission to your Act-On external form URL
  * @param string $extPostUrl your external post (Proxy URL) for your Act-On "proxy" form
  */
 public function processConnection($extPostUrl)
 {
     $this->setPostItems('_ipaddr', $this->getUserIP());
     // Act-On accepts manually defined IPs if using field name '_ipaddr'
     $fields = http_build_query($this->getPostItems());
     // encode post items into query-string
     $handle = curl_init();
     curl_setopt($handle, CURLOPT_POST, 1);
     curl_setopt($handle, CURLOPT_URL, "{$extPostUrl}");
     curl_setopt($handle, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
     curl_setopt($handle, CURLOPT_HEADER, 1);
     curl_setopt($handle, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($handle, CURLOPT_POSTFIELDS, $fields);
     $response = curl_exec($handle);
     if ($response === FALSE) {
         $response = "cURL Error: " . curl_error($handle);
     } else {
         preg_match_all('/^Set-Cookie:\\040wp\\s*([^;]*)/mi', $response, $ra);
         // pull response "set-cookie" values from cURL response header
         parse_str($ra[1][0], $cookie);
         // select the "set-cookie" for visitor conversion and store to array $cookie
         // set updated website visitor tracking cookie with processed "set-cookie" content from curl
         setrawcookie('wp' . key($cookie), implode(",", $cookie), time() + 86400 * 365, "/", $this->getDomain($extPostUrl));
         // set cookie expiry date to 1 year
     }
     curl_close($handle);
 }
开发者ID:providervivacity,项目名称:wordpress-ccf-acton,代码行数:32,代码来源:acton-connection.php


示例4: testHeaderSentCookies

 /**
  * @return string
  */
 public function testHeaderSentCookies()
 {
     $_COOKIE['test0'] = 'test0';
     // Create cookies :
     setcookie('test1', 'test1');
     setcookie('test2', 'test2');
     setrawcookie('test3', 'test3');
     setrawcookie('test4', 'test4');
     // Delete, created cookies (with false) :
     setcookie('test1', false);
     setrawcookie('test2', false);
     // Delete, created cookies (with null) :
     setcookie('test3', null);
     setrawcookie('test4', null);
     // Delete others cookies :
     setcookie('testDeleteOther0', null);
     setrawcookie('testDeleteOther1', null);
     // Not send REQUEST_TIME + 0 :
     setrawcookie('testKeyNotSend', 'testValueNotSend', REQUEST_TIME + 0);
     $listOfHeaders = headers_list();
     ob_start();
     print_r($listOfHeaders);
     $result = ob_get_clean();
     $lines = $this->outputTestLineLayout($this->highlightPhp("\$_COOKIE['test0'] = 'test0';\n\n// Create cookies :\nsetcookie('test1', 'test1');\nsetcookie('test2', 'test2');\nsetrawcookie('test3', 'test3');\nsetrawcookie('test4', 'test4');\n\n// Delete, created cookies (with false) :\nsetcookie('test1', false);\nsetrawcookie('test2', false);\n\n// Delete, created cookies (with null) :\nsetcookie('test3', null);\nsetrawcookie('test4', null);\n\n// Delete others cookies :\nsetcookie('testDeleteOther0', null);\nsetrawcookie('testDeleteOther1', null);\n\n// Not send REQUEST_TIME + 0 :\nsetrawcookie('testKeyNotSend', 'testValueNotSend', REQUEST_TIME + 0);"), $this->getDefaultTestLineTitle());
     $lines .= $this->outputTestLineLayout($this->highlightPhp($result, false), self::getDefaultTestResultTitle());
     return $this->outputTestLayout($lines, 'Headers - Create cookies, sent cookies and print headers sent');
 }
开发者ID:nico57c,项目名称:PHP-SimpleApps-PhpUse,代码行数:30,代码来源:HeadersSent.php


示例5: iflychat_get_current_guest_id

function iflychat_get_current_guest_id()
{
    if (isset($_SESSION) && isset($_SESSION['iflychat_guest_id'])) {
        //if(!isset($_COOKIE) || !isset($_COOKIE['drupalchat_guest_id'])) {
        setrawcookie('iflychat_guest_id', rawurlencode($_SESSION['iflychat_guest_id']), time() + 60 * 60 * 24 * 365);
        setrawcookie('iflychat_guest_session', rawurlencode($_SESSION['iflychat_guest_session']), time() + 60 * 60 * 24 * 365);
        //}
    } else {
        if (isset($_COOKIE) && isset($_COOKIE['iflychat_guest_id']) && isset($_COOKIE['iflychat_guest_session']) && $_COOKIE['iflychat_guest_session'] == iflychat_compute_guest_session($_COOKIE['iflychat_guest_id'])) {
            $_SESSION['iflychat_guest_id'] = check_plain($_COOKIE['iflychat_guest_id']);
            $_SESSION['iflychat_guest_session'] = check_plain($_COOKIE['iflychat_guest_session']);
        } else {
            $characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
            $iflychatId = time();
            for ($i = 0; $i < 5; $i++) {
                $iflychatId .= $characters[rand(0, strlen($characters) - 1)];
            }
            $_SESSION['iflychat_guest_id'] = $iflychatId;
            $_SESSION['iflychat_guest_session'] = iflychat_compute_guest_session($_SESSION['iflychat_guest_id']);
            setrawcookie('iflychat_guest_id', rawurlencode($_SESSION['iflychat_guest_id']), time() + 60 * 60 * 24 * 365);
            setrawcookie('iflychat_guest_session', rawurlencode($_SESSION['iflychat_guest_session']), time() + 60 * 60 * 24 * 365);
        }
    }
    return $_SESSION['iflychat_guest_id'];
}
开发者ID:73sl4,项目名称:iflychat-smf-2,代码行数:25,代码来源:helper-iflychat.php


示例6: setLocalCookie

function setLocalCookie($header)
{
    $header_arr = explode("\n", $header);
    foreach ($header_arr as $header_each) {
        if (strpos($header_each, 'Set-Cookie') !== false) {
            $p1 = strpos($header_each, "=");
            $p2 = strpos($header_each, ";");
            $name = substr($header_each, 12, $p1 - 12);
            $value = substr($header_each, $p1 + 1, $p2 - $p1 - 1);
            $expires = null;
            switch ($name) {
                case "cap_id":
                case "_xsrf":
                    // 30 days
                    $expires = time() + 60 * 60 * 24 * 30;
                    break;
                case "q_c1":
                case "_za":
                case "z_c0":
                    // 3 years
                    $expires = time() + 60 * 60 * 24 * 365 * 3;
                    break;
                case "unlock_ticket":
                    // 4 hours
                    $expires = time() + 60 * 60 * 4;
                    break;
            }
            setrawcookie($name, $value, $expires, "/");
        }
    }
}
开发者ID:nkzxw,项目名称:zhihu-voter,代码行数:31,代码来源:functions.php


示例7: set

 public function set($key, $value)
 {
     // raw url encode and set raw cookie used here to prevent issues with spaces encoded as '+'
     $value = rawurlencode(json_encode($value));
     setrawcookie($this->cookie_prefix . $key, $value, time() + $this->app['config']['cookie_lifetime'], '/');
     $_COOKIE[$this->cookie_prefix . $key] = $value;
 }
开发者ID:netcon-source,项目名称:prontotype,代码行数:7,代码来源:Store.php


示例8: add_event

 /**
  * Adds a setting to the frame events
  * @param type $data
  * @return type
  */
 function add_event($data)
 {
     $id = md5(serialize($data));
     $data['context'] = $this->object->context;
     setrawcookie($this->object->setting_name . '_' . $id, $this->object->_encode($data));
     return $data;
 }
开发者ID:lcw07r,项目名称:productcampamsterdam.org,代码行数:12,代码来源:class.frame_event_publisher.php


示例9: setRaw

 public function setRaw($name, $value = "", $expire = 0, $path = null, $domain = null, $secure = false, $httponly = false)
 {
     if (!setrawcookie($name, $value, $expire, $path, $domain, $secure, $httponly)) {
         throw new Exception("Cookie could not be set.");
     }
     return $this;
 }
开发者ID:petrofcikmatus,项目名称:framework,代码行数:7,代码来源:FW_Cookies.php


示例10: setrawcookie

 public static function setrawcookie($key, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = false)
 {
     if (self::$_response) {
         self::$_response->rawcookie($key, $value, $expire, $path, $domain, $secure, $httponly);
     }
     \setrawcookie($key, $value, $expire, $path, $domain, $secure, $httponly);
 }
开发者ID:imdaqian,项目名称:zphp,代码行数:7,代码来源:Response.php


示例11: execute

 /**
  * @see ExpressoLite\Backend\Request\LiteRequest::execute
  */
 public function execute()
 {
     if (!$this->isParamSet('user') || !$this->isParamSet('pwd')) {
         $this->httpError(400, 'É necessário informar login e senha.');
     }
     try {
         $this->resetTineSession();
         $result = $this->tineSession->login($this->param('user'), $this->param('pwd'), $this->isParamSet('captcha') ? $this->param('captcha') : null);
     } catch (PasswordExpiredException $pe) {
         return (object) array('success' => false, 'expired' => true);
     } catch (CaptchaRequiredException $cre) {
         return (object) array('success' => false, 'captcha' => $cre->getCaptcha());
     }
     if ($result) {
         $cookiePath = str_replace('accessible/', '', $_SERVER['REQUEST_URI']);
         //we remove 'accessible/' suffix from current path.
         //This way, the cookie will always be set to all modules,
         //even if it was started by the accessible module
         setrawcookie('user', $this->param('user'), time() + 60 * 60 * 24 * 30, $cookiePath);
         $_COOKIE['user'] = $this->param('user');
         //setrawcookie() does not update the $_COOKIE array with the new cookie.
         //So, we do this manually to avoid problems with checkIfSessionUserIsValid
         //later on
     }
     $this->checkIfSessionUserIsValid();
     // Its better to check if the tine user matches Expresso Lite user
     // right away
     return (object) array('success' => $result, 'userInfo' => (object) array('mailAddress' => $this->tineSession->getAttribute('Expressomail.email'), 'mailSignature' => $this->tineSession->getAttribute('Expressomail.signature'), 'mailBatch' => MAIL_BATCH));
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:Login.php


示例12: clearcookie

function clearcookie()
{
    if (is_array($_COOKIE)) {
        foreach ($_COOKIE as $key => $val) {
            setrawcookie($key, '', -86400 * 365, $GLOBALS['cookiecfg']['path'], $GLOBALS['cookiecfg']['domain'], $_SERVER['SERVER_PORT'] == 443 ? 1 : 0);
        }
    }
}
开发者ID:haseok86,项目名称:millkencode,代码行数:8,代码来源:global.func.php


示例13: set

 public function set()
 {
     if ($this->raw) {
         setrawcookie($this->name, $this->value, $this->expire, $this->path, $this->domain, $this->secure, $this->httponly);
     } else {
         setcookie($this->name, $this->value, $this->expire, $this->path, $this->domain, $this->secure, $this->httponly);
     }
 }
开发者ID:railsphp,项目名称:framework,代码行数:8,代码来源:Cookie.php


示例14: store_uid

 public static function store_uid($uid = '')
 {
     if (!headers_sent()) {
         setrawcookie(self::COOKIE, $uid, time() + 60 * 60 * 24 * 30, COOKIEPATH, COOKIE_DOMAIN);
         do_action('edd_segment_uid_stored', $uid);
     }
     return $uid;
 }
开发者ID:SproutApps,项目名称:segment-io,代码行数:8,代码来源:Identity.php


示例15: checkLogin

function checkLogin()
{
    print "Here";
    if (!($connect = mysqli_connect("localhost", "root", "", "ita_project"))) {
        die("Error in connecting to the database");
    }
    $username = $_POST['username'];
    $password = $_POST['password'];
    $query = "select * from student where uname = '" . $username . "'  and password = '" . $password . "'";
    if (!($result = mysqli_query($connect, $query))) {
        die("Error in querying");
    }
    $count = 0;
    while ($row = mysqli_fetch_array($result)) {
        $count++;
    }
    if ($count >= 1) {
        setrawcookie("CRG", $username, time() + 1800);
        //setrawcookie("CRG_SES"  , time());
        return 1;
    }
    $query = "select * from faculty where uname = '" . $username . "'  and password = '" . $password . "'";
    if (!($result = mysqli_query($connect, $query))) {
        die("Error in querying");
    }
    $count = 0;
    while ($row = mysqli_fetch_array($result)) {
        $count++;
    }
    if ($count >= 1) {
        //print("Login successful for faculty");
        setrawcookie("CRG", $username, time() + 1800);
        //setrawcookie("CRG_SES"  , time());
        return 2;
    }
    $query = "select * from admin where uname = '" . $username . "'  and password = '" . $password . "'";
    if (!($result = mysqli_query($connect, $query))) {
        die("Error in querying");
    }
    $count = 0;
    while ($row = mysqli_fetch_array($result)) {
        $count++;
    }
    if ($count >= 1) {
        //print("Login successful for admin");
        setrawcookie("CRG", $username, time() + 1800);
        //setrawcookie("CRG_SES"  , time());
        return 3;
    }
    if ($count == 0) {
        return 4;
    }
}
开发者ID:chaitu4068,项目名称:ita-project,代码行数:53,代码来源:verifyCredentials.php


示例16: add_event

 /**
  * Adds a setting to the frame events
  * @param type $data
  * @return type
  */
 function add_event($data)
 {
     $id = md5(serialize($data));
     $data['context'] = $this->object->context;
     $write_cookie = TRUE;
     if (defined('XMLRPC_REQUEST')) {
         $write_cookie = XMLRPC_REQUEST == FALSE;
     }
     if ($write_cookie) {
         setrawcookie($this->object->setting_name . '_' . $id, $this->object->_encode($data));
     }
     return $data;
 }
开发者ID:bensethro,项目名称:runcyb,代码行数:18,代码来源:class.frame_event_publisher.php


示例17: add_event

 /**
  * Adds a setting to the frame events
  * @param type $data
  * @return type
  */
 public function add_event($data)
 {
     $id = md5(serialize($data));
     $data['context'] = $this->object->context;
     $write_cookie = TRUE;
     if (defined('XMLRPC_REQUEST')) {
         $write_cookie = XMLRPC_REQUEST == FALSE;
     }
     if ($write_cookie) {
         setrawcookie($this->object->setting_name . '_' . $id, $this->object->_encode($data), time() + 10800, '/', parse_url(site_url(), PHP_URL_HOST));
     }
     return $data;
 }
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:18,代码来源:package.module.frame_communication.php


示例18: create_SSO_token_cookie

 public function create_SSO_token_cookie()
 {
     if (!isset($_SERVER["HTTP_HOST"])) {
         $domain = $_SERVER["SERVER_NAME"];
     } else {
         $domain = $_SERVER["HTTP_HOST"];
     }
     $exploded_domain = explode(".", $domain);
     $domain = implode(".", array_slice($exploded_domain, -2));
     //error_log("domain is ".$domain." sso token is ".$this->ssotoken);
     $result = setrawcookie($this->params->get('sso_token_cookie_name'), $this->ssotoken, time() + 60 * 60 * 10, "/", $domain, True, True);
     return $result;
 }
开发者ID:haterzlin,项目名称:joomla_opensso_login,代码行数:13,代码来源:functions.php


示例19: add

    /**
     * tell the browser to set a cookie
     * allow set multiple cookies at once
     * 
     * @param mixed $cookies cookie arr
     * @param boolean $raw
     * @return void
     */
    public function add($cookies, $raw = false)
    {
        if (!is_array($cookies)) {
            $cookies = array($cookies);
        }
        foreach ($cookies as $cookie) {
            if ($cookie instanceof CookieEntity) {
                $raw ? setrawcookie($cookie->name, $cookie->value, $cookie->expire, $cookie->path, $cookie->domain, $cookie->secure, $cookie->httpOnly) : setcookie($cookie->name, $cookie->value, $cookie->expire, $cookie->path, $cookie->domain, $cookie->secure, $cookie->httpOnly);
            } else {
                throw new InvalidArgumentException('Argument: $cookies must be Hydrogen\\Http\\Cookie\\Cookie
					 instance or array of it');
            }
        }
    }
开发者ID:TF-Joynic,项目名称:Hydrogen,代码行数:22,代码来源:cookie.php


示例20: sendHeaders

 /**
  * Sends HTTP headers, including cookies.
  */
 public function sendHeaders()
 {
     if (!$this->headers->has('Content-Type')) {
         $this->headers->set('Content-Type', 'text/html');
     }
     // status
     header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText));
     // headers
     foreach ($this->headers->all() as $name => $value) {
         header($name . ': ' . $value);
     }
     // cookies
     foreach ($this->cookies as $cookie) {
         setrawcookie($cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httpOnly']);
     }
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:19,代码来源:Response.php



注:本文中的setrawcookie函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP setsmsdeliverystatus函数代码示例发布时间:2022-05-15
下一篇:
PHP setproctitle函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap