[eluser]Distortion[/eluser]
Hi.. is it possible to set Validation Rules in Response/My_controller ?
Ex. in my response/Account.php.. just don't mind the other Codes..
Code:
class controller_Account extends CI_Controller {
function login($form_fields){
$ajax = CJAX::getInstance();
$this->load->model('account_model');
// if the user Enter wrong information Show Validation Errors
if($this->form_validation->run() == false) {
// Write Login Logs Error
$this->logs->write_login(validation_errors());
$ajax->error(validation_errors(),5);
}
else {
// Check if the user Account is Exists
if($this->account_model->login() == true) {
/* if Registered Go Here.. */
$this->account_model->set_login_session(); // set Session
// Write login logs to ok
$this->logs->write_login('ok');
// Redirect User to the page He Viewd
redirect($this->input->post('return_url'));
}
else {
/* Incorrect Credentials */
$ajax->warning('Incorrect Email Address or Password',5);
}
}
}
}
in my View/Account/login.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php