cookies

PHP permanent cookie

半世苍凉 提交于 2020-01-16 04:30:25
问题 How do I set up a cookie that won't never expire, even when the user closes his browser or stops his machine? Thanks! 回答1: I don't think there is a way to have a 'permanent' cookie, but rather one that expires very very far into the future. Just because you remained logged into a website/service the next time you return or after you close your browser, does not mean that there is no expiration date on the cookie. Check out the PHP documentation on setting the lifetime of a cookie. 回答2:

Set and Check Cookie in the one response - Laravel

主宰稳场 提交于 2020-01-16 03:26:23
问题 I am attempting to set a cookie and then check to see if the cookie has been set. So in one function, I have it make the cookies: public function makeCookies(){ Cookie::queue('logged_in', $value, 15); Cookie::queue('user_id', 2); //return Response::make()->withCookie(Cookie::make('logged_in', $value, 15))->withCookie(Cookie::forever('user_id', 2)); } And in the other function, I try to check to see if the cookie has been set: public function checkCookies(){ $this->makeCookies(); if(Cookie:

Add Cookie to Fancy Box Popup

試著忘記壹切 提交于 2020-01-16 02:49:15
问题 I have this POPUP I can use to popup constantly - I wanted to add a 7 day cookie to it? Is that possible with what I have? <script type="text/javascript"> jQuery(document).ready(function() { $.fancybox( '<h2>' + {{ settings.popup_title | json }} + '</h2><p>' + {{ settings.popup_content | json }} + '</p>', { 'autoDimensions' : false, 'width' : 450, 'height' : 'auto', 'transitionIn' : 'none', 'transitionOut' : 'none' } ); }); </script> 回答1: Based on this answer, you can tweak the code with what

Sharing session variables in PHP between subdomains

感情迁移 提交于 2020-01-16 00:53:10
问题 I want to share my session variables in PHP using many subdomains. I have that example : example.com subdomain1.example.com I try to use the same session variables between the two domains. I already tested a lot of functions in PHP but nothing work. Here is my way to test : On the example.com/page.php, I have that test : echo '<pre>'; var_dump(session_set_cookie_params(0, '/', '.example.com')); session_start(); echo "Session ID : ".session_id()."\n"; $_SESSION['foo'] = 'bar'; print_r($

request库解析中文

China☆狼群 提交于 2020-01-15 22:57:38
官网地址: http://cn.python-requests.org/zh_CN/latest/ 高级用法 本篇文档涵盖了 Requests 的一些高级特性。 会话对象 会话对象让你能够跨请求保持某些参数。它也会在同一个 Session 实例发出的所有请求之间保持 cookie, 期间使用 urllib3 的 connection pooling 功能。所以如果你向同一主机发送多个请求,底层的 TCP 连接将会被重用,从而带来显著的性能提升。 (参见 HTTP persistent connection ). 会话对象具有主要的 Requests API 的所有方法。 我们来跨请求保持一些 cookie: s = requests.Session() s.get('http://httpbin.org/cookies/set/sessioncookie/123456789') r = s.get("http://httpbin.org/cookies") print(r.text) # '{"cookies": {"sessioncookie": "123456789"}}' 会话也可用来为请求方法提供缺省数据。这是通过为会话对象的属性提供数据来实现的: s = requests.Session() s.auth = ('user', 'pass') s.headers

cookie is adding twice in browser when page is loaded

落爺英雄遲暮 提交于 2020-01-15 12:47:29
问题 am guys am checking cookie is exist or not using Spring Handler interceptor pre-handle method. if the cookie is not present am sending the user to login using response.sendRedirect. if cookie is present am returning true and am resetting cookie time means deleting and adding same cookie public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream

Cookie read and write issue- jQuery to JSP

感情迁移 提交于 2020-01-15 12:40:13
问题 using jQuery cookie plugin I create cookie: $.cookie('uom', '1-23-235(K)'); When I read it from JSP, it Return me only the following 1-23-235 and if I remove parentheses while creating cookies, such as $.cookie('uom', '1-23-235 K'); then there is no problem! All working is fine. How can I overcome this because user can enter any symbol like parentheses 回答1: Try escaping (aka URL-encoding) the strings you set as cookies: On the JS side: escape(cookie); On the Java side: String result =

Cookie disabled issue in IE

冷暖自知 提交于 2020-01-15 12:03:31
问题 While testing our site with IE, we were disabling/enabling the cookies from the privacy settings tab. But this not does seem to work as expected. (for the first time it worked, and from then on,it stopped working).Chrome and Firefox seem to work fine though. the logic we have written to check if cookies are enabled/disabled is as follows: We try to create a test cookie using document.cookie(we have not specified any domain nor an expiry date). If the cookie can be created, then we say the

Cookie disabled issue in IE

本小妞迷上赌 提交于 2020-01-15 12:03:28
问题 While testing our site with IE, we were disabling/enabling the cookies from the privacy settings tab. But this not does seem to work as expected. (for the first time it worked, and from then on,it stopped working).Chrome and Firefox seem to work fine though. the logic we have written to check if cookies are enabled/disabled is as follows: We try to create a test cookie using document.cookie(we have not specified any domain nor an expiry date). If the cookie can be created, then we say the

跳过cookies访问

≯℡__Kan透↙ 提交于 2020-01-15 11:41:32
from selenium import webdriverimport time,os,jsondriver = webdriver.Chrome()driver.maximize_window()url = "https://www.cnblogs.com/"driver.get(url)#保存cookies到文件中def save_cookies(driver): project_path = os.path.dirname(os.getcwd()) file_path = project_path +"/cookies" if not os.path.exists(file_path): os.mkdir(file_path) #从driver中获取cookies cookies = driver.get_cookies() #读取cookies with open(file_path + "Cnblogs.cookies",'w') as c: json.dump(cookies,c) print(cookies)def login(): try: #登录按钮 driver.find_element_by_xpath('//*[@id="span_userinfo"]/a[1]').click() time.sleep(1) driver.find_element_by