Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,658
» Latest member: mashhadd
» Forum threads: 66,776
» Forum posts: 418,543

Full Statistics

Latest Threads
Delay in ajax response ti...
Forum: General Help
21 minutes ago
» Replies: 0   » Views: 8
Does the controller name ...
Forum: CodeIgniter 4 Discussion
4 hours ago
» Replies: 0   » Views: 24
Improve Pagination CI 3x
Forum: CodeIgniter 3.x
5 hours ago
» Replies: 2   » Views: 143
use active records in lib...
Forum: General Help
7 hours ago
» Replies: 1   » Views: 32
input post empty
Forum: General Help
Yesterday, 02:29 PM
» Replies: 9   » Views: 223
Dynamic Meta Description
Forum: General Help
Yesterday, 10:26 AM
» Replies: 1   » Views: 78
redis driver _get_lock se...
Forum: Issues
Yesterday, 09:05 AM
» Replies: 6   » Views: 166
Release date for 3.2.0?
Forum: CodeIgniter 3.x
Yesterday, 09:01 AM
» Replies: 1   » Views: 125
How do you access the $th...
Forum: CodeIgniter 4 Discussion
10-20-2017, 08:25 PM
» Replies: 7   » Views: 353
new User of CodeIgniter
Forum: Lounge
10-20-2017, 07:57 PM
» Replies: 2   » Views: 137

 
  Community Auth: ACL and groups/roles
Posted by: jgalak - 10-15-2017, 04:03 PM - Forum: Addins - Replies (1)

Considering using Community Auth for an upcoming project, and wondering:  Is there any way to assign ACLs to a group or a role?  So that making a person a member of a given group (or role) automatically grants them the ACL?

This project will have a lot of overlapping user groups with various permissions, so this seems a convenient way to organize things.

I've never used Community Auth before, and can't find and answer to this in the docs.  If it's already been answered somewhere, I'd appreciate a pointer.

Thanks.


  Concurrency in CI?
Posted by: richb201 - 10-15-2017, 11:09 AM - Forum: CodeIgniter 4 Discussion - No Replies

I am working on a Grocery Crud application which maintains a few tables in MySQL. I need to write another small separate CI app which will access that same database being maintained with Grocery crud, and also respond to an ajax get by a completely different JavaScript extension running within Chrome. Bottom line, there is no connection between my chrome extension and my mySQL data other that this ajax interaction.

I am mostly concerned with two separate process's accessing the same table at the same time. In the past we would serialize access to a single resource with a system semaphore. Is there something analogous in ci or is it taken care of under the covers?


  Split login fail condition in 2 conditions to cover “account inactive” case
Posted by: Ajax30 - 10-15-2017, 06:39 AM - Forum: Lounge - Replies (2)

I have made a Registration and Login application with Codeigniter 3.

When someone fills the *Registration form* and submits it successfully, the "active" column of the "users" table receives the value 0, as visible in the image bellow:

[Image: 6oeby.png]

Users will have to activate their accounts before being able to sign in.

The user_login() function inside the Usermodel:

   

