FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Dynamic sig (know the click)





m-productions
Ok heres the deal, Im having an idea for a contest coming up.. but heres the problem, my sig needs to show 1 of 10 random pics, I've already done this, my .htaccess redirects the pic to a .php, which then pics the img, that works fine. now heres the thing, when the person clicks the sig, its going to load a site, but the site needs to know what pic was clicked on.

I thought i could use cookies for this, (dont worry, everyone who see's the sig woudlnt get a cookie, only people with the "activation cookie" would get this cookie) What i did is, lets say sig 3 was made, I made make a cookie that says "3" for its content. Now this works when you do it on my server.

if you type in the www.mysite.com/picture.jpg it switched to the php, and sets the cookie, however, when you do [img]www.mysite.com/picture.jpg[img] (with [/img] ) it shows the pic at random, but dosnt give the cookie. why is this?

and what else could i use.
DjinniFire
On a forum it basically just shows the random image chosen, in no way does the user go to your website or php file that sets the cookie and thus the user does not get the cookie, they only get the JPG file. There really isn't a way to get the user to get the cookie and such if they are only shown the JPG file through a hotlink.
Manofgames
Another idea is to put the date, users browser, and users ip into a db, the user then has a minute in which to in to visit your other script.
Dougie1
Really! I had set up an automatic code which did this for you with cookies and I was wondering why it didn't work on forums actually.... That is weird. I don't know what you could do instead really.

I am sure I had it working with cookies once before on a forum but that may have been because it had html enabled so I could use <img src="..... for the image.
Manofgames
Dougie1 wrote:
Really! I had set up an automatic code which did this for you with cookies and I was wondering why it didn't work on forums actually.... That is weird. I don't know what you could do instead really.

I am sure I had it working with cookies once before on a forum but that may have been because it had html enabled so I could use <img src="..... for the image.


The bbcode system used on frihost replaces the image [img] tag with <img =''.
There is no reason whatsoever why you shouldn't be able to set cookies in a php image.
The image is just a script which happens to display an image.

M-productions, perhaps if you could show someone your php code, we might be able to work out what's going on.
MrBlueSky
Manofgames wrote:
Dougie1 wrote:
Really! I had set up an automatic code which did this for you with cookies and I was wondering why it didn't work on forums actually.... That is weird. I don't know what you could do instead really.

I am sure I had it working with cookies once before on a forum but that may have been because it had html enabled so I could use <img src="..... for the image.


The bbcode system used on frihost replaces the image [img] tag with <img =''.
There is no reason whatsoever why you shouldn't be able to set cookies in a php image.


I doubt it. When a PHP script outputs an image it has to use a "Content-Type: image/gif" response header. I think this prevents a server from sending a cookie-set header along, and also makes the browser ignore any cookie-set headers send with the response. But I'm not sure about this. It is an interesting issue, though.

---
Manofgames
But if you sent the cookie before you made the image.... but then I suppose you'd get 'headers already sent Sad '
Perhaps if you used output buffering like someone suggested.
mathiaus
m-productions wrote:
my .htaccess redirects the pic to a .php,

Try parsing the file as PHP rather than just redirecting it.
Code:
AddType application/x-httpd-php .jpg
Dougie1
You can definitely set cookies through images.
Related topics
Runescape - OFFICIAL THREAD
[PHP] Calling dynamic pictures
[PHP] mt_rand or rand?
Cheap Domain Name
Dynamic Signatures for Sale!
Tips on making GOOD siggys
Get your DYNAMIC SIGS HERE
www.Dynamic-Sig.com - Dynamic Signature Images
dynamic sig
Need help with my dynamic sig.
[PHP] Problem with Dynamic Sig's Font Color
Calling all PHP Gods! 200 frih$ to fix my dynamic sig!
Php , Making Dynamic sig
dynamic sig help
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.