Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php header("Access-Control-Allow-Origin:*"); // Allow all origins
- $InputAction = $_POST["Action"]; // Eventhandler
- if ($InputAction == "Register") {
- echo("-400") } ?>
- XMLHttpRequest cannot load http://api.proxy.wtf/debug.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.0.14:50001' is therefore not allowed access. The response had HTTP status code 500.
- <?php
- header("Access-Control-Allow-Origin:*"); // Allow all origins
- require('includes/config.php'); // Prerequisite
- /** Numeric callbacks (!negative values!)
- -200 Registration successful; validation mail sended
- -250 Username OK
- -300 Username too short
- -301 Username already in use
- -302 Password too short
- -303 Invalid email address
- -304 Email already in use
- -305 Error while registration
- -400 Illegal request
- **/
- $InputAction = $_POST["Action"]; // Eventhandler
- $InputUsername = $_POST["Username"]; // Requesting username
- $InputMailaddress = $_POST["Mailaddress"]; // Requesting mail address
- $InputPassword = $_POST["Password"]; // Requesting password
- if ($InputAction == "Register") { // Action: Register
- if(strlen($InputUsername) < 3){ // Check Username length
- $error[] = 'Username is too short.';
- echo("-300");
- } else { // Check if username already exists
- $stmt = $db->prepare('SELECT username FROM members WHERE username = :username');
- $stmt->execute(array(':username' => $InputUsername));
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- echo("-250");
- if(!empty($row['username'])){ // If username already taken
- $error[] = 'Username provided is already in use.';
- echo("-301");
- }
- }
- }
- else {
- echo("-400");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement