<html><head></head><body>

<h1 align="center">
Join the List
</h1>


<?

// Signing up part

if (isset($_POST['submitted']))
{

	$name = trim(stripslashes($_POST['name']));
	$email = trim(stripslashes($_POST['email']));
	$homepage = trim(stripslashes($_POST['homepage']));
	$errors = array();
	if (empty($name))
		$errors[] = "Fill out the name.<br \>\n";
	if (empty($email))
		$errors[] = "Fill out the email.<br \>\n";
	if (empty($homepage))
		$errors[] = "Fill out the homepage.<br \>\n";
	if (!empty($errors))
		foreach ($errors as $e)
			echo "<font color='red'>$e</a>";
	else
	{
		$pos = stripos($homepage,"http://");
		if ($pos === false)
			$homepage = "http://".$homepage;

		$ip = $_SERVER['REMOTE_ADDR'];
		$date = date('F j, Y H:i:s T');
		@$db = mysql_connect('localhost','db_name','db_password') or die("Can't connect");
		@mysql_select_db('sp07') or die("Can't select a database");
		$q = "insert into List(name,email,homepage,date,ip) values ('$name','$email','$homepage','$date','$ip')";
		@mysql_query($q) or die("Can't perform query");
		echo "<h2 align='center'>Thank you for signing up.</h2>\n";
		@mysql_close($d);
	}

}

echo <<< HERE

<center><table width="50%"><tr><td>
<form name="form1" action="" method="post">
Enter your name <input name="name" type="text" size="50" value="$name"><br />
Enter your email addredd <input name="email" type="text" size="50" value="$email"><br />
Enter your homepage <input name="homepage" type="text" size="50" value="$homepage"><br />
<input type="hidden" name="submitted" value="true">
<center><input type="submit" value="SUBMIT"></center>
</form>
</td></tr></table></center>

<p></p>

<center><a href="A72.php">View the List</a></center>

HERE;


?>

</body>
</html>



