Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include realpath("./inc/class.template.php");
- include realpath("./inc/config.php");
- $template->_get("header.html");
- $template->_set(array(
- 'TZ_TITLE' => 'Tezzy',
- 'BB_SUBT' => 'Index',
- 'BB_USER' => 'Username'
- ));
- if(isset($_POST['submitR'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $passwordC = $_POST['passwordC'];
- $email = $_POST['email'];
- $ipaddress = $_SERVER['REMOTE_ADDR'];
- $session = session_id();
- if($username == '' | $password == '' | $passwordC == '' | $email == '') {
- header("Location: ./register.php?error=1"); // Tells to fill in all fields
- } elseif ($password != $passwordC) {
- header("Location: ./register.php?error=2"); // Checks to see if password is correct
- } elseif (mysql_num_rows(mysql_query("SELECT * from users WHERE username='" . $_POST['username'] . "'")) == 1) {
- header("Location: ./register.php?error=3"); // Checks to see if username is taken
- } elseif (mysql_num_rows(mysql_query("SELECT * from users WHERE email='" . $_POST['email'] . "'")) == 1) {
- header("Location: ./register.php?error=4"); // Checks to see if email is taken
- } else {
- function sha512($str) { return hash("sha512", $str); }
- $password = sha512($password);
- mysql_query("INSERT INTO users (username,password,email,ip, session) VALUES ('{$username}','{$password}','{$email}','{$ipaddress}','{$session}')");
- header("Location: ./register.php?success=1");
- }
- }
- $template->_get("register_body.html");
- $template->_set(array(
- 'TZ_TITLE' => 'Tezzy'
- ));
- $template->_get("footer.html");
- $template->_set(array(
- 'BB_TITLE' => 'Tezzy'
- ));
- ?>
Add Comment
Please, Sign In to add comment