Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $app->get('/api/registaruser/{username}/{password}', function($request){
- $user = $request->getAttribute('username');
- $password = $request->getAttribute('password');
- $iduser = 0;
- require_once('db/connect.php');
- foreach($db->animais()
- ->where("username", $user)
- ->where("password", $password)
- as $row){
- $data[] = $row;
- }
- if(isset($data)){
- $data1["status"] = "erro";
- echo json_encode($data1, JSON_UNESCAPED_UNICODE);
- } else{
- $arrayRegistar = array(
- "username" => $user,
- "password" => $password,
- "id_user" => $iduser,
- "nome" => $user,
- "gps_chip" => 0,
- "email" => "0"
- );
- $animais = $db->animais();
- $result = $animais->insert($arrayRegistar);
- if($result){
- $data1["status"] = "sucesso";
- echo json_encode($data1, JSON_UNESCAPED_UNICODE);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement