Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $server_host = "host";
- $server_username = "username";
- $server_password = "password";
- $server_dbName = "data base name";
- $player_username = $_POST ["usernamePost"];
- $player_password = $_POST ["passwordPost"];
- $player_displayName = $_POST ["displayNamePost"];
- $conn = new mysqli ($server_host, $server_username, $server_password, $server_dbName);
- if (!$conn) {
- echo "Error connecting to the server.";
- }
- $query_code = "SELECT Username FROM users WHERE Username = '{$_POST[usernamePost]}'";
- $result_login = mysqli_query ($conn,$query_code);
- $anything_found = mysqli_num_rows ($result_login);
- if ($anything_found > 0) {
- echo "An account with this username or display name already exsists, please choose another.";
- }
- if ($anything_found <= 0) {
- $sql = "INSERT INTO users (Username, Password, Display_Name)
- VALUES ('".$player_username."','".$player_password."','".$player_displayName."')";
- $result = mysqli_query ($conn,$sql);
- if ($result) {
- echo "You may now login.";
- }
- if (!$result) {
- echo "Error.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement