addurl.php:
Code: Select all
<?
include("header.php")
?>
<form action="msgurl.php" method="post">
<table border="0">
<tr><td colspan=2 align="center"><h1>Add A New URL</h1></td></tr>
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="40">
</td></tr>
<tr><td>URL:</td><td>
<input type="text" name="url" maxlength="200">
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Submit">
</td></tr>
</table>
</form>
Code: Select all
<?
$host="localhost";
$user="xxxxxxx";
$pass="xxxxxxx";
$database="xxxxxxx";
$username=$_POST['username'];
$url=$_POST['url'];
mysql_connect($host,$user,$pass);
mysql_select_db($database) or die("Database Not Found");
$query = "INSERT INTO url VALUES ('','$username','$url')";
mysql_query($query);
mysql_close();
echo "You have added the URL succesfully! Click <a href=members.php>here</a> to return to the members area."
?>