Search Results

Search found 1701 results on 69 pages for 'cookie'.

Page 3/69 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • iphone bookmarklet cookie persistence

    - by Larry Davis
    I have an iphone (jqtouch based) web app that uses cookies for authentication. The use flow is as follows : user goes to the mobile landing page and is instructed to save the page as a bookmarklet on their home page. they launch the bookmarklet to go to a login page to login and get a cookie. the cookie works and they can navigate throughout the web site. However this session cookie is not persistent. If they leave safari and then restart using the saved bookmarklet, the cookies set during their previous session are gone. Just using safari (ie: launch safari directly rather than through the bookmarklet) to navigate the pages works fine (ie: start safari, go to url, do login, restart safari, go back to url). I find that that the cookies that were active when the bookmarklet was created are persistent but any cookies set during the session when safari is accessed through the bookmarklet are not persistent. I'm wondering if this is a safari/iphone issue and/or if there is any way around this. Many thanks for any insight you can provide.

    Read the article

  • Simple code to expire Drupal cookie?

    - by user310594
    With a single click this simple script will do a multi-logout of: Moodle Elgg 2 MyBB's and (not) Drupal. <?php setcookie( 'Elgg', '', -3600, '/', '.domain.com', false, false); setcookie( 'http_auth_ext_complete', '1', -3600, '/d/', '.domain.com', false, false); // setcookie( 'http_auth_ext_complete', '1', -3600, '/d/', 'domain.com', false, false); setcookie( 'mybbuser', '', -3600, '/', '.domain.com', false, false); setcookie( 'mybbuser', '', -3600, '/bb/', '.domain.com', false, false); // unset all 3 Moodle cookies, the lazy way if (isset($_SERVER['HTTP_COOKIE'])) { $cookies = explode(';', $_SERVER['HTTP_COOKIE']); foreach($cookies as $cookie) { $parts = explode('=', $cookie); $name = trim($parts[0]); setcookie($name, '', time()-1000); setcookie($name, '', time()-1000, '/'); } } ?> This works on four sites but the Drupal cookie won't quit. How can I do the same with Drupal? Note: Drupal uses 'host' instead of 'domain', neither with or without the '.' works so far. Thank you.

    Read the article

  • Anyone can explain to me document.cookie

    - by dramasea
    I founs this code in w3schoool javascript coookie section, which is to read the cookie: function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } In this line: if (document.cookie.length>0) what mean document.cookie.length? In this line: c_start=document.cookie.indexOf(c_name + "="); why i need to add '=' after the c_name(cookie name) In this line: c_start=c_start + c_name.length+1; why I need to add c_name.length+1 ? What the purpose? And what the meaning of this line: if (c_end==-1) c_end=document.cookie.length; Can Anyone answer my question?Thanks!!!

    Read the article

  • Can't set a cookie in Chrome 5

    - by Nicolas
    Hi, Since today I am facing a tricky issue with Google Chrome that I've just updated to v5. I have a user login process running on my website. Everything works fine on FF 3.6.x and IE 7, but I just can't set any cookie in Google Chrome 5. I'm mentioning 5 because it worked very well before on v4. My PHP script looks like that: $cook = setcookie($cookieName, $value, $expires, '/', '.'.$domain); var_dump($cook, isset($_COOKIE[$cookieName])); I even tried the alternative setrawcookie without any result. $cook = setrawcookie($cookieName, $value, $expires, '/', '.'.$domain); var_dump($cook, isset($_COOKIE[$cookieName])); FF 3.6.x and IE7 output: bool(true) bool(true) Whereas Chrome v5 outputs: bool(true) bool(false) And obviously I see not trace of this cookie in Google Chrome 5. Any idea? =/ Cheers, Nicolas.

    Read the article

  • setting a cookie in php

    - by Jacksta
    I am trying to set a cookie, whas wrong with this as I am getting an error. Warning: setcookie() expects parameter 3 to be long, string given in /home/admin/domains/domain.com.au/public_html/setcookie.php on line 6 <?php $cookie_name = "test_cookie"; $cookie_value = "test_string"; $cookie_expire = "time()+86400"; $cookie_domain = "localhost"; setcookie($cookie_name, $cookis_value, $cookie_expire, "/", $cookie_domain, 0); ?> <HTM> <HEAD> </HEAD> <BODY> <h1>cookie mmmmmmm</h1> </BODY> </HTML>

    Read the article

  • How to check Cookie header line and custom cache on Nginx

    - by user124249
    I am trying cache for my website use Nginx Proxy module and has following requirements: If request has cookie (in request header) The response will use cache of Nginx Hide Set-Cookie header line If request has no cookie (in request header) Foward request to backend Don't hide h Set-Cookie header line I use If (of rewrite module) and any directive: if (!-e $http_cookie) { set $not_cache_rq 0; set $not_cache_rp 0; } if ($http_cookie) { set $not_cache_rq 1; set $not_cache_rp 1; } proxy_cache_bypass $not_cache_rq; proxy_no_cache $not_cache_rp; proxy_hide_header Set-Cookie; I do not know how to call cookie proxy_hide_header option when has cookie and no cookie on header line. Please help me. Many thanks.

    Read the article

  • How to get correct Set-Cookie headers for NSHTTPURLResponse?

    - by overboming
    I want to use the following code to login to a website which returns its cookie information in the following manner: Set-Cookie: 19231234 Set-Cookie: u2am1342340 Set-Cookie: owwjera I'm using the following code to log in to the site, but the print statement at the end doesn't output anything about "set-cookie". On Snow leopard, the library seems to automatically pick up the cookie for this site and later connections sent out is set with correct "cookie" headers. But on leopard, it doesn't work that way, so is that a trigger for this "remember the cookie for certain root url" behavior? NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:uurl]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setValue:@"keep-live" forHTTPHeaderField:@"Connection"]; [request setValue:@"300" forHTTPHeaderField:@"Keep-Alive"]; [request setHTTPShouldHandleCookies:YES]; [request setHTTPBody:postData]; [request setTimeoutInterval:10.0]; NSData *urlData; NSHTTPURLResponse *response; NSError *error; urlData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSLog(@"response dictionary %@",[response allHeaderFields]);

    Read the article

  • [Java] Send cookie with http request problem

    - by nkr1pt
    I'm trying to get a certain cookie in a java client by creating a series of Http requests. It looks like I'm getting a valid cookie from the server but when I'm sending out a request to the fnal url with the seemingly valid cookie I should get some lines of xml in the response but the response is blank because the cookie isw rong or is invalidated because a session has closed or an other problem which I can't figure out. The cookie handed out by the server expires at the end of the session. It seems to me the cookie is valid because when I do the same calls in firefox, a similar cookie with the same name and starting with the 3 first same letters and of the same length is stored in firefox, also expiring at the end of the session. If I then make a request to the final url with only this particular cookie stored in firefox (removed all other cookies), the xml is nicely rendered on the page. Any ideas about what I am doing wrong in this piece of code? One other thing, when I use the value from the very similar cookie generated and strored in firefox in this piece of code, the last request does give xml feedback in the http response! // Validate url = new URL(URL_VALIDATE); conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("Cookie", cookie); conn.connect(); String headerName = null; for (int i = 1; (headerName = conn.getHeaderFieldKey(i)) != null; i++) { if (headerName.equals("Set-Cookie")) { if (conn.getHeaderField(i).startsWith("JSESSIONID")) { cookie = conn.getHeaderField(i).substring(0, conn.getHeaderField(i).indexOf(";")).trim(); } } } // Get the XML url = new URL(URL_XML_TOTALS); conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("Cookie", cookie); conn.connect(); // Get the response StringBuffer answer = new StringBuffer(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = reader.readLine()) != null) { answer.append(line); } reader.close(); //Output the response System.out.println(answer.toString())

    Read the article

  • How to write Jquery cookie

    - by mtwallet
    Hi. I am designing a website that has 100% width + height div containing a graphic overlaying the home page. I want to show this once to the user when they first visit the site, a kind of welcome to the site click here to enter then this would never been shown to that user again. How do I write a cookie to do this? Many thanks.

    Read the article

  • Flash+PHP+cookie

    - by naveen
    I want an animation play only once in the browser. If any user seen the movie and if goes to any other page or refresh(F5) and then come back on the animation page then animation should not play from start. I want to play it from another frame. I think it can be done by set cookie or somthing using javascript or php. Please anybody help me. Thanks in advance. I will appreciate ,if some code help please

    Read the article

  • Cookie in Tomcat

    - by Richard
    Sorry... can anybody help me out? I'm a complete neewbiee to tomcat, but I have to set a cookie with the name 'lastlogin' with the actual timestamp as a value. How am I supposed to do it? Thanks a lot.

    Read the article

  • Cookie Settings Storage Method

    - by Paul
    I've got an web app that needs to store some non-sensitive preferences for the user. Right now I'm storing their language preference and what mode they want a window opened in by default in two cookies: "lang" can be "en" or "de" "mode" can be "design" or "view" I might add a few more in the future. I'm not sure how many, but probably never more than a dozen. Language is parsed on every request, whereas the mode cookie is only used occasionally. I saw a recommendation that made sense I shouldn't try to do what I was originally planning to do and strongly type a user settings class deserialized on each request because of the overhead involved. I see three options here and I'm not sure which is the best overall. Keep things as they are, add a new cookie for each new setting Combine the cookies into a single settings cookie and add future values to it Change the mode cookie to settings (leaving language alone), add new user settings values to the settings cookie All would work obviously. I'm leaning toward option three, but I'm not sure if there's a best practice for this?

    Read the article

  • Google App Engine - Secure Cookies

    - by tponthieux
    I'd been searching for a way to do cookie based authentication/sessions in Google App Engine because I don't like the idea of memcache based sessions, and I also don't like the idea of forcing users to create google accounts just to use a website. I stumbled across someone's posting that mentioned some signed cookie functions from the Tornado framework and it looks like what I need. What I have in mind is storing a user's id in a tamper proof cookie, and maybe using a decorator for the request handlers to test the authentication status of the user, and as a side benefit the user id will be available to the request handler for datastore work and such. The concept would be similar to forms authentication in ASP.NET. This code comes from the web.py module of the Tornado framework. According to the docstrings, it "Signs and timestamps a cookie so it cannot be forged" and "Returns the given signed cookie if it validates, or None." I've tried to use it in an App Engine Project, but I don't understand the nuances of trying to get these methods to work in the context of the request handler. Can someone show me the right way to do this without losing the functionality that the FriendFeed developers put into it? The set_secure_cookie, and get_secure_cookie portions are the most important, but it would be nice to be able to use the other methods as well. #!/usr/bin/env python import Cookie import base64 import time import hashlib import hmac import datetime import re import calendar import email.utils import logging def _utf8(s): if isinstance(s, unicode): return s.encode("utf-8") assert isinstance(s, str) return s def _unicode(s): if isinstance(s, str): try: return s.decode("utf-8") except UnicodeDecodeError: raise HTTPError(400, "Non-utf8 argument") assert isinstance(s, unicode) return s def _time_independent_equals(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= ord(x) ^ ord(y) return result == 0 def cookies(self): """A dictionary of Cookie.Morsel objects.""" if not hasattr(self,"_cookies"): self._cookies = Cookie.BaseCookie() if "Cookie" in self.request.headers: try: self._cookies.load(self.request.headers["Cookie"]) except: self.clear_all_cookies() return self._cookies def _cookie_signature(self,*parts): self.require_setting("cookie_secret","secure cookies") hash = hmac.new(self.application.settings["cookie_secret"], digestmod=hashlib.sha1) for part in parts:hash.update(part) return hash.hexdigest() def get_cookie(self,name,default=None): """Gets the value of the cookie with the given name,else default.""" if name in self.cookies: return self.cookies[name].value return default def set_cookie(self,name,value,domain=None,expires=None,path="/", expires_days=None): """Sets the given cookie name/value with the given options.""" name = _utf8(name) value = _utf8(value) if re.search(r"[\x00-\x20]",name + value): # Don't let us accidentally inject bad stuff raise ValueError("Invalid cookie %r:%r" % (name,value)) if not hasattr(self,"_new_cookies"): self._new_cookies = [] new_cookie = Cookie.BaseCookie() self._new_cookies.append(new_cookie) new_cookie[name] = value if domain: new_cookie[name]["domain"] = domain if expires_days is not None and not expires: expires = datetime.datetime.utcnow() + datetime.timedelta( days=expires_days) if expires: timestamp = calendar.timegm(expires.utctimetuple()) new_cookie[name]["expires"] = email.utils.formatdate( timestamp,localtime=False,usegmt=True) if path: new_cookie[name]["path"] = path def clear_cookie(self,name,path="/",domain=None): """Deletes the cookie with the given name.""" expires = datetime.datetime.utcnow() - datetime.timedelta(days=365) self.set_cookie(name,value="",path=path,expires=expires, domain=domain) def clear_all_cookies(self): """Deletes all the cookies the user sent with this request.""" for name in self.cookies.iterkeys(): self.clear_cookie(name) def set_secure_cookie(self,name,value,expires_days=30,**kwargs): """Signs and timestamps a cookie so it cannot be forged""" timestamp = str(int(time.time())) value = base64.b64encode(value) signature = self._cookie_signature(name,value,timestamp) value = "|".join([value,timestamp,signature]) self.set_cookie(name,value,expires_days=expires_days,**kwargs) def get_secure_cookie(self,name,include_name=True,value=None): """Returns the given signed cookie if it validates,or None""" if value is None:value = self.get_cookie(name) if not value:return None parts = value.split("|") if len(parts) != 3:return None if include_name: signature = self._cookie_signature(name,parts[0],parts[1]) else: signature = self._cookie_signature(parts[0],parts[1]) if not _time_independent_equals(parts[2],signature): logging.warning("Invalid cookie signature %r",value) return None timestamp = int(parts[1]) if timestamp < time.time() - 31 * 86400: logging.warning("Expired cookie %r",value) return None try: return base64.b64decode(parts[0]) except: return None uid=1234|1234567890|d32b9e9c67274fa062e2599fd659cc14 Parts: 1. uid is the name of the key 2. 1234 is your value in clear 3. 1234567890 is the timestamp 4. d32b9e9c67274fa062e2599fd659cc14 is the signature made from the value and the timestamp

    Read the article

  • PHP HttpRequest Cookie Issue

    - by Daaron
    I have a chunk of code to login to test a web site login: $r = new HttpRequest($newlocation, HttpRequest::METH_GET); $r-addCookies($cookieArray); $r-send(); The content of $cookieArray is from a redirect, but I don't modify it in any way. The really baked part is that if the value of the cookie (an authentication token string) contains a slash, it doesn't login properly. If it doesn't have a slash, everything works. Any ideas are appreciated.

    Read the article

  • Setting a cookie based on the name of the link that is clicked.

    - by Ozaki
    TLDR When clicking on a link I want to assign a cookie with a name of instrument and a value of the text on the link clicked. Using Jquery.1.4.2.min.js, Jquery.cookie.1.0.js I am trying to create a cookie when a link is clicked (will always link to "page.html"). name of instrument value of the TEXT So far I am trying to use: Link1: <a href="page.html">link1</a> Link2: <a href="page.html">link2</a> Script: $('a[href=page.html]').click(function() { var name = 'instrument'; var value = $(this).text(); $.cookie(name, value, { expires: 365 }); }); When I click the link it just loads the link and no cookie is set. Debugging with firebug, firecookie, firequery. No cookie for instrument or anything along the lines is found. Onload I'll hit the "<a href="page.html">projects</a>" but not the "$.cookie(name, value, { expires: 365 });" at all.

    Read the article

  • ASP.NET Cookies

    - by Aamir Hasan
    Cookies are domain specific and cannot be used across different network domains. The only domain that can read a cookie is the domain that sets it. It does not matter what domain name you set.Cookies are used to store small pieces of information on a client machine. A cookie can store only up to 4 KB of information. Generally cookies are used to store data which user types frequently such as user id and password to login to a site.The HttpCookie class defined in the System.Web namespace represents a browser cookie.Creating cookies (C#)Dim cookie As HttpCookie = New HttpCookie("UID")cookie.Value = "id"cookie.Expires = #3/30/2010#Response.Cookies.Add(cookie)cookie = New HttpCookie("username")cookie.Value = "username"cookie.Expires = #3/31/2010#Response.Cookies.Add(cookie)Creating cookies (VB.NET) HttpCookie cookie = Request.Cookies["Preferences"];      if (cookie == null)      {        cookie = new HttpCookie("Preferences");      }      cookie["Name"] = txtName.Text;      cookie.Expires = DateTime.Now.AddYears(1);      Response.Cookies.Add(cookie);Creating cookies (C#)    HttpCookie MyCookie = new HttpCookie("Background");    MyCookie.Value = "value";    Response.Cookies.Add(MyCookie);Reading cookies  (VB.NET)Dim cookieCols As New HttpCookieCollectioncookieCols = Request.CookiesDim str As String' Read and add all cookies to the list boxFor Each str In cookieColsListBox1.Items.Add("Value:" Request.Cookies(str).Value)Next Reading cookies (C#) ArrayList colCookies = new ArrayList();        for (int i = 0; i < Request.Cookies.Count; i++)            colCookies.Add(Request.Cookies[i]);        grdCookies.DataSource = colCookies;        grdCookies.DataBind();Deleting cookies (VB.NET)Dim cookieCols As New HttpCookieCollectioncookieCols = Request.CookiesDim str As String' Read and add all cookies to the list boxRequest.Cookies.Remove("PASS")Request.Cookies.Remove("UID")Deleting cookies (C#)string[] cookies = Request.Cookies.AllKeys;        foreach (string cookie in cookies)        {            ListBox1.Items.Add("Deleting " + cookie);            Response.Cookies[cookie].Expires = DateTime.Now.AddDays(-1);        }

    Read the article

  • How do you set a cookie to be accessible across the entire domain in Javascript

    - by Tzarkov
    I suppose there should be a way to set a cookie to be accessible from the entire domain nevermind from which directory you are setting the cookie. Say in mypage.com/blue/index.php y set the cookie "colour=blue;" this way: document.cookie = "colour" + "=" + "blue" + "; expires=" + expireDate.toGMTString() + "; path=/"; Using this code, the cookie retrieval function in mypage.com/home.php can't access the content of the cookie. If it was just from first level directories that the cookie needs to be set, we would be ok by doing path=../ instead of path=/ But how do you go about writing generic code that sets a cookie that is accessible from any page in that domain not minding how deep in the file structure is the page the cookie is being set from?

    Read the article

  • Set cookie value before view loaded in MVC?

    - by James123
    I need to set a cookie value before my view called. otherwise I have to refresh the page to get cookie value in the view. The problem here is the value of cookie will get in controller. [HttpGet] [Route("Abstract/{meetingCode}")] [AllowAnonymous] public ActionResult Index(string meetingCode) { var meetingAbstract = new MeetingAbstract(); meetingAbstract.Meeting = _abstractContext.GetMeetingWithMeetingCode(meetingCode); if (meetingAbstract.Meeting != null) { var cookie = new HttpCookie("_culture"); cookie.Value = meetingAbstract.Meeting.language.language_locale_code;//"en-US"; cookie.Expires = DateTime.Now.AddDays(365); cookie.Path = "/"; this.ControllerContext.HttpContext.Response.Cookies.Add(cookie); ... Any other way without refresh the page again to set cookie value?

    Read the article

  • How to persist a cookie?

    - by user246114
    Hi, I am creating a cookie in a jsp script, which is located at: www.myproject.com/login/index.jsp if I restart the browser and navigate there, all works well, I can see the cookie persist. If I navigate to: www.myproject.com I am not seeing the cookie. Do I need to set something in the cookie path or domain to make the cookie visible to the entire [myproject.com] domain (I just want to access the cookie from whatever sub path the user may be on). I am creating the cookie like: Cookie c = new Cookie("thisisatest", "foo"); c.setMaxAge(60 * 24 * 3600); response.addCookie(c); Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >