codeigniter - Error 403: forbidden error -
i can't access controller using form in codeigniter 2.1. homepage has several links , can access. when want submint data in form display 403 forbidden error:
forbidden don't have permission access /pruebas/application/controllers/valiar.php on server.
the view:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>anuncios</title> <link rel="stylesheet" href="/pruebas/css/estilos.css" type="text/css" media="screen"/> <link rel="stylesheet" href="/pruebas/css/logestilos.css" type="text/css" media="screen"/> </head> <body> <div id="contenedor"> <div id="menu"> <label for="home" id="inicio"><a href="http://localhost/pruebas/index.php /cindice/">inicio</a></label> <label for="acceso" id="login"><a href="http://localhost/pruebas/index.php /cindice/publicar">publicar anuncio</a></label> <label for="reg" id="registro"><a href="http://localhost/pruebas/index.php /cindice/registro">registro</a></label> <label for="empresa" id="sobrempresa"><a href="http://localhost/pruebas /index.php/cindice/sobempresa">sobre nosotros</a></label> <label for="contacto" id="contactar"><a href="http://localhost/pruebas /index.php/cindice/contacto">contáctanos</a></label> </div> </div> <div id="acformulario"> <?php echo validation_errors(); ?> <form action="http://localhost/pruebas/application/controllers /validar.php" method="post"> <label for="correo" id="dcorreo">dirección de correo</label> <input type="text" name="drcorreo" id="dcc"/><br /><br /> <label for="contrasenya" id="cont">contraseña</label> <input type="password" name="contrasena" id="cmcont"/><br /><br /> <input type="submit" name="envia" id="bentrar" value="entrar" /> </form> </div> </body> </html>
the controller:
<?php if ( ! defined('basepath')) exit('no direct script access allowed'); class cindice extends ci_controller { function __construct() { parent::__construct(); } public function index() { $this->load->view('indice'); } public function validar() { $this->input->post('drcorreo'); $this->input->post('contrasena'); $this->form_validation->set_rules('correo','dirección de correo','trim|required|valid_email|xss_clean'); $this->form_validation->set_rules('contrasenya','contraseña', 'trim|required|md5|xss_clean'); if ($this->form_validation->run()) { echo ("validación válida"); } else { $this->load->view(''); echo ("validación incorrecta"); } }
my .htacess file has words deny all. how can acess controller?
thanks.
your form action should this:
<?php echo form_open('validar'); // needs form helper loaded ?>
... instead of:
<form action="http://localhost/pruebas/application/controllers/validar.php" method="post">
you can't give controller's file path location form action.
Comments
Post a Comment