editing cookies

They have: 1,587 posts

Joined: Mar 1999

i run a club that sets a cookies with the player's user name. i was wondering if any of my more devious members could edit their cookies to change the user name in the cookie without me knowing?

------------------
Thumbs up or down ratings of the best and worst ways to make $$$ on the net. CLICK 4 CASH! from Affiliate Programs and Ad Networks

Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?

They have: 850 posts

Joined: Jul 1999

I think that cookies can be edited and still used if you can find the correct one you need.

I suppose you could do somthing like convert the $name in the cookie to it's ascii value (numbers) which would make it harder to edit.

Try somthing like this:

code:

$name = "franky";
#Making the string into it's ascii value
foreach $char (split //, $name)
{
	$char = ord $char;
	if(length($char) == 2) {$char = "0$char";}
	$newname .= "$char:"
}

print "$name is now $newname\n";	

#Making the string back into it's character value
foreach $chars (split /:/, $newname)
{
	$chars = chr $chars;	
	$newname2 .= $chars;
}
print "$newname is now $newname2";
[/code]

The top part will convert the $name to it's ascii value, and the second part will convert the ascii value back to the characters.

------------------
Recycling one glass jar, saves enough energy to watch T.V for 3 hours.

[This message has been edited by robp (edited 10 March 2000).] 

They have: 568 posts

Joined: Nov 1999

It's not that complicated

code:

print "Set-Cookie: name="player"; value="Someone else" expires=1 Year; path=/; domain=domain.com;";
[/code]

I havn't tested that so you might want to. But you get the basic idea. 

And that should be printed before Print "Content-type: text/html\n\n"; so it will be sent as an HTTP Header and not text to the browser.

If you want to read the cookie I made a little something that would help you.

code:
sub getCookies {
	local(@rawCookies) = split (/; /,$ENV{'HTTP_COOKIE'});
	local(%cookies);

	foreach(@rawCookies){
	    ($key, $val) = split (/=/,$_);
	    $cookies{$key} = $val;
	} 

	return %cookies; 
} 

%cookies = &getCookies;
[/code] 

They have: 1,587 posts

Joined: Mar 1999

thx

------------------
Thumbs up or down ratings of the best and worst ways to make $$$ on the net. CLICK 4 CASH! from Affiliate Programs and Ad Networks

Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.