Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("connect.php");
- $username=$_POST["login"];
- $password=$_POST["password"]);
- $email=$_POST["email"];
- /* verifica se existe um utilizador com o mesmo nome(login) */
- $query = "SELECT * FROM `accounts` WHERE `login` = '{$username}'";
- $result= mysqli_query($query);
- $num=mysqli_num_rows($result);
- if ($num > 0)
- {
- /* Username already exists */
- echo 'Username already exists';
- }
- /* verifica se os campos estao preenchidos */
- if (empty($_POST['login']) and empty($_POST['password']) and empty($_POST['email']))
- {
- echo ('Fill everything on the form');
- }
- }
- include ("connect.php");
- $insert = "INSERT INTO `basedados`.`accounts` (`login` ,`password`,`email`)
- VALUES ('".$username."','".$password."','".$email."')";
- mysqli_query($MySQL, $insert);
- echo ('The account was created, you can now login!');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement