Location: PHPKode > projects > Alliances Manager > control/ControlUsuario.php
<?php
/*
 *  Alliances Manager (Gestionador de Alianzas) - Travian
 *  Copyright (C) 2008-12  Viva Mayer, Francisco Mesías <hide@address.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

class ControlUsuario extends ControlBase 
{
	public function sesion()
	{
		$error = "";
		$target = "?crtl=Usuario&mod=sesion";
		$titulo = self::$texto->get('HEAD31');
		
		if (isset($_POST['accion']) and $_POST['accion']=="logueo")
		{
			include $this->c_modelos.'ModeloUsuario.php';
			
			$user = new ModeloUsuario;
			$error = $user->loguear(); // vuelve aquí si se produce un error en el inicio de sesión
			
			include $this->c_vistas.'error.php';
		}		
		else { include $this->c_vistas.'Sesion.php'; }		
	}
	
	public function registro()
	{  
		include $this->c_modelos.'ModeloUsuario.php';
		$user = new ModeloUsuario;
	    $error = ".";
		
		if (isset($_POST['accion']) and $_POST['accion']=='registro' )
		   $error = $user->registrar();
		   
		include $this->c_vistas.'registro.php'; 
	}
	
	public function salir()
	{
		include $this->c_modelos.'ModeloUsuario.php';			
		$user = new ModeloUsuario;
		$user->salirse();
		$sinoentra = 1;
		include $this->c_vistas.'Sesion.php';
	}
	
	public function changepass()
	{	
		if (isset($_POST['old_pass']))
		{
			include $this->c_modelos.'ModeloUsuario.php';			
			$user = new ModeloUsuario;
			$error = $user->changepass();
			
			if ($error!='EPC3')
			{
				$titulo = self::$texto->get('HEAD32');
				$target = "?ctrl=Usuario&mod=changepass";
			} else {
				$titulo = self::$texto->get('HEAD33');
				$target = "?ctrl=Usuario&mod=sesion";
			}
			
			include $this->c_vistas.'error.php';
			session_destroy();
		} else include $this->c_vistas.'contrasenia.php';
	}

}

?>
Return current item: Alliances Manager