Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($Config["Regopen"] != 0) {
- if (isset($_POST['sendForm'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $cpassword = $_POST['cpassword'];
- $encryptPassword = sha1($password);
- if (!empty($username) && (!empty($password))) {
- if ($password == $cpassword) {
- if (strlen($username) < $strLongUser) {
- if (strlen($password) < $strLongPass) {
- $fetchUsername = "SELECT * FROM useraccounts WHERE username = '$username'";
- if ($stmt = $conn->prepare($fetchUsername)) {
- $stmt->execute();
- $stmt->store_result();
- if ($stmt->num_rows == 0) {
- $stmt->close();
- if ($stmt = $conn->prepare("INSERT INTO useraccounts (username, password) VALUES (?, ?)")) {
- $stmt->bind_param('ss', $username, $encryptPassword);
- $rUser = $_POST['username'];
- $rPass = $_POST['password'];
- $stmt->execute();
- echo '<div class="alert alert-success"><i class="fa fa-check"></i> You have succesfully registered, '.$rUser.'.</div>';
- } else {
- printf("Prepared Statement Error: %s\n", $conn->error);
- }
- } else {
- echo '<div class="alert alert-danger"><i class="fa fa-times"></i> This username was already taken.</div>';
- }
- }
- } else {
- echo '<div class="alert alert-danger"><i class="fa fa-times"></i> The password may consist out of a maximum of 20 characters.</div>';
- }
- } else {
- echo '<div class="alert alert-danger"><i class="fa fa-times"></i> The username may consist out of a maximum of 16 characters.</div>';
- }
- } else {
- echo '<div class="alert alert-danger"><i class="fa fa-times"></i> Please make sure the passwords are equal.</div>';
- }
- } else {
- echo '<div class="alert alert-danger"><i class="fa fa-times"></i> Error: Please fill in your username and password.</i></div>';
- }
- }
- } else {
- echo '<div class="alert alert-warning"><i class="fa fa-times"></i> Sorry, but registration has been disabled.</div>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement