Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once 'Connect.php';
- function reg($obj){
- global $con;
- $newsub = json_decode($obj);
- $username = $newsub ->username;
- $enc_pass = $newsub->pass;
- $email = $newsub ->email;
- $Fname = $newsub ->fname;
- $Lname = $newsub->lname;
- $query2 = $con->prepare("
- SELECT *
- FROM user
- WHERE username = :username");
- $query2->bindParam(':username', $username);
- $query2->execute();
- $query = $con->prepare("INSERT INTO user (Fname, Lname, Email, Username, Password) VALUES(:fname, :lname, :email, :username, :password)");
- $query->bindParam(':fname', $Fname);
- $query->bindParam(':lname', $Lname);
- $query->bindParam(':email', $email);
- $query->bindParam(':username', $username);
- $query->bindParam(':password', $enc_pass);
- echo $Fname;
- echo $Lname;
- echo $Email;
- echo $username;
- echo $enc_pass;
- if($query2->rowCount() > 0){
- echo "<h1>username already exists please try diffrent log on</h1>";
- }
- else{
- $query->execute();
- header("Location: https://mayar.abertay.ac.uk/~1800854/WebDevTest/View/signin.php");
- die();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement