2013-05-13 27 views
0

Codeigniter 2.1의 양식을 사용하여 컨트롤러에 액세스 할 수 없습니다. 홈페이지에 여러 링크가 있으며 액세스 할 수 있습니다. 그러나 폼에 데이터를 서브 마디로 표시하려면 403 금지 된 오류가 표시됩니다.오류 403 : 금지 된 오류

금지됨이 서버에서 /Pluebas/application/controllers/valiar.php에 액세스 할 수있는 권한이 없습니다.

뷰 :

<!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&aacute;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&oacute;n de correo</label> 
    <input type="text" name="drcorreo" id="dcc"/><br /><br /> 
    <label for="contrasenya" id="cont">Contrase&ntilde;a</label> 
    <input type="password" name="contrasena" id="cmcont"/><br /><br /> 

    <input type="submit" name="envia" id="bentrar" value="Entrar" />  
    </form> 
</div> 

</body> 
</html> 

컨트롤러 :

<?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&oacute;n de 
      correo','trim|required|valid_email|xss_clean'); 

      $this->form_validation->set_rules('contrasenya','Contrase&ntilde;a', 
      'trim|required|md5|xss_clean'); 

    if ($this->form_validation->run()) 
    { 
     echo ("validaci&oacute;n v&aacute;lida"); 
    } 
    else { 
     $this->load->view(''); 
     echo ("validaci&oacute;n incorrecta"); 
     } 
} 

내 .htacess 파일이 단어 모두에서 거부있다. 컨트롤러에 어떻게 접근 할 수 있습니까?

감사합니다.

답변

2

양식 조치는 다음과 같아야합니다 대신

<?php echo form_open('validar'); // needs the form helper to be loaded ?> 

... :

<form action="http://localhost/Pruebas/application/controllers/validar.php" method="post"> 

당신은 양식 조치에 대한 위치로 컨트롤러의 파일 경로를 제공 할 수 없습니다.

+2

+0

그의 코드가 약간 명확하지 않습니다. 그는'validar.php' 컨트롤러를 갖고있는 것 같지만,'validar' 메소드를 가진 컨트롤러'cindice.php'도 가지고 있습니다. 그의 설정에 달려 있습니다. 그렇지만 잘 잡을 수 있습니다. – Mudshark

+0

올바른 ... 위의 제공된 코드 에서처럼 양식을 cindice/validar에 제출해야합니다. 그가 CI에 익숙하지 않고 MVC 패턴을 오용하고 있다고 생각합니다. –