Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter appears to have a BUG.
#2

You don't have an else. Therefor it always run, even thought your validation failed.

PHP Code:
public function index()
{
    
$error 0;
    
$realname "";
    
$username "";
    
$word "";

    
$this->load->helper(array('form''url','file'));
    
$this->load->library('form_validation');

    
$config = array(
        array(
'field' => 'rname''label' => 'RealName''rules' => 'required''errors' => array( 'required' => 'Provide%s')),
        array(
'field' => 'uname''label' => 'Username''rules' => 'required''errors' => array( 'required' => 'Provide%s')),
        array(
'field' => 'word''label' => 'Word''rules' => 'required''errors' => array( 'required' => 'Provide%s'))
    );

    
$this->form_validation->set_rules($config);
    if (
$this->form_validation->run() == FALSE)
    {
        
$this->load->view('names');
    }
    else
    {
        
$realname $this->input->post('rname');
        
$username $this->input->post('uname');
        
$word $this->input->post('word');

        if(!
file_exists("C:xampp/htdocs/file1/$realname")) exit ("$realname DoesNotExist");
        if(!
file_exists("C:xampp/htdocs/file2/$realname/$username")) exit ("$username DoesNotExist");
        if(!
file_exists("C:xampp/htdocs/file3/$realname/$word")) exit ("$word DoesNotExist");

        if(isset(
$_POST['submit'])) redirect(BASE_URL.'home');
    }

Reply


Messages In This Thread
RE: CodeIgniter appears to have a BUG. - by jreklund - 09-18-2019, 10:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB