Arreglos Visuales finales

parent 14ee1aec
Showing with 22 additions and 181 deletions
......@@ -19,7 +19,7 @@ class Pages extends Controller{
'title' => 'InfoFutbol'
];
echo view('templates/header_admin', $data);
echo view('templates/header', $data);
echo view('pages/'.$page, $data);
echo view('templates/footer', $data);
}
......
......@@ -10,185 +10,36 @@ class User extends Controller
public function view($page)
{
if ( ! is_file(APPPATH.'/Views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that
throw new \CodeIgniter\Exceptions\PageNotFoundException($page);
}
$data['title'] = ucfirst($page); //Capitalize the first letter
echo view('templates/header', $data);
echo view('pages/user/'.$page, $data);
echo view('templates/footer', $data);
}
public function auth()
{
$data = [];
helper(['form']);
if ($this->request->getMethod() == "post") {
$validation = \Config\Services::validation();
$rules = [
"email" => [
"label" => "Email",
"rules" => "required"
//"rules" => "required|min_length[3]|max_length[20]|valid_email|is_unique[user.email]"
],
"password" => [
"label" => "Password",
"rules" => "required"
//"rules" => "required|min_length[8]|max_length[20]"
]
];
if ($this->validate($rules)) {
// Llamada a la base de datos para validación
$session = session();
$model = new UserModel();
$name = $this->request->getVar('name');
$email = $this->request->getVar('email');
$password = $this->request->getVar('password');
$data = $model->authenticate($email);
if($data){
$pass = $data['password'];
if(md5($password) == $pass)
$verify_pass = TRUE;
else
$verify_pass = FALSE;
if($verify_pass){
session()->set("name", $data['name']);
session()->set("email", $data['email']);
session()->set("rol", $data['rol']);
session()->set("logged_in", TRUE);
if($data['rol'] == 2){
return redirect()->to(site_url('user/admin_ok'));
}else{
return redirect()->to(site_url('user/login_ok'));
}
}else{
$session->setFlashdata('msg', 'Wrong Password');
return redirect()->to(site_url('user/auth'));
}
}else{
$session->setFlashdata('msg', 'Email not Found');
return redirect()->to(site_url('user/auth'));
}
} else {
$data["errors"] = $validation->getErrors();
}
}
echo view('templates/header_login', $data);
echo view('pages/user/login', $data);
echo view('templates/footer_login', $data);
}
public function register(){
helper(['form']);
$validation = \Config\Services::validation();
$rules = [
'name'=>[
'rules'=>'required',
],
'email'=>[
'rules'=>'required|',
],
'password'=>[
'rules'=>'required|min_length[5]|max_length[12]',
],
'confirm_password'=>[
'rules'=>'required|min_length[5]|max_length[12]|matches[password]',
],
];
if(!$this->validate($rules)){
echo view('templates/header');
echo view('templates/footer');
return view('pages/user/register',['validation'=>$this->validator]);
}else{
// Hacer el registro dentro de la base de datos
$name = $this->request->getPost('name');
$email = $this->request->getPost('email');
$password = $this->request->getPost('password');
$model = new UserModel();
$data = $model->authenticate($email);
if(!$data){
$values = [
'name'=>$name,
'email'=>$email,
'password'=>md5($password),
];
$query = $model->insert($values);
if(!$query){
return redirect()->back()->with('fail', 'Algo ha ido mal');
}else{
$session = session();
session()->set("name", $values['name']);
session()->set("email", $values['email']);
session()->set("rol", 1);
session()->set("logged_in", TRUE);
return redirect()->to(site_url('user/view/confirm'));
}
}else{
return redirect()->back()->with('fail', 'Este usuario ya existe');
}
}
echo view('templates/header');
echo view('pages/user/register', $data);
echo view('templates/footer');
}
public function admin_ok(){
$noticiaModel = new \App\Models\NoticiaModel();
$data['noticias'] = $noticiaModel->findAll();
echo view('templates/header_admin',$data);
echo view('pages/home',$data);
echo view('templates/footer');
}
public function login_ok(){
$noticiaModel = new \App\Models\NoticiaModel();
$data['noticias'] = $noticiaModel->findAll();
echo view('templates/header_user',$data);
echo view('pages/home',$data);
echo view('templates/footer');
}
public function admin_403()
{
echo view('templates/header_403');
echo view('pages/user/admin_403');
echo view('templates/footer');
}
public function logout()
{
session()->destroy();
return redirect()->to('pages/view/home');
}
}
\ No newline at end of file
......@@ -25,12 +25,11 @@ class UserModel extends Model
return $users;
}
public function add($jornada){
$this->insert($equipo);
public function add($users){
$this->insert($users);
}
public function borrarequipo($id){
unlink("/xampp/htdocs/ci/public/img/".$this->where("id", $id)->first()->Imagen);
$this->delete($id);
}
......
......@@ -61,8 +61,6 @@
<div class="btn-group; text-center" role="group" aria-label="">
<button type="submit" name="accion" <?php echo ($accion=="Seleccionar")?"disabled":"";?> value="Agregar" class="btn btn-success">Añadir</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Modificar" class="btn btn-warning">Modificar</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Cancelar" class="btn btn-info">Cancelar</button>
</div>
</form>
......@@ -87,8 +85,8 @@
<td class="text-center">
<form method="POST">
<input type="hidden" name="id_usuario" id="id_usuario" value="<?php echo $usuario->id_usuario ?>"/>
<input type="submit" name="accion" value="Seleccionar" class="btn btn-primary"/>
<input type="submit" name="accion" value="Borrar" class="btn btn-danger"/>
<input type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Seleccionar" class="btn btn-primary"/>
<input type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Borrar" class="btn btn-danger"/>
</form>
</td>
</tr>
......
......@@ -62,8 +62,6 @@
<div class="btn-group; text-center" role="group" aria-label="">
<button type="submit" name="accion" <?php echo ($accion=="Seleccionar")?"disabled":"";?> value="Agregar" class="btn btn-success">Añadir</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Modificar" class="btn btn-warning">Modificar</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Cancelar" class="btn btn-info">Cancelar</button>
</div>
</form>
......@@ -80,7 +78,7 @@
<tr>
<th class="text-center">ID Equipo</th>
<th class="text-center">Equipo</th>
<th class="text-center">Acciones</th>
<th class="text-center">Borrar</th>
</tr>
</thead>
<tbody>
......@@ -91,7 +89,6 @@
<td class="text-center">
<form method="POST">
<input type="hidden" name="id_equipo" id="id_equipo" value="<?php echo $equipo->id ?>"/>
<input type="submit" name="accion" value="Seleccionar" class="btn btn-primary"/>
<input type="button" name="accion" value="Borrar" class="btn btn-danger botonborrar"/>
</form>
......
......@@ -96,8 +96,6 @@
<div class="btn-group; text-center" role="group" aria-label="">
<button type="submit" name="accion" value="Agregar" class="btn btn-success">Añadir</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Modificar" class="btn btn-warning">Modificar</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Cancelar" class="btn btn-info">Cancelar</button>
</div>
</form>
......@@ -126,7 +124,7 @@
<th class="text-center">Equipo V</th>
<th class="text-center">Goles Local</th>
<th class="text-center">Goles Visitante</th>
<th class="text-center">Acciones</th>
<th class="text-center">Borrar</th>
</tr>
</thead>
<tbody>
......@@ -140,7 +138,6 @@
<td class="text-center">
<form method="POST">
<input type="hidden" name="id_partido" id="id_partido" value="<?php echo $partido->id_partido ?>"/>
<input type="submit" name="accion" value="Seleccionar" class="btn btn-primary"/>
<input type="submit" name="accion" value="Borrar" class="btn btn-danger"/>
</form>
</td>
......
......@@ -67,8 +67,6 @@
<div class="btn-group; text-center" role="group" aria-label="">
<button type="submit" name="accion" <?php echo ($accion=="Seleccionar")?"disabled":"";?> value="Agregar" class="btn btn-success">Añadir</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Modificar" class="btn btn-warning">Modificar</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Cancelar" class="btn btn-info">Cancelar</button>
</div>
</form>
......@@ -122,7 +120,6 @@
<td class="text-center">
<form method="POST">
<input type="hidden" name="id_partido" id="id_partido" value="<?php echo $partido->id_partido ?>"/>
<input type="submit" name="accion" value="Seleccionar" class="btn btn-primary"/>
<input type="button" name="accion" value="Borrar" class="btn btn-danger botonborrar"/>
</form>
</td>
......
......@@ -54,8 +54,6 @@
<div class="btn-group; text-center" role="group" aria-label="">
<button type="submit" name="accion" <?php echo ($accion=="Seleccionar")?"disabled":"";?> value="Agregar" class="btn btn-success">Agregar</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Modificar" class="btn btn-warning">Modificar</button>
<button type="submit" name="accion" <?php echo ($accion!="Seleccionar")?"disabled":"";?> value="Cancelar" class="btn btn-info">Cancelar</button>
</div>
</form>
</div>
......@@ -101,7 +99,6 @@
<td class="text-center">
<form method="POST">
<input type="hidden" name="id_jugador" id="id_jugador" value="<?php echo $jugador->id_jugador?>"/>
<input type="submit" name="accion" value="Seleccionar" class="btn btn-primary"/>
<input type="button" name="accion" value="Borrar" class="btn btn-danger botonborrar"/>
</form>
</td>
......
......@@ -27,7 +27,7 @@
<a class="nav-item nav-link" href="<?= base_url("pages/Add_Goles") ?>">Añadir Goles</a>
<a class="nav-item nav-link" href="<?= base_url("pages/Add_Jornada") ?>">Añadir Jornada</a>
<a class="nav-item nav-link" href="<?= base_url("pages/Add_Jugador") ?>">Añadir Jugadores</a>
<a class="nav-item nav-link" href="">Cerrar Sesión</a>
<a class="nav-item nav-link" href="<?= base_url("pages/view") ?>">Cerrar Sesión</a>
</div>
</nav>
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
__ci_last_regenerate|i:1657570933;_ci_previous_url|s:53:"http://localhost/webapp/index.php/pages/view/register";
\ No newline at end of file
__ci_last_regenerate|i:1657570933;_ci_previous_url|s:54:"http://localhost/webapp/index.php/pages/view/login.php";
\ No newline at end of file
__ci_last_regenerate|i:1657569488;_ci_previous_url|s:53:"http://localhost/webapp/index.php/pages/view/register";
\ No newline at end of file
__ci_last_regenerate|i:1657570359;_ci_previous_url|s:53:"http://localhost/webapp/index.php/pages/view/register";
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment