# Register script

**URL:** <https://forum.kirupa.com/t/register-script/113590>\
**Category:** Uncategorized\
**Created:** [June 19, 2004, 5:40pm UTC](https://forum.kirupa.com/t/register-script/113590 "2004-06-19T17:40:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmayo86](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@jmayo86](https://forum.kirupa.com/u/jmayo86)\
**Post date:** [June 19, 2004, 5:40pm UTC](https://forum.kirupa.com/t/register-script/113590/1 "2004-06-19T17:40:32Z")

</div>

I have made a register script but it doesnt seem to want to work! take a look at this… [www.cubecity.co.uk/join.php](http://www.cubecity.co.uk/join.php), iposted the code below so you could probs sort it!

Register.php

```php
<?php
####################
# Register an user #
####################

$f_name = stripslashes($_POST['f_name']);
$l_name = stripslashes($_POST['l_name']);
$username = stripslashes($_POST['username']);
$password = $_POST['password'];
$password2 = $_POST['password2'];
$email = $_POST['email'];
$error = 0; //no error right now

# Verify given information :
if(!$f_name || !$l_name|| !$username || !$password || !$password2 || !$email)
{
$error = "You didn't give all the informations!";
}

if($password != $password2)
{
$error = "The 2 passwords dont match !";
}

if (!$error) //no error, enter new member
{

# [CONNECT TO YOUR DATABASE]

# Create a date TYPE : 
$date = $year . "-" . $month . "-" . $day;

$SQL = mysql_query("INSERT INTO `auth` ( `userid` , `username` , `userpassword` , `f_name` , 

`l_name` , `email` , `region` , `date` , `gender` , `status` ) VALUES ('', '$username', 

'$password', '$f_name', '$l_name', '$email', '$region', '$date', '$Gender', '0')") or die 

('cannot create new member beacuse: ' . mysql_error());

$vkey = md5($f_name . $l_name . $email . $password);
$vlink = "http://www.cubecity.co.uk/validate.php?user={$username}&key={$vkey}";
$SQL = mysql_query("INSERT INTO `validate` ( `uname` , `key` ) VALUES ('{$username}', 

'{$vkey}')") or die ('cannot create new key beacuse: ' . mysql_error());

$message = "Click this link or paste it into your web browser
{$vlink}";

mail($email, "CubeCity Email Validation", $message,
     "From: noreply@{$_SERVER['SERVER_NAME']}
" .
     "Reply-To: noreply@{$_SERVER['SERVER_NAME']}
" .
     "X-Mailer: PHP/" . phpversion());

header("location: success.html");
}
?>

```

please reply as its stressing me out lol!
