Created
March 14, 2019 18:06
-
-
Save mridulsharma612/f28583d885c3effa37a61638a57a6d02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once "connection.php"; | |
| //print_r($_POST); | |
| //exit(); | |
| if (isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['email']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['confirmpassword'])) { | |
| $firstname = $_POST['firstname']; | |
| $lastname = $_POST['lastname']; | |
| $email = $_POST['email']; | |
| $username = $_POST['username']; | |
| $password = $_POST['password']; | |
| $confirmpassword = $_POST['confirmpassword']; | |
| $sql = "SELECT email FROM users WHERE email='$email'"; | |
| $resultset = mysqli_query($conn, $sql) or die("database error:" . mysqli_error($conn)); | |
| $row = mysqli_fetch_assoc($resultset); | |
| if (!$row['email']) { | |
| $sql = "INSERT INTO users(`firstname`, `lastname`, `email`,`username`,`password`,`confirmpassword`) VALUES ('$firstname', '$lastname', '$email','$username','$password','$confirmpassword')"; | |
| mysqli_query($conn, $sql) or die("database error:" . mysqli_error($conn) . "qqq" . $sql); | |
| echo "registered"; | |
| } else { | |
| echo "1"; | |
| } | |
| } else { | |
| echo 'Invalid Request'; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment