|
|
|
|
|
|
|
![]() |
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
![]() |
#1 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
How to test if cookies are being accepted?
I have a little php page that tests if they are behind a firewall and I need it to also see if they have cookies enabled.
|
![]() |
![]() |
![]() |
#2 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
without doing a redirect after setting a cookie, I don't know of a reliable way to do so.
Basically something like: index.php <?php setcookie ('cookied','yes') header('Location: cookietest.php'); ?> cookietest.php <?php if ($_COOKIE['cookied']) { print "I've got your warm gooey chocolate chip cookie right here"; } ?> There are other methods, this one is pretty much tried and true. That is consquently the behavior that got one of my web sites banned from google for two years ![]() There might be errors in the code, I didn't test it, but, it should be pretty darn close.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#3 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
A redirect would be fine but I can't figure out where I should put that first bit of code.
This is the page I'm using http://cleoslinks.com/info.php |
![]() |
![]() |
![]() |
#4 |
Vagabond
|
The one cd34 posted works great, if you dont' mind redirecting pages. I have one piece of code that does the testing through an image instead
On index.php there's an image called image.php image.php sets a cookie and redirects to image2.php. image2.php checks if the cookie exist, if not then you have a non-cookie and you can do whatever you want with it. I'll see if I can find the code. |
![]() |
![]() |
![]() |
#5 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
; on the setcookie line
![]()
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#6 |
Vagabond
|
I couldn't find it but I made a quick one: http://nuvisiongroup.com/test/cookietest.html
you should get a green image if you have cookies turned on, red if you don't. http://nuvisiongroup.com/test/cookietest.txt - source for the html page http://nuvisiongroup.com/test/image.phps - source for image.php Doing it that way doesn't fit everybody. But it's a good way to do stealth cookie testing. |
![]() |
![]() |
![]() |
#7 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
Yours works perfect
Mine naturally doesn't |
![]() |
![]() |
![]() |
#8 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
![]() I really need to try to learn php… I have a page with the image tag calling up image.php but it is just showing a broken image. http://cleoslinks.com/info.php I notice that I can load your image.php in a browser but if I load mine I get an error on line 10 http://cleoslinks.com/image.php This is what I have in that file http://cleoslinks.com/image.txt ![]() |
![]() |
![]() |
![]() |
#9 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
I don't think your server has php4-gd installed
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#10 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
PHP Version 4.3.10
Configure Command './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--enable-exif' '--with-gd=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-zlib' '--with-ttf=/usr/local' '--with-freetype-dir=/usr/local' '--enable-gd-native-ttf' '--with-mysql=/usr/local/mysql' '--with-curl' '--with-ncurses' '--enable-cli' '--enable-safe-mode' '--enable-shared' '--enable-static' '--enable-ftp' '--with-mcrypt' '--enable-calendar' '--with-xls' '--with-soap' |
![]() |
![]() |
![]() |
#11 |
Vagabond
|
Odd that you're getting an error on that line. Sounds like a missing ;.... but there is no missing ;
You can replace the image part with this instead (if you don't have gd installed) PHP Code:
|
![]() |
![]() |
![]() |
#12 |
Vagabond
|
http://nuvisiongroup.com/test/image2.phps
That's what your image.php should look like, once we get the error on line 10 taken care of. Are you 100% sure that image.php and image.txt are exactly the same? (have to ask ![]() |
![]() |
![]() |
![]() |
#13 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
check
<?php phpinfo(); ?> does it make any mention of gd? The compile options look right. Perhaps the php.ini file is missing extension=gd.so
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#14 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
I got it
http://cleoslinks.com/info.php I turned on invisibles in my editor and realized that I was picking up tabs when I copied and pasted. |
![]() |
![]() |
![]() |
#15 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
BTW I'm using this page for the ever annoying members of Angel's site for when they send me mail asking me why they are having trouble viewing the feeds or something.
Thanks cd34 and swedguy for the help. ![]() |
![]() |
![]() |
![]() |
#16 |
Vagabond
|
No problem
![]() |
![]() |
![]() |
![]() |
|
|