diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-17 16:48:29 +0200 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-17 16:48:29 +0200 |
commit | d0060968b77c39bdf8abffb071c971c166b59edb (patch) | |
tree | 0be52e00a25bd298235a0cf916fb07496d3ab95f /lib/account/new.php | |
download | Bits-d0060968b77c39bdf8abffb071c971c166b59edb.tar.gz Bits-d0060968b77c39bdf8abffb071c971c166b59edb.zip |
First commit.
Diffstat (limited to 'lib/account/new.php')
-rw-r--r-- | lib/account/new.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/account/new.php b/lib/account/new.php new file mode 100644 index 0000000..c06083e --- /dev/null +++ b/lib/account/new.php @@ -0,0 +1,32 @@ +<?php + +$title = "Register"; + +$login = ""; +if (isset($_POST['login']) && isset($_POST['pw1']) && isset($_POST['pw2'])) { + $login = esca($_POST["login"]); + $pw1 = esc($_POST["pw1"]); + $pw2 = esc($_POST["pw2"]); + if ($login == "") { + $error = "You must enter a username."; + } else if ($pw1 != $pw2) { + $error = "You must enter twice the same password."; + } else if ($pw1 == "") { + $error = "You must enter a password"; + } else { + sql("INSERT INTO account(login, password) VALUES('" . escs($login) . "', PASSWORD('$pw1'))"); + $message = "Your account has been created. Please log in now."; + $url = $homepage; + require("tpl/account/login.php"); + } +} + +$form_message = "Please fill in the following form to create an account :"; +$fields = array( + array("label" => "Username : ", "name" => "login", "value" => $login), + array("label" => "Password : ", "name" => "pw1", "type" => "password"), + array("label" => "Confirm password : ", "name" => "pw2", "type" => "password") + ); +$validate = "Create an account"; + +require("tpl/general/form.php"); |