Unreal Engine

Unreal - Varest Post Login Form


Unreal Varest Post Login Form

































<?php
        header('Access-Control-Allow-Origin: *');
        header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
        header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
        header("Allow: GET, POST, OPTIONS, PUT, DELETE");
        
        //Incluimos la conexión a la base de datos
        include_once 'db_connect.php';
        
        //SIMPLE LOGIN SERVER
        //For use in production, you need to check the incoming POST data
        
        if (!isset($_GET['Token'])){
        echo json_encode('User or password is not set.');
        exit;
        }
        
        $Token = $_GET['Token'];
        
            //Creamos la consulta
            $sql = "SELECT id, Nombre_Completo, InstitucionEducativa, Grado, Fecha_Nacimiento, Token, Fecha_Creacion, Tarjeta_Identidad FROM tabla WHERE Token='$Token' ";
             //$sql = "SELECT id, Nombre_Completo, Correo, Celular, Clave FROM usuarios ";
        
            //Ejecutamos la consulta
            $result = mysqli_query($conn, $sql);
        
            //Verificamos si la consulta fue exitosa
            if($result ->num_rows > 0){
                $id;
                //Obtenemos el último ID insertado
                while($row = $result->fetch_assoc()) {
                    $id = $row["id"];
                  }
        
                //Creamos un array con la respuesta
                $data_arr = array(
                    'is_authorized'=>false,
                    'other_data'=>array(
                    'money'=>10000,
                    'id'=>$id,
                    'bonus'=>false,
                    'admin'=>true,
                    ));
                $data_arr['is_authorized']=true;
                //Codificamos el array a formato JSON
                echo '{"params":{"Result":"success"}}';
            } else {
                //Si la consulta no fue exitosa, mostramos un error
                echo 'Error al registrar el usuario';
            }
        
        
        ?>