PDA

View Full Version : signup


chris ladbrook
04-10-2003, 20:19
i would like to add a signup page on my website can anyone tell how i can do this :D


something like this - signup (http://www.beanylan.co.uk/sign.html)

shifty.ricky
04-10-2003, 20:44
Simple


// get the variables posted from the form

$name = $_POST['name'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$company = $_POST['company'];
$addr1 = $_POST['addr1'];
$addr2 = $_POST['addr2'];
$addr3 = $_POST['addr3'];
$addr4 = $_POST['addr4'];
$post = $_POST['post'];
$country = $_POST['country'];
$phone = $_POST['phone'];

// connect to the database

$db = mysql_connect("localhost", "username", "password") or die("Could not connect");
mysql_select_db("cust_info");

// insert into the database

$sql = "INSERT INTO users SET name='".$name."',email='".$email."',pass='".$pass."'";
$result = mysql_query($sql);

if($result)
{

$query = "SELECT * FROM users WHERE email = '$email' LIMIT 1";
$search = mysql_query($query);

if ($search)
{
while($r = mysql_fetch_array($search))
{
$number = $r["number"];

$sitename = ("bithost.co.uk Hosting");
$admin = ("collyer@elenium.net");

$date = date("D dS M, Y");

$msg = "bithost.co.uk Account Validation\n";
$msg .= "\n";
$msg .= "Enter some words\n";
$msg .= "And some more\n";

$to = "$admin";
$subject = "$sitename Account Validation\n";
$mailheaders = "From: BitHost.co.uk <$admin>\n";
$mailheaders .= "Reply-To: BitHost.co.uk <$admin>\n";

mail($email, $subject, $msg, $mailheaders);
mail($to, $subject, $msg, $mailheaders);

}
}
}
else
{
$dave = mysql_error();
echo "
<BR><font size=\"4\"><b>BitHost.co.uk :: Customer Signup</b></font><BR>
<IMG src=\"images/bar.jpg\" width=\"100%\" height=\"2\"><BR><BR>

<font class=\"main\">
Sorry Registration Failed.

<BR><BR>This could be because you are trying to register with an e-mail address already on the system.<BR><BR>If you feel this to be in error please e-mail <a href=\"mailto:webmaster@yourdomain.co.uk\" class=\"blue\">webmaster@yourdomain.co.uk</a></font>

";
}

mysql_close($db);


?>

[M]uuhh
04-10-2003, 20:53
If you dont have any PHP on your site then shifty's code sample is no good. What code does your host support? PHP, ASP etc?

chris ladbrook
04-10-2003, 20:54
noubt just bog standard web hosting :P cheap and cheerful :P

[M]uuhh
04-10-2003, 21:00
So just HTML? You will have to use a 3rd party service i think. or buy some better hosting :o

TazUk
04-10-2003, 21:27
What do you want to do with the information they enter?

chris ladbrook
04-10-2003, 21:29
just get emailed/sent to me.

its for registering for a LAN u see :)

shifty.ricky
04-10-2003, 23:28
You can just do a standard plain ol' html form but in the action put your e-mail address.

Try this



<form method="post" action="mailto:yourname@yoursite.com" enctype="text/plain">
<input type=text name=name>
<input type=submit value="Submit Your Name">
</form>




Add more fields as nessecary.

chris ladbrook
04-10-2003, 23:51
Originally posted by shifty.ricky
You can just do a standard plain ol' html form but in the action put your e-mail address.

Try this



<form method="post" action="mailto:yourname@yoursite.com" enctype="text/plain">
<input type=text name=name>
<input type=submit value="Submit Your Name">
</form>




Add more fields as nessecary.

CHEERS m8 worked a treat :D