Ok here is what I am TRYING to do.

I am trying to develop a simple affiliate system.

This is what I have right now for the "Add Affiliate" page. The problem is not here really, it's in the cookie setting code.

I understand that cookies are apparently really dumb and hard to use, and this seems to be very true since I can't figure them out. So...the add.php3 creates a new file that SHOULD set a cookie and then redirect the person to the home page. At the home page the persons name should come up as the refer, however I don't believe the cookie is being stored at all. And it most definately is NOT working.

The Add part is here:

http://www.imhosting.com/r/add.php3

And this is the code to that file:
Code:
<html>
<head>
<title>Add Me</title>
</head>

<body bgcolor="#FFFFFF">

<?

if($id) {
	if(!is_file("$id.php3")) {
		$file = fopen("$id.php3","w");
		$html = "<? SetCookie('wchReferer','$id','time()+829304','../','www.imhosting.com'); header('Location: http://www.imhosting.com/index.php3'); ?>"; 
		fputs($file, "$html");
		echo(" User added. \n\n <a href='http://www.imhosting.com/r/$id.php3'>http://www.imhosting.com/r/$id.php3</a> ");
	} else {
?>

<br> User name taken. Please try another. Thank you. <br>
<br>
<form action=add.php3 method=post>
  User ID 
  <input type="text" name="id">
  <input type="submit" value="Add Me">
</form>


<?
	}
} else {
?>

<form action=add.php3 method=post>
  User ID 
  <input type="text" name="id">
  <input type="submit" value="Add Me">
</form>


<?
}

?>
</body>
</html>

Thanks Mucho.
-Mil