Cookie problem - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 03-01-2011, 05:36 AM   #1 (permalink)
Newb Techie
 
Join Date: Mar 2011
Posts: 5
Default Cookie problem

Hi,

I'm having a cookie issue when using cross domain systems and I'm trying to make a check whether or not the cookie gets blocked.

How it is set up:

domain1: checkcookies.php -> Sends httprequest to the 2 files below from domain2.

domain2: createcookie.php -> creates a cookie
domain2: cookieexist.php -> checks if the created cookie exist. If it exists it prints "1" to the screen. If it doesn't it prints "0"

The weird thing is that even though the cookie exist, the domain1 check prints "0" even though the check is done in domain2, and domain 2 prints the result.

Anyone know what the problem might be? Or possibly other ways of doing this?
__________________

__________________
laplagam is offline  
Old 03-02-2011, 03:00 AM   #2 (permalink)
Newb Techie
 
Join Date: Mar 2011
Posts: 5
Default Re: Cookie problem

I'll add some code so you can see what im trying to do. Checkcookies is currently an ASP file.
------------------
Checkcookies.asp(domain1):

dim xmlHTTP, xmlParams, xmlURL

createCookie()
checkIfCookieExists()

Sub createCookie()
set xmlHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

xmlURL = "http://www.domain2.com/cookie/createcookie.php"
xmlHTTP.open "GET", xmlURL, false
xmlHTTP.setRequestHeader "Content-Type", "text/xml"
xmlHTTP.send
set xmlHTTP = Nothing

End Sub

Sub checkIfCookieExists()
set xmlHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

xmlURL = "http://www.domain2.com/cookie/cookieexist.php"
xmlHTTP.open "GET", xmlURL, false
xmlHTTP.setRequestHeader "Content-Type", "text/xml"
xmlHTTP.send
response.write xmlHTTP.responseText
set xmlHTTP = Nothing
End Sub

response.end

------------------------

createcookie.php (create cookie, domain2)

<?php

setcookie("testcookie", "some stuff", time()+3600);

?>

-------------------------

cookieexist.php (checkcookie, domain2)

if(isset($_COOKIE['testcookie']))
{
echo "1";
}
else
{
echo "0";
}

-----------------------------
__________________
laplagam is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cookie problem zellturtle Internet Software and Browsers 4 04-13-2008 08:07 AM
cookie problem with ie7 grkbar Internet Software and Browsers 2 03-05-2008 01:30 AM
Cookie problem foxymama Microsoft Windows and Software 1 12-06-2007 10:29 PM
cookie Rogerio Computer Networking and Internet Hardware 0 08-24-2006 07:42 PM
Cookie Problem oceanic7777 Viruses, Spyware and Malware 0 02-10-2004 06:24 PM



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 12:48 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.