PHP Code:
public function user_login($email$password$active) {
      $query $this->db->get_where('users', ['email' => $email'password' => md5($password), 'active' => 1]);
      return $query->row();
 


In the Signin.php controller I have the signin() method: 

 
PHP Code:
 public function signin()
      {  
      $this
->form_validation->set_rules('email''Email''required|trim|valid_email');
      $this->form_validation->set_rules('password''Password''required|trim');
      $this->form_validation->set_error_delimiters('<p class="error">''</p>');
      if ($this->form_validation->run())
      {
        $email $this->input->post('email');
        $password $this->input->post('password');
        $this->load->model('Usermodel');
        $current_user $this->Usermodel->user_login($email$password);
          // If we find a user
        if ($current_user) {
          // If the user found is active
          if ($current_user->active == 1) {
            $this->session->set_userdata(
             array(
              'user_id' => $current_user->id,
              'user_email' => $current_user->email,
              'user_first_name' => $current_user->fname,
              'user_active' => $current_user->active,
              'is_logged_in' => TRUE
              
)
             );
            redirect('home');  
          
} else {
            // If the user found is NOT active
            $this->session->set_flashdata("signin_failure""Your account has not been activated");
            redirect('signin'); 
          
}
        } else {
          // If we do NOT find a user
          $this->session->set_flashdata("signin_failure""Incorrect email or password");
          redirect('signin'); 
        
}
      }
      else
      {
       $this->load->view('signin');
     }
 


but there is a flaw in it because even when the email and password are correct, but the user is inactive, the message is: "Incorrect email or password" Instead of "Your account has not been activated".


  I can't make a news system
Posted by: Fayga - 10-14-2017, 07:02 PM - Forum: General Help - Replies (6)

Hello
I come to you because I would like to make a site under CodeIgniter, but the concern is that I do not get the step to create a news system.
Please, can you give me a .zip containing this one system?
And also, how to make a registration system under this Framework?
Thanks, and soon!
PS: I am French in case


  Form validation returning FALSE
Posted by: dwlamb - 10-14-2017, 01:05 PM - Forum: General Help - Replies (8)

I am undertaking a migration of a project from CI 2.2.x to 3.1.6 and am stuck on validation of an e-mail address on a password reset form.

Below is my code.  This works perfectly in 2.2.x but validation returns false in 3.1.6:

PHP Code:
        if (isset($_POST['email']) && !empty($_POST['email'])) {
            
$this->load->library('form_validation');
            
$this->form_validation->set_rules('email''Email''trim|required|valid_email');
            if (
$this->form_validation->run() == FALSE)
            {
                
$data['errors'] = 'E-mail address you provided is not valid.';
                
$data['inset_content']    = $this->load->view('login/inset_obtain_email_password_reset'$dataTRUE);
                
$this->load->view('view_login_template'$data);
            } else {
                
$email        trim($this->input->post('email'));
                
$user        $this->model_reset_password->email_exists($email);
                if (
$user) {
                    
$this->send_reset_password_email($email,$user['first_name'],$user['salt']);
                }
                
$data['inset_content']    = $this->load->view('login/inset_reset_password_email_sent'$dataTRUE);
                
$this->load->view('view_login_template'$data);
            }    
        } else {
            
$data['inset_content']    = $this->load->view('login/inset_obtain_email_password_reset'$dataTRUE);
            
$this->load->view('view_login_template'$data);
        }
//if 


The problem seems to lie in the new methods for validation core/Form_validation.php public function run() line 422:
PHP Code:
    public function run($group '')
    {
        
$validation_array = empty($this->validation_data)
            ? 
$_POST
            
$this->validation_data;

        
// Does the _field_data array containing the validation rules exist?
        // If not, we look to see if they were assigned via a config file
        
if (count($this->_field_data) === 0)
        {
            
// No validation rules?  We're done...
            
if (count($this->_config_rules) === 0)
            {
                return 
FALSE;
            }
... 

The $validation_array is set set correctly from the $_POST data but the _field_data array is empty.  

I have tried setting rules using the array method and the cascade method as outlined in the Form Validation docs for 3.1.6 and they are not being set under core/Form_validation.php public function set_rules.  CI sees no POST data $this->validation_data as empty.

PHP Code:
    public function set_rules($field$label ''$rules = array(), $errors = array())
    {
        
// No reason to set rules if we have no POST data
        // or a validation array has not been specified
        
if ($this->CI->input->method() !== 'post' && empty($this->validation_data))
        {
            return 
$this;
        } 


Is there something I am missing?

Thanks for taking the time to read this.


  How to get ip?
Posted by: Demort - 10-14-2017, 12:56 PM - Forum: CodeIgniter 4 Support - Replies (2)

Controllers 
$this->request->getIPAddress();

Libraries
?


CI - [b]protected $request;[/b]


  Calculate 2 fields with Active records
Posted by: manhvt - 10-14-2017, 11:17 AM - Forum: General Help - Replies (1)

I have a table with fields
[Image: Rz9ByFZ_RUGgBsAsGxTaiA.png]

I want to looking for some records expired date in 6days.
today - test_time (created date) < duration - 6 days

My code don't work

Code:
$this->db->select("test.*");

$this->db->from('test');

$current_time = time();
$pre7day = $current_time - 7*60*60*24;
$next7day = $current_time + 7*60*60*24;
$this->db->where("duration * con <=", $next7day);
return $this->db->get();
This is a error:
Quote:Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`con` <= 1508605807' at line 3

SELECT `ospos_test`.*FROM `ospos_test`WHERE `duration *` `con` <= 1508605807

Filename: vendor/codeigniter/framework/system/database/DB_driver.php

Line Number: 691

Please help me.

Thanks.
ho


  In ci4, does the uri_to_assoc () method exist in the original Ci3?
Posted by: miaojun - 10-14-2017, 07:21 AM - Forum: CodeIgniter 4 Discussion - Replies (1)

In ci4, does the uri_to_assoc () method exist in the original Ci3?


  timestamp or int in mysql
Posted by: glorsh66 - 10-14-2017, 06:27 AM - Forum: General Help - Replies (2)

Which is better? 
I am making my own user auth lib - and want to wite last activity.
Which is better to use?


  Database Forge Class - COLLATE attribute
Posted by: glorsh66 - 10-14-2017, 05:28 AM - Forum: General Help - Replies (2)

is it possible using DBforge - make a new field with 'COLLATE' => 'utf8_bin',?



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.