Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6828389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:22:38+00:00 2026-05-26T22:22:38+00:00

I am using Codeigniter 2.0.3 with DataMapper ORM 1.6.0. Integration DataMapper in CI has

  • 0

I am using Codeigniter 2.0.3 with DataMapper ORM 1.6.0. Integration DataMapper in CI has been implemented successfully and everything works fine, except password encryption.

I have model called users.php with class Users. I also have set validation rules:

var $validation = array(
    array(
        'field' => 'password',
        'label' => 'Password',
        'rules' => array('required', 'trim', 'unique', 'min_length' => 5, 'encrypt'),
    ),
    array(
        'field' => 'email',
        'label' => 'Email Address',
        'rules' => array('required', 'trim', 'valid_email')
    )
);

My encrypt function in validation rule:

function _encrypt($field)
{
    // Don't encrypt an empty string
    if (!empty($this->{$field}))
    {
        // Generate a random salt if empty
        if (empty($this->salt))
        {
            $this->salt = md5(uniqid(rand(), true));
        }

        $this->{$field} = sha1($this->salt . $this->{$field});
    }
}

MySQL users table structure:

id
email
password
last_login
created_on

I simple create new user via controller:

$u = new Users();
$u->email = 'mario1@mario-design.info';
$u->password = 'mario';
$u->save();

EDIT 1:

Full code of users.php model here.


User successfully stored in the database but with original password not encrypted.

What am I doing wrong?

Thanks, Regards
Mario

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:22:38+00:00Added an answer on May 26, 2026 at 10:22 pm

    I solved problem with upgrading DataMapper to 1.8.x version. Now, it works just fine!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the DMZ DataMapper ORM for CodeIgniter. I'm sure it is possible to
I'm looking at using DataMapper ORM with CodeIgniter, but have a scenario where the
I am using the CodeIgniter DataMapper ORM, but there is something that I don't
I am having trouble with a specific query, using Datamapper ORM for Codeigniter. My
I've been using CodeIgniter for some time, and I liked it a lot. It
I am using codeigniter and its pagination class. It works perfectly and it looks
I need help constructing a CodeIgniter Datamapper ORM query that includes join fields. I
I have been using Codeigniter with Doctrine 1.2.3 and I am wondering is it
using CodeIgniter normally one has to specify the controllers in the config/routes.php file. This
I've been using Codeigniter for the past two years and really have become a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.