I am creating an iPhone app, and am using this method to create a cookie that will be accessed site-wide:
NSMutableDictionary *cookieDictionary = [NSMutableDictionary dictionaryWithCapacity:4];
[cookieDictionary setObject:@"status" forKey:NSHTTPCookieName];
[cookieDictionary setObject:[self.usernameField text] forKey:NSHTTPCook...
Hi all,
how can I set cookies in the middle of a document, without incurring a 'headers already sent' error? What I'm trying to do is make a log out script (the log in cookie setting works...so odd. Is it because it's enclosed in an if statement?) however I've already echoed the page title and some other stuff at the top of the page, bef...
What is the last Unix time in decimal? I'm going to set it as the expiration date of cookies (using PHP). Is it possible to cause problem?
...
I have a cookie that I use on my app. It looks like this:
+-------+-------+-----------------------+-------+----------+
| Name | Value | Domain | Path | Expires |
+-------+-------+-----------------------+-------+----------+
| foo | bar | my.domain.tld | / | Session |
+-------+-------+-------------------...
I'm writing a rack middleware component for a rails app that will need to conditionally set cookies. I am currently trying to figure out to set cookies. From googling around it seems like this should work:
class RackApp
def initialize(app)
@app = app
end
def call(env)
@status, @headers, @response = @app.call(env)
@r...
Hi All,
I have two php scripts
test.php
<?php
header("location: test2.php");
setcookie("test", "8kFL4IZfjkBmV7AC", time()+60*60, '/');
exit;
?>
test2.php
<?php
var_dump($_COOKIE);
?>
I then point my browser to test.php which redirects to test2.php. I then get the following results.
In firefox, i get the following:
array
...
Hi,
I know this has been asked before but I needed some clarification and confirmation.
I've been told when creating cookies, to use httponly to prevent XSS.
So my clarification is if I use httponly, will my php scripts accessed via ajax request still be able to determine my active php session (default: phpssessid) and retrieve my $_SE...
I'm just trying to set and use a cookie but I can't seem to store anything.
On login, I use:
setcookie("username", $user);
But, when I use Firefox and the Web Developer plugin Cookies -> View Cookie Information There is no username cookie.
Also, when I try to access the value from a subsequent page using
$_COOKIE["username"]
It is...
I'm using the following functions to set an array of values in a cookie in PHP, but I also need an "add" and "edit" function - any suggestions on how I can do that?
function build_cookie($var_array) {
if (is_array($var_array)) {
foreach ($var_array as $index => $data) {
$out.= ($data!="") ? $index."=".$data."|" : "";
}
...
The relevant peice of code is below. According to php.net I have to make sure there is no output, not even any whitespace. There isn't any. the php tag is the very first tag in the document no whitespace preceding it. What am I doing wrong?
<?php
// main.php
// 6:48 PM 8/6/2010
include('config.php');
// Does myid cook...
I set the cookies regularly in a callback page in my Twitter application. Everything works fine.
Now, using jQuery, I submit a form, and the callback function activates a PHP script. That script only needs to set one cookie to the serialized values of $_POST; and the values run fine (both serialized and normal, I echoed them out to debu...
this what i'm using to set cookie
setcookie("remember", $code, time()+1209600, "/", ".$domain");
And this is working, when i close the window
but why are the cookies getting deleted from client machine when i close the broswer ?
I've set for 1209600 seconds - 2 weeks.
when i close my browser, i'm not able to see the cookie...its get...
On my content page I have the code (in page_load):
if (Master.pageAction == "remove")
{
int removeProductID = int.Parse(Request.QueryString["ID"]);
int removeOptionID = int.Parse(Request.QueryString["optID"]);
Master.myBasket.removeFromBasket(removeProductID, removeOptionID);
//Response.Redirect("...
For some reason i am unable to instantiate the set_cookie outside of the MainHandler..
This is a little code to show what im wanting to do..
Can Anyone help??
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
from GenCookie import *
class MainHandler(t...
I have made a site in PHP and I'm using cookies for logging in/out.
It works great on all types of browsers in Windows XP but the case is vice versa when it comes to Windows Seven. It doesn't log in when I use this part of code:
setcookie("var_name","var_value");
And I have to define an expiry time like this:
setcookie("var_name","var...
Hello, I use the following piece of code in an include file. Because it it used in two instances within my code, I wanted to separate it into another include file and use with require_once() where it is needed. However, I noticed that if I do that, the cookies won't set. Everything else seems to work though. Is this a bug or this just ca...
Hello all
i have 2 domains e.g. test1.com and test2.com and i need user login cross at this 2 domains.
both domains run on same server, i hobe for help, :)
...