Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- AJAX: -->
- <script>
- $(document).ready(function(){
- $("#signupform").submit(function(event){
- event.preventDefault();
- $.ajax({
- url: "submitform.php",
- type: "POST",
- data: $('#signupform').serialize(),
- success: function(result){
- if(result! = ""){
- alert("Error");
- }
- else{
- $(location).attr('href', 'login2.php');
- }
- },
- error: function(){
- alert("error");
- }
- });
- //}
- });
- });
- </script>
- <!-- PHP: -->
- <?php
- ini_set("display_errors", 1);
- session_start();
- ?>
- <?php
- $conn = mysqli_connect("localhost", "root", "", "winkcage");
- $im = $_SESSION["pathsession"];
- $nam = $_POST["name"];
- $usernam = $_POST["username"];
- $phon = $_POST["phone"];
- $pass = $_POST["password"];
- $userexist = "SELECT * FROM signup WHERE username = '$usernam'";
- $userexistrun = mysqli_query($conn, $userexist);
- $userResults = mysqli_num_rows($userexistrun);
- if($userResults == 1)
- {
- echo "This user already exits";
- }
- else
- {
- $signquery = "INSERT INTO signup(name, username, phone, password, img) VALUES('$nam', '$usernam', '$phon', '$pass', '$im')";
- if ($im != "" && $nam != "" && $usernam != "" && $phon != "" && $pass != "")
- {
- $signqueryrun = mysqli_query($conn, $signquery);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement