FAQ Database Discussion Community


Insert cookie and input value mysqli [duplicate]

php,mysql,cookies
This question already has an answer here: PHP Parse/Syntax Errors; and How to solve them? 10 answers Hi I am trying to insert 6 values into a table named post, but it wont work and I get an error. Where is the mistake in my php code? Error: Parse...

InternetGetCookie error 259 ERROR_NO_MORE_ITMES c++

c++,http,cookies,mfc
I've to check/get cookies of one site because i cannot, i've always got error 259 ERROR_NO_MORE_ITEMS with InternetGetCookies function (exemple: check/get cookie of "http://www.google.fr" url doesn't run, i have Error 259. wchar_t wchCookiesData[4096]; unsigned long ulCookiesDataLength = 0; bool bRet = InternetGetCookie(L"http://www.google.fr", NULL, out_pwchCookiesData, &ulCookiesDataLength ); That is my code...

How to get all of the cookies dropped in a session as a txt file?

javascript,cookies
I'm working on a digital art project that involves gathering cookies from a set of websites that I visit. I'm dabbling in writing some code to help me with this but overall I'm just looking for the easiest/fastest way to gather all of the contents of the cookies dropped in...

capturing a specific value from a cookie javascript

javascript,cookies
I have a cookie set up which has data stored in the following format: {"g":"776","f":"88876","hit":"true","TESTVALUE":"this is the value i want to capture"} I want to capture "TESTVALUE" in its own variable. I am using this script to actually capture the cookie data (where the cookie is called "chocolateChip": var getCookie...

How to grab/generate a cookie for a site

python,cookies,python-requests
When I go to Amazon.com in my browser, it sets a Cookie and then sends that as a header: Connection:keep-alive Cookie:x-wl-uid=1dxBAkbJJ9ys0awDahH9dLcLJmDR8XcztYvpl8p8Ojo8MNjbEo/ZBskQ8W/JSw7clLSM90d2OlFs=; session-token=/NCn9s4+YfWEyVyK0KIolKDyY2xx9L17aG/ZUZDY+5vH88wsk5n0+FcLDN9f/Y+xE/rNPKjev1iJrjSOgp26OVt5+EJynFZ6C/USFQkh3cXgzQkxXossA5Yxo9kD9S3yhpZbkZfGu1F63HNS1KQL/iIvchs3fvpMlDqmYXtiOn0H05ExWvcNdnio1ys8qU0W5LVosvUC45CuYQpi3n+7qi86AoHGjWHS/cm534xPcehsB+Xn0ndrWFNjVHSwNKR9; skin=noskin; ubid-acbjp=376-3466160-3751758;...

Retaining scope value from the cookie store on page refresh

javascript,angularjs,cookies
I have the following code in one of my controllers. $scope.artistId = $cookies.artistId; $scope.artistName = $cookies.artistName; $scope.switchArtist = function(artist) { $scope.artistName = ''; $scope.artistId = ''; $scope.artist = artist; $cookies.artistName = artist.name; $cookies.artistId = artist.id; $scope.artistName = artist.name; $scope.artistId = artist.id; $rootScope.$broadcast(ARTIST_EVENTS.switchedArtist); }; Then in my view I have {{...

forcing gulp to use a different hostname

cookies,dns,gulp
I need "gulp serve" to serve my application on a hostname that I added in my hosts file and not localhost. I'm doing this for cookie reasons since I'm adding domain key everytime I add a cookie. For example 127.0.0.1 app1.example.org When I start "gulp serve", it would trigger the...

Protect download path with PHP Sessions/Cookies?

php,cookies,session-cookies
I need to ensure that a person has been to, and filled out, a registration form before going to the product download page. Right now I submit the form via ajax and if the returned JSON = success I redirect to the appropriate download page accordingly. I would like to...

I Want to get the page count using cookie

php,cookies
I want to get the page count in my index page,using cookie.So far I have done like.Now My question is:If I refresh the page, The browser shows with count 2 and it doesnot increase for next refresh.I don't know what is wrong in my code.Further I want to know how...

jQuery toggle state changes upon refresh

javascript,jquery,cookies
I looked through some older questions and learnt that to solve this issue I need to implement cookies and somehow remember the states. Being new to jquery, it is turning out to be a little tricky for me to implement this. Here is my javascript code: $(document).ready(function(){ $('.trthJobStatus caption').click(function() {...

Ruby - How to capture and store a session cookie on login?

ruby,http,cookies
I need to accomplish what the following curl command is doing in Ruby. The curl command logs in to my website and stores all the cookies returned. Amongst which is a session cookie that I need to execute further restful stuff though my API. How do I do that in...

Django delete all cookies for all users

django,cookies,django-1.4
I have the django view to set the value in cookies 'no_show_dialog' when a user clicks 'Don't remind me anymore' in the modal dialog. Now i changed that dialog completely and want to reset that cookie for all users, so they will have to see it again at least once....

AngularJS: Storing an object in a cookie giving result of [Object Object]

angularjs,cookies
I am trying to store a group of user credentials in a cookie when sending in this user object to my service - this.SetCookie = function (user) { $cookies.user = user; } However what I get when I try to retrieve this cookie I do not get an object but...

Create Cookie Array that never expires with JS/JQuery?

javascript,jquery,arrays,cookies
I have a website with quotes and want users to be able to favourite quotes clicking on a star-icon. I have this code: jQuery('.fav').click(function(event) { event.preventDefault(); $this = $(this).parent(); var id = $this.attr("data-id"); // Build the expiration date string: var expiration_date = new Date(); var cookie_string = ''; expiration_date.setFullYear(expiration_date.getFullYear() +...

Python Requests Recreate Post Request with Cookies

python,cookies,request
So I was looking at my chrome console for a post request that I was making, and there is a 'cookie' value in the header file that has this data: strTradeLastInventoryContext=730_2; bCompletedTradeOfferTutorial=true; steamMachineAuth76561198052177472=3167F37117************B82C2E; steamMachineAuth76561198189250810=E292770040E************B5F97703126DE48E; rgDiscussionPrefs=%7B%22cTopicRepliesPerPage%******%7D; sessionid=053257f1102e4967e2527ced; steamCountry=US%7C708d3************e569cc75495;...

Setting a cookie in Wordpress functions.php - cant echo it using an other function

php,wordpress,cookies
My first function gets the parameters from the URL and sets the cookies: Edit: first function loads before everything on WP and saves the cookies and when checking the browsers cookies - it's there. it's saved. /** Get variables from the URL and set them into the coockie **/ add_action(...

how to store cookie permanently

c#,asp.net,session,cookies,web-config
I don´t want to show mail id in my application code. I want to give text box and what ever email id I will give it should be stored in web.config file for ever until I change it. string store= "[email protected]"; ConfigurationManager.AppSettings["MailId"] = store; string message1 = ConfigurationManager.AppSettings["MailId"]; <appSettings> <add...

Tracking clicks of guest users, with some decent kind of uniqueness

javascript,php,cookies
Please be advised, this is not a code-problem question. I have a resource in my app that is available only for authenticated users. In case a guest user tries to access the resource by clicking on it - registration modal shows up. Now, I'm building logic using jQuery and PHP...

How to stay logged in for Awesomium?

c#,cookies,awesomium
I want to program an app with C# and Awesomium for remembering that a user is logged into the site. For this I use the following code: private void button1_Click(object sender, EventArgs e) { Uri link = new Uri("http://www.mywebsite.com"); webControl1.Source = link; string Values=""; WebSession session = WebCore.CreateWebSession("d:\\temp", WebPreferences.Default); session.SetCookie(link,...

Setting a cookie to only show popup once

javascript,jquery,cookies
I'm trying to setup a cookie to only show a popup once, here's my code so far: jQuery(window).load(function(){ // Load pop up within parent-page section only if (window.location.href.indexOf('parent-page') > -1) { alert("your url contains the parent-page in the URL"); $.magnificPopup.open({ items: [ { src: '#disclaimer', // CSS selector of an...

Requests dict from cookiejar issue with escaped chars

python,cookies,python-requests
I'm running into some issues getting a cookie into a dictionary with python. It seems to be all escaped somehow even after running the command provided by requests. resp = requests.get(geturl, cookies=cookies) cookies = requests.utils.dict_from_cookiejar(resp.cookies) and this is what cookies looks like {'P-fa9d887b1fe1a997d543493080644610':...

How are YouTube and Google accessing each others cookies?

http,cookies
A lot of researching on stackoverflow told me that getting/setting cookies from other domains isn't possible. but I can see youtube.com is doing that with google.com How are they doing that then?...

Csurf invalid csrf token Express / nodejs

node.js,cookies,express,csrf,mean-stack
I have this odd behavior I get an error just the first time my page loads, basically is 'EBADCSRFTOKEN' I've been trying to figure it out why it happens only the first time the page loads, if I hit refresh and get a new token everything works fine. the same...

windows phone 8.1 universal app : clear cookies

c#,windows-phone-8,cookies,windows-phone-8.1,webbrowser-control
I am developing windows phone 8.1 universal app and i wish to clear cookies from browsers. I have used windows.phone.controls namespace and used following code await new WebBrowser().ClearCookiesAsync(); but it says that it throws several error. Please help windows programmers . I think the above code works well for silverlight...

Best practice for persisting User State in special kind of Asp.Net Mvc application

c#,asp.net,asp.net-mvc,asp.net-mvc-4,cookies
I will try to explain my situation and what I wanted to do. There is not any difficult and rare situation, but I can't find any relative questions or articles in internet. So, here we go. I have created a web application on ASP.NET MVC 5. Users are not going...

Angular $http set cookie on each request after login

javascript,angularjs,cookies
I'm having troubles with $http calls in AngularJS. I've created the following services crApp.service('authService', function ($http) { var urlBase = 'http://192.168.xx.xx:8081'; // POST api/login/ this.login = function (credentials) { return $http.post(urlBase + "/api/login", credentials); }; // POST api/logout/ this.logout = function () { return $http.post(urlBase + "/api/logout/", ""); }; });...

Secure Cookie Attribute in WebSphere

cookies,websphere,jsessionid
We are trying to secure our JSESSIONID in our WebSphere Full Profile I have followed the URL provided: http://www-01.ibm.com/support/docview.wss?uid=swg21422185 Our server configuration: Server11_was: I have Recycled my node - servers and runtimes. However, The JSESSIONID still coming as not secure. Am I missing something? WebSphere version: 8.5.5.1...

AngularJS $cookies.get() always returns undefined

javascript,angularjs,cookies
I'm using AngularJS 1.4.0 and the $cookies service. The following code will always print out an empty object: (function() { var app = angular.module("user-cookies-service", []); app.service('UserCookiesService', ["$cookies", function($cookies) { $cookies.put("Hello", "World"); console.log($cookies.getAll()); }]); })(); I've tried: Using AngulerJS 1.3.15 and $cookieStore where cookies don't persist when the browser is refreshed...

Expire check boxes cookies on click button

javascript,jquery,cookies,checkbox,jquery-plugins
I have multiple checkboxes in datatable with the one name and different values i can store cookie for all checkbox in checked by the following code $(document).ready(function(){ $('input[type=checkbox]').each(function() { var mycookie = $.cookie($(this).attr('value')); if (mycookie && mycookie == "true") { $(this).prop('checked', mycookie); } }); $('input[type=checkbox]').change(function() { var date = new...

First time visit to run preloader script using cookie

javascript,php,jquery,cookies,preloader
Although preloaders for websites are a controversial topic i have choosen to use one in this particular project. The preloader is working fine. the problem being that is must only run on firstime visit Heres what i have so far: <? if (!isset($HTTP_COOKIE_VARS["visited"])) { echo "<script> $(window).load(function() { $('#status').fadeOut(); $('#preloader').delay(350).fadeOut('slow');...

Not able to set the php cookie correctly

php,cookies
I am having problem with setting up a php cookie, what am I doing wrong? Below I added 3 examples which I tried. Next to the examples, I also tried to change the time which the cookie is working but is all did not work. Evert time I get the...

How to remember jQuery variable true or false state with a cookie

jquery,cookies
I have a button that when clicked will reveal or hide a series of buttons. What I need to do is remember the state or the variable: is_hidden = false; .. If the page were to reload. I have tried using jQuery.cookie and doing something like: $.cookie('is_hidden', 'false', { expires:...

Setting cookies with form input

javascript,forms,cookies
I am trying to make a username cookie using the users input to a web form.However its not working and I don;t know why. do you know what the problem is? <form> <input type="text" value="Enter Your Nickname" id="nameBox"> <input type="button" value="Go!" id="submit" onClick="putCookie"> <form> <script> var today = new Date();...

How to save cookies locally using a C# app?

c#,cookies
I have c# code which makes a request to a particular domain and gets the response cookies. Now when i go to the same URL in Internet Explorer i am prompted for credentials, because the cookies that my app got doesn't seem to save in the 'Temporary Internet Files' folder...

How do I read the value of a cookie that comes with a cross domain image?

javascript,jquery,rest,cookies,restful-url
I've called an image that's on another domain. It's a captcha image and it comes with a cookie with a code in it that I need to be able to access in my javascript. When I view the GET request in Google dev tools I can see the cookie, it's...

Can't Set and Get cookie using C# under ASP.NET MVC

c#,asp.net,asp.net-mvc,cookies
I'm trying to set and read cookies in c#. I wrote these two methods: public static void setCookie(string sCookie, string value) { HttpCookie cookie = HttpContext.Current.Request.Cookies[sCookie]; if (cookie == null) cookie = new HttpCookie(sCookie); cookie.Value = value; cookie.Expires = DateTime.Now.AddYears(1); HttpContext.Current.Request.Cookies.Add(cookie); } public static string getCookie(string sCookie) { if (HttpContext.Current.Request.Cookies[sCookie]...

Javascript Not deleting all cookies

javascript,cookies
I am using following code to delete a cookie: document.cookie = "CookieName=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; There are two cookies, one in on domain www.websiteaddress.com and other is on .websiteaddress.com When I am on page www.websiteaddress.com the cookie having domain address www.websiteaddress.com gets deleted but other one is...

Sticky Cookies in Scala

javascript,scala,cookies,playframework,playframework-2.0
I've set a cookie in Scala similar to the following: val cookies:Seq[Cookie] = new Seq() val nDaysExpire:Int = 2000 val nSecondsExpire:Int = nDaysExpire * 24 * 60 * 60 val cookie:Cookie = new Cookie(sCookieID, sValue, Option(nSecondsExpire)) cookies = cookies:+ cookie Ok(views.html.main(sID)).withCookies(cookies:_*) and then I immediately delete the cookie in JavaScript....

cookie not setting as expected

javascript,cookies
When I set a cookie like this, it works: var now = new Date(); now.setDate(now.getDate() + 30); document.cookie='bla=cats; expires=' + now + ';path=/;' But when I do this it does not: var now = new Date(); now.setMinutes(now.getMinutes() + 30); document.cookie='bla=cats; expires=' + now + ';path=/;' So I want to set...

How to change domain in CGI::Session?

perl,session,cookies,dns,cgi
I want to use CGI::Session module in order to implement my website sessions. I want to change session cookie in a way that it will fit to the domain that I want. For example, I have two sites, www.mysite.com and dev.mysite.com In this case I want the session cookie domain...

python requests cookies date format

python,date,python-3.x,cookies,python-requests
I get cookies from site with the help of requests. When I print cookies keys I get the following: [Cookie(version=0, name='Session', value='4safsadfsdfsdfsd06206ba8cea7c2', port=None, port_specified=False, domain='.site.info', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires=1433352401, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False), Cookie(version=0, name='UserID', value='555777', port=None, port_specified=False, domain='.site.info', domain_specified=True,...

Check if URL contains string then create variables with url strings

php,wordpress,url,cookies
I need to check if URL contains the term: "cidades". For example: http://localhost/site/cidades/sp/sorocaba So, if positive, then I need to create two or three variables with the remaining content without the " / ", in this case: $var1 = "sp"; $var2 = "sorocaba"; These variables will be cookies values in...

Cookie ist null, but has a value in the browser

javascript,asp.net-mvc,cookies
I am trying to set a cookie which stores the current TimezoneOffset. window.onload = function () { var timezone_cookie = "timezoneoffset"; if (!$.cookie(timezone_cookie)) { // if the timezone cookie not exists create one. // check if the browser supports cookie var test_cookie = 'test cookie'; $.cookie(test_cookie, true); if ($.cookie(test_cookie)) {...

Tornado Create a Secure Cookie with expiry time less than 1 day

python,cookies,tornado
I'm using Tornado's Secure Cookie functionality to implement user session. The set_secure_cookie function enables us to create a Cookie where lower limit for cookie expiry can be set to 1 day. Now, I need to expire these secure cookies in one hour. Can I achieve this easily? One solution is...

Exact solution to keep cookie after closing firefox

firefox,cookies
I know this is asked many time but i want exact solution. Why cookies are deleted after closing firefox? I want to keep cookies after closing firefox....

Getting email from cookie and adding to the uploaded file name

php,session,cookies
I have a gallery page which has the option for users to upload their image, but only registered users can upload. So when the user clicks the Upload button, the upload page checks if the user is logged in or not and if they are not logged in they are...

how symfony2 remember me work without any table for token?

php,symfony2,cookies,remember-me
I configure symfony2 to add remember me functionality, but how it work without any table in database to save remember me token. I mean some best practice for remember me cookie like what is said in here

Adobe DTM Custom rule conditions check for cookies

cookies,adobe,adobe-analytics
I have some problems to get a specific rule to fire in DTM. And the documentation on custom rule conditions from Adobe is very basic. What is should do: Check if a specific cookie exists (values of the cookie are irrelevant). When this cookies does not exist fire the rule....

Retrieving document.cookie getter and setter

javascript,cookies,browser
I'm trying to override the document.cookie since i need to control cookie creation, but seems that getOwnPropertyDescriptor casted on document.cookie doesn't retrieve its getter and setter ( tried on chrome and firefox ). Could someone explain me this behaviour? https://jsfiddle.net/1363ktwp/7/ var obj={}; // creating a property using document.cookie descriptors Object.defineProperty(...

Laravel 4.2: After checking “remember me” checkbox user's login doesn't get remembered in database, only in cookie, thus remember me not working

php,authentication,cookies,laravel-4
I am using laravel 4.2 I have a login form where I am trying to implement the remember me functionality. I have used Auth::attempt() to implement the above. Here's my code. public function logintest() { // set the remember me cookie if the user check the box $remember = (Input::has('remember'))...

Java HttpServletResponse addCookie could not be useful on chrome and ie

java,cookies
I use addCookie method to set scdid which like a jsessionid. But unfortunately, it's not useful on Chrome and IE which is ok on Firefox. So, could anybody help me? Cookie cookie = new Cookie("xx", "xxx"); cookie.setMaxAge(3600); cookie.setDomain("xxxx"); cookie.setPath("/"); response.addCookie(cookie); Here is request/response body: Headers Remote Address:127.0.0.1:80 Request URL:http(can't give...

slideToggle state not working with multiple boxes

javascript,jquery,cookies
I'm trying to save the toggle state of collapsable boxes using cookies. Here's my code: HTML: <div class="box_container"> <div class="box_handle"> Title </div> <div class="box" data-title="admin_actions"> Content </div> </div> Javascript: $('div.box_container div.box_handle').click(function() { $(this).next('.box').slideToggle('fast'); }); $.each($('div.box_container div.box_handle'), function(index,value){ if ($.cookie('show_box_' + $(value).next('.box').attr('data-title')) != 'closed'){...

Get value from cookies in database Codeigniter PHP

php,mysql,codeigniter,cookies
Actually i don't know what is this case name, i save/insert cart cookies php codeigniter to database, and it successful, but i cannot get the specific value from that database string. This is data from my DB a:1:{s:32:"1679091c5a880faf6fb5e6087eb1b2dc";a:6:{s:5:"rowid";s:32:"1679091c5a880faf6fb5e6087eb1b2dc";s:2:"id";s:1:"6";s:3:"qty";s:1:"1";s:5:"price";s:6:"275000";s:4:"name";s:10:"Vinly True";s:8:"subtotal";i:275000;}} And how can i get specific value in that string? for...

How do i add a cookie to my popup form? Built only with css and html [closed]

javascript,jquery,html,css,cookies
I have a popup form that shows up onpage load... but i have only used html and css for this... I want to be able to add a cookie that makes the popup only show once onpage load how can i do this? Also how can i put a delay...

Check if a cookie array element exists

javascript,jquery,cookies,js-cookie
How can I check that an array element already exists within cookie? Here is my code: var cookieList = function (cookieName) { var cookie = Cookies.get(cookieName); var items = cookie ? cookie.split(/,/) : new Array(); return { "add": function (val) { items.push(val); Cookies.set(cookieName, items.join(','), { path: '/' }); } }...

Insert cookies and date pdo mysql

php,mysql,cookies,pdo
I try to insert the 3 cookies and the date with pdo into my database. But I have no idea how I can do that. The input values become inserted in the database. And the cookies are set in a page before. Any hints? <?php $cookie_name = 'longitude'; if(isset($_POST["submit"])){ $hostname='localhost';...

Android Cookies (Reward for Invites)

android,cookies,google-chrome-app,android-browser
I am trying to integrate 'reward for invites' logic. What I am trying to do for this is I generate a unique URl for every user. When a friend clicks on the URL he is directed to a page and then to the playstore. On the page, a cookie with...

Javascript / JQuery Set Cookie on page load

javascript,jquery,html,cookies
I would appreciate some orientation in the following issue. I want to set a cookie when a page loads. The cookie value should taken from a div data-myifo attribute within the HTML code. My current code looks as follows: <!DOCTYPE html> <html> <head> </head> <body> <div id=someid data-myinfo="yyyyy">Hello World</div> <script...

How to store cookie Android like in Java?

java,android,cookies
I want to use the same class I use in a Java application, which works with a Cookie mechanism over a PHP server. The actual class, works great in Java: public class Connection { private HttpURLConnection connection; private String username; private String password; public Connection(String username, String password) { super();...

Cookie is not set properly

javascript,cookies
newbie here. Trying to create a cookie like this function setCook() { var name=prompt("enter your name"); document.cookie=name; var mycookie = document.cookie, fixed_cookie = decodeURIComponent(mycookie); } function getCookie() { var mycookie = fixed_cookie; document.write(mycookie); } setCook(); getCookie(); But somehow the document is blank. Please tell me where i am doing it...

Cookie's expires property cannot be inspected

javascript,cookies
I try to set a cookie in browser ( here chrome ver.41.xxx ) using debugger's console: > document.cookie = 'cookie1=hans; expires=Fri, 03 May 2020 11:00:00 GMT;' Then, I inspect the .cookie property: > document.cookie > "cookie1=Hans" Surprisingly, no expires section! Fiddler also reports the same when I refresh the page:...

ASP.NET Identity 2.0 decrypt Owin cookie

asp.net,asp.net-mvc,wcf,cookies,asp.net-identity
I'm working in a server-side application where I'm applying multi tenancy. In this server side I have a Backoffice (ASP.NET MVC) and a BackEnd (WCF). I want to decrypt Identity cookie so that I can check that it is valid and use it to auth in WCF Services. To be...

Implementing cookies with JS to recognize returning visitors

javascript,jquery,cookies
I have a blog with locked content. User needs to enter their email address into a form in order to see the full content. Problem now is that the same user has to enter their email on every post. How do I implement cookies so that: 1) on a form...

Capturing Cookies (req.headers.cookie) on homepage with Express on node

javascript,node.js,cookies,server-side
I am doing a basic authentication example. I have Node, Express, and Cookie. I make and store a cookie once the user logs in. Upon refreshing the page, I want to use the cookie to show that the user is still logged in on the response, and provide the information...

PHP string '==' returns false on same strings

php,cookies
I have the code which checks user cookies: echo 'prev: ' . $prevCookie; echo 'curr: ' . $currentCookie; if ((string) $prevCookie == (string)$currentCookie) { echo 'same cookies'; } else { echo 'different cookies'; } In approximatelly 0.1% of cases I'm getting following: // prev: xxx // curr: xxx // different...

Cookie not going through

javascript,node.js,cookies,express
I'm trying to set a cookie in the express framework, but it isn't going through, and for the life of me I can't figure out why. The relevant code looks like this: module.exports = function(app) { return function(req, res, next) { if (req.cookies.user_token) { req.session.cookie.httpOnly = false res.cookie('user_token', req.cookies.user_token, {...

How to perform an HTTP/XML authentication with requests

python,xml,authentication,cookies,python-requests
I am trying to authenticate to Docushare with Python 3.4 using requests 2.7. I am relatively new to Python and to the requests module but I've done a lot of reading and am not able to make any more progress. My code doesn't give any errors and I receive a...

Django CSRF cookie not set error if there is cookie value starting with square brackets '['

python,django,cookies,csrf,django-csrf
I have a django site that is hosted on xyz.mysite.com. Parent site mysite.com which I do not own or control sets up a cookie with value [XX]v3|[XXX]. This causes my site to return the error CSRF cookie not set. This happened because django/middleware/csrf.py csrf_token value is set to none when...

Updating unique views using cookies

javascript,php,cookies
I have a forum thread file thread.php that gets topic ID information. Example: thread.php?id=781 I'm trying to create a unique views setup, but I have no idea if this is actually feasible: thread.php: topicId = <?php echo $_GET['id']; ?>; if ($.cookie("unique"+topicId)!=="1") { $.cookie("unique"+topicId,1,{expires: 1000, path: '/'}); // create cookie if...

Is document.cookie ever undefined?

javascript,cookies
I'm just curious if document.cookie can ever return undefined. I read quirksmode's article on cookies and I looked at "Is !document.cookie reliable?" but they don't explicitly answer this question. Can document.cookie ever be undefined?...

self.get_secure_cookie returns None, but cookie exists

python,cookies,tornado
I have a strange error, when check cookie in Tornado`s WebSocketHandler: class MyHandler(WebSocketHandler): def open(self): print(self.get_secure_cookie("cookie")) It returns None, but in browser I can see that cookie (in another login-handler I use self.set_secure_cookie("cookie", "123")) How to fix that? Thanks! Update if I use self.request.headers I only have: { 'Pragma': 'no-cache',...

How to store login session id in cookie in angular js?

javascript,angularjs,session,cookies
I have the following piece of code where I am storing the login credentials of user in local storage along with his authority(whether he is admin or not). .success(function (user) { localStorageService.set('localStorageUser', user.username); localStorageService.set('localStorageUserRole', user.authorities[0].authority); $rootScope.showMenu = true; $rootScope.user = user.username; if(localStorageService.get('localStorageUserRole') === 'ROLE_ADMIN'){ $rootScope.isAdmin = true; } else {...

If statement not working with cookie

javascript,jquery,cookies
I'm setting a cookie value to 1 when a user clicks on an upload button: $('.uploadbtn2').click(function(){ $(this).val("Please wait..."); $.cookie("upload",1,{ expires: 1, path: '/' }); // the page then refreshes a few seconds later }); if ($.cookie("upload")===1) { $('.upload-photo').show(); } If the value of the cookie is equal to 1, then...

User Getting Logged out in IE when closing browser

internet-explorer,session,cookies,p3p
I am running a Drupal 7 site and am noticing a problem on IE9, when the browser window is closed the user is logged out. We have "remember me" module enabled and the cookie is set to not expire. There is no issue on Chrome or any other browser, you...

cookie is not expiring in jQuery

jquery,cookies
I'm an absolute new to jQuery. i have to show popup to user only for two days. (i.e, User-Guide) using cookie we can validate this situation Right! So, "Where i have to set cookie?" my Code is : var eTime = new Date(); eTime.setTime(eTime.getTime() + (30 * 1000)); //cookie will...

Creating Federation Authorization Cookie

asp.net-mvc,cookies,ws-federation
I have an MVC application that is federated, everything works great except the first time I load the site it doesn't pickup my authorization cookie and I have to reload the page to get authorized. It seems what is happening is that this code: MembershipUser user = Membership.GetUser(User.Identity.Name); var claims...

Check if cookies are enabled without redirect

php,cookies
I need on each page check if cookies are enabled.And use this code. <?php setcookie('COOK_CHK',uniqid(),time()+60*60*24); if(!isset($_COOKIE['COOK_CHK'])){ echo"Cookies are disabled!"; exit; } session_start(); ?> However on the first check it gives me false until i don't refresh the page.I include this code in each page so can not redirect every time...

Setting cookies for static files using bottle.py

python,cookies,bottle
New to python. I am using bottle.py as a web server. I have a set of static HTML files that need to be rendered on different routes. I am using static_file() function for the same. I also want to set a session based cookie for the page. SO I am...

(node.js) How to get cookies from remote server?

javascript,node.js,session,curl,cookies
In PHP, getting cookies sent from a remote server is simply a matter of using cURL with some cookie handling option enabled. If I was to treat my server as a client making requests to a remote server, I was wondering how this might be done in node.js? Would my...

Nested Async calls using Scala and Play Framework?

scala,cookies,asynchronous,playframework,playframework-2.0
I would like to make nested asynchronous calls. I would like to perform one async call before I make a 2nd async call. The 1st async call will dictate what parameters or actions to take with the 2nd async call. Here's the original async call: def render(param1:String) = Action.async {...

How to get web page source from a cookie drived web site using Java

java,cookies,website
It is easy to get web page source if it has a regular url with it. Here is an answer for it: How to get a web page's source code from Java But some websites, like Sobeys. they are asking you to input your location first then you can get...

AngularJS: $cookies.remove is not a function

angularjs,cookies,angular-cookies
I am getting the error - "$cookies.remove is not a function" - when trying to clear the cookies in my angular application. As far as I can see I am following what the angular docs says, and also what has been said on this forum to remove cookies. Here is...

With @csrf_exempt still have Set-Cookie: csrftoken

django,cookies
With Django 1.8, I do not want to have a cookie set on the homepage of my site when the users are not logged in. So I decorate my view with @csrf_exempt like from django.views.decorators.csrf import csrf_exempt @csrf_exempt def mainhome(request): When I look at the query I can see the...

Cookie values consistently returning null

javascript,cookies
I'm attempting to use a prompt to have someone enter a value, make that value into a cookie, then have a link that will redirect that person to a second page where their cookie value would be displayed. The issue I'm running into is that the cookie in question continues...

How do I get this cookie into a PHP variable?

php,cookies
I can see it is there, but can't figure out the syntax to get it out? When I issue the following: print_r( $_COOKIE ); The response looks like this. How do I get it out? [HonoluluRealEstate] => Array ( ["ListPriceMin"] => 800000 ) ...

When is the cookie set by AJAX available in javascript?

javascript,ajax,cookies
I'm doing an AJAX call and setting a cookie in the user browser in the response (the server code sets the cookie). I noticed in the success callback from the ajax, the cookie is not available. When I look in document.cookie the new cookie is not there. My question, when...

How to convert an integer to a string in ASP Classic

cookies,asp-classic,session-variables
On the home page of my site, I'm creating a session variable like this: Session("doubleCookie") = DateDiff("s", "01/01/1970 00:00:00", now) I then also create a cookie using the same variable. When a user submits a form, I call the session variable and the cookie to make sure they match. If...

Set cookie to have a value of form entry

javascript,jquery,html,cookies
Asked a related question earlier, but it looks like it was lacking a context, so, couldn't make it work. Trying to set a cookie value of a form entry on click (using carhartl jquery plugin). And getting nothing. Not even errors. Cookies plugin is included into head portion of the...

.htacces rewrite by cookie value

apache,.htaccess,mod-rewrite,cookies,url-rewriting
I have a website in 2 languages. I'm inserting the text for each language through php constants and I define the user language through a cookie (lang=es or lang=en). Now the base url in each language is www.webname.com/ but i want to rewrite it depending on the language. If the...

Storing Check Box Selection in Cookies

c#,asp.net,cookies
I have programmed a Remember Me check box to store the username and password in cookies if the box is checked. My problem is, that if they check it and then re-launch the application the username and password auto fill, but the checkbox does not stay checked. I have not...

PHP Cookie to Track/Limit Website Joins (Preventing Automated Account Creation)

php,cookies,setcookie
I want to implement a solution to limit the number of Website Joins can be made by one user. I thought of tracking IP address but these are to generic now. I'm now looking to set a cookie and increment for each join and then block joins at say 5...

How to assign cookie expiry date?

c#,asp.net,cookies
I am trying to learn about cookies. But there is a point I can't understand. Hope, you can help me. I wrote a short code: using System; using System.Web; namespace WebApplication1 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["Test2"] == null)...

Using a cookie to save the state of a toggled division

jquery,cookies,toggle
While I've found essentially the same question asked a number of times here and on other sites, I've spent hours and hours trying to get those answers to work on my site to no avail; I'm just plain stumped. Possibly because I'm fairly new to Javascript, self-taught, and I'm doing...

multiple SESSION cookies being set?

php,session,cookies
My site is sending two different session id cookies (PHPSESSID), one under "www.sitename.com" and the other "sitename.com". I read this answer here which says to specify the domain used in the 5th parameter, but what about SESSION cookies which are created automatically? I think the issue is that the facebook...

Prevent a triggering action using a cookie with JavaScript

javascript,cookies
In a wordpress site I have a pop up window (for email capture) that is triggered by the "mouseleave" event. The pop up works fine but Once the info is captured or the pop up window closed I dont want to bother the visitor with this pop up anymore. So...

Serializing a java bean into a cookie: Is it bad?

java,json,cookies
In the organization that i work for, there was a serious debate about the following. Scenario: There is a POJO with 6 different properties all are of type Strings. These values need to be persisted as cookies so that it can be picked back when someone does a booking on...

Can I check for the existence of an HTTP only cookie with Javascript? [duplicate]

javascript,authentication,cookies,servicestack,single-page-application
This question already has an answer here: Check if httponly cookie exists in Javascript 1 answer Can I use Javascript to see if an HTTP-only cookie exists, I don't want to see the value, just know whether or not it is there. I need this because I have an...

python-requests does not grab JSESSIONID and SessionData cookies

python,django,session,cookies,python-requests
I want to scrape a pdf file from http://www.jstor.org/stable/pdf/10.1086/512825.pdf but it wants me to accept Terms and Conditions. While downloading from browser I found out that JSTOR saves my acceptance in 2 cookies with names JSESSIONID and SessionData but python-requests does not grab these two cookie( It grab two other...

Please explain this code to me [closed]

c#,asp.net,cookies,request
We hit an unexpected error during our school project. Someone took the time and figured out what it was. But when he fixed it he couldn't explain what he did. I hope someone can explain the following line of code: public string aantalVoorArtikel(object id) { int artikel_id = (int)id; if...

Javascript Retina / HD display detection and blocking page render during reload

javascript,php,cookies,retina
My question is pretty much about page reload rather than retina detection. I'm using the code below in head tag for retina display : <script type="text/javascript"> if( document.cookie.indexOf('device_pixel_ratio') == -1 && 'devicePixelRatio' in window && window.devicePixelRatio == 2 ){ var date = new Date(); date.setTime( date.getTime() + 3600000000 ); document.cookie...