HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux aritmodecarnaval.es 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/www/torresncgolf/instalaciones/application/controllers/api.php
<?php

class Api extends CI_Controller {

	function __construct()
	{
		parent::__construct();	
		$this->load->helper(array('form','url', 'util'));
		$this->load->library('session');
	}
	function test()
	{
		echo "hola";
	}
	function login()
	{
		$login = dejar_numericos($this->input->post('login'));
		$passwd = dejar_alfanumericos($this->input->post('passwd'));
				
		$usuarios = $this->db->query('select * from usuario where login=\''. $login . '\' and passwd=\''. $passwd . '\'');
	
		if ($usuarios->num_rows() > 0){ // El usuario existe
			
			registrar_evento('login', 'info', '[APP] El usuario '.$login.' con alias ['.$usuarios->row()->alias.'] ha entrado desde Android', $usuarios->row()->id );

			$response = array(  
				'logged' => true,  
				'user' => $login,  
				'alias' => $usuarios->row()->alias
			);  
			echo json_encode($response); 
			
		} 
		else{ // El usuario no existe
		    registrar_evento('login', 'warning', "[APP] El usuario $login fall� la contrase�a o no existe: Passwd: [$passwd]" );
			 $response = array(  
				'logged' => false,  
				'message' => 'Password o login incorrectos.'  
			);  
			echo json_encode($response); 
		} 
	}
	
	//listar las reservas de hoy
	function listar_hoy(){
		$query = $this->db->query("YOUR QUERY");

		if ($query->num_rows() > 0)
		{
		   foreach ($query->result() as $row)
		   {
			  $temp = array(
			  '' => $row->title,
			  '' => $row->name,
			  '' => $row->body);
			  array_push($response,$temp);
		   }
		}
		echo json_encode($response); 
	}
	//listar las reservas de los 10 siguientes d�as, indicando su autor
	function listar_reservas(){
		$query = $this->db->query("YOUR QUERY");

		if ($query->num_rows() > 0)
		{
		   foreach ($query->result() as $row)
		   {
			  $temp = array(
			  '' => $row->title,
			  '' => $row->name,
			  '' => $row->body);
			  array_push($response,$temp);
		   }
		}
		echo json_encode($response); 
	}
	//listar mis reservas futuras
	function listar_mis_reservas(){
		$query = $this->db->query("YOUR QUERY");

		if ($query->num_rows() > 0)
		{
		   foreach ($query->result() as $row)
		   {
			  $temp = array(
			  '' => $row->title,
			  '' => $row->name,
			  '' => $row->body);
			  array_push($response,$temp);
		   }
		}
		echo json_encode($response); 
	}
	//reservar una pista
	function reservar(){

	}
	//cancelar una reserva
	function cancelar(){
	
	}
	
}








/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */