Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // if(isset($_POST['username']) & isset($_POST['password']) & isset($_POST['nome'])){
- session_start();
- $header = "Content-Type: application/json";
- header($header);
- include_once('connect.php');
- $result1 = array();
- /*$nome = $_POST['nome'];
- $morada = $_POST['morada'];
- $username = $_POST['user'];
- $password = $_POST['pass'];
- $telefone = $_POST['telef'];*/
- $nome = "michel123";
- $morada = "michel123";
- $username = "michel123";
- $password = "michel123";
- $telefone = "123";
- $result = $dbconn->query("SELECT * FROM utilizador WHERE username=$username");
- $total_records = $result->num_rows;
- if($total_records >= 1){
- $result1=array('status'=>'2');
- }
- else{
- $query = "INSERT INTO utilizador (nome, morada, user, pass, telefone)
- VALUES ('$nome','$morada','$username','$password','$telefone')";
- $result = mysqli_query($dbconn, $query);
- if($result){
- $result1=array('status'=>'1');
- }
- else{
- $result1=array('status'=>'0');
- }
- }
- echo json_encode($result1);
- session_write_close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement