Ejemplo n.º 1
0
        $password = $_POST['password'];
        $info = $_POST['info'];
        // To protect MySQL injection for Security purpose
        $username = stripslashes($username);
        $name = stripslashes($name);
        $password = stripslashes($password);
        $usrname = mysql_real_escape_string($username);
        $name = mysql_real_escape_string($name);
        $password = mysql_real_escape_string($password);
        //SQL to check if user is already existing
        $user_check = $_SESSION['login_user'];
        // SQL Query To Fetch Complete Information Of User
        $ses_sql = mysql_query("select username from login where username='******'", $connection);
        $row = checkAndGetBackUsername($username);
        $existing = $row['username'];
        echo "<b></b>";
        if (!isset($existing)) {
            $hashedPassword = md5($password);
            if (addNewLoginUser($username, $hashedPassword, 'guest')) {
                addNewGuest($username, $name, $info);
                echo '<script>showSuccess("New Guest Added!");</script>';
            } else {
                echo '<script>showError("Error while adding user!");</script>';
            }
        } else {
            echo '<script>showError("Guest already exists!");</script>';
        }
        mysql_close($connection);
        // Closing Connection
    }
}
Ejemplo n.º 2
0
        $password = $_POST['password'];
        $info = $_POST['info'];
        $email = $_POST['email'];
        // To protect MySQL injection for Security purpose
        $username = stripslashes($username);
        $name = stripslashes($name);
        $password = stripslashes($password);
        $email = stripslashes($email);
        $username = mysql_real_escape_string($username);
        $name = mysql_real_escape_string($name);
        $password = mysql_real_escape_string($password);
        $email = mysql_real_escape_string($email);
        //SQL to check if user is already existing
        $row = checkAndGetBackUsername($username);
        $existing = $row['username'];
        echo "<b></b>";
        if (!isset($existing)) {
            $hashedPassword = md5($password);
            if (addNewLoginUser($username, $hashedPassword, 'admin')) {
                addNewAdmin($username, $name, $info, $email);
                echo '<script>showSuccess("New Admin Added!");</script>';
            } else {
                echo '<script>showError("Error while adding user!");</script>';
            }
        } else {
            echo '<script>showError("ERROR: User alreay exists!");</script>';
        }
        mysql_close($connection);
        // Closing Connection
    }
}