Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy aren't any new accounts I create have their password going into my membership database as encrypted?
    primarykey
    data
    text
    <p>I am trying to create new accounts and have the signup details for each user enter into my membership database as encrypted - at the moment the actual password can be seen in the database. Why is this? I am using the form validation library and have included the md5 rule for the password field but it doesnt seem to have made a difference.</p> <p>Controller:</p> <pre><code> function register() { $this-&gt;load-&gt;helper(array('form', 'url')); $this-&gt;load-&gt;library('form_validation'); $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'required|callback_usernameTaken|min_length[5]|max_length[12]|trim'); $this-&gt;form_validation-&gt;set_rules('password', 'Password', 'required|md5|trim'); $username = $this-&gt;input-&gt;post('username'); $password = $this-&gt;input-&gt;post('password'); if ( $this-&gt;form_validation-&gt;run()&amp;&amp; !$this-&gt;membership-&gt;usernameTaken($username)){ $this-&gt;membership-&gt;newUser($username, $password); $this-&gt;session-&gt;set_userdata('status', 'OK'); $this-&gt;session-&gt;set_userdata('username', $username); redirect('home'); } else { $this-&gt;session-&gt;set_userdata('status', 'NOT_OK'); $this-&gt;load-&gt;view('shared/header'); $this-&gt;load-&gt;view('account/signuptitle'); $this-&gt;load-&gt;view('account/signupview'); $this-&gt;load-&gt;view('shared/footer'); } } </code></pre> <p>Thanks again for the help</p> <p>Model:</p> <pre><code> function newUser($username, $password) { $newMember = array ('username' =&gt; $username, 'password' =&gt; $password); $insert = $this-&gt;db-&gt;insert('membership', $newMember); } function usernameTaken($username) { $this-&gt;db-&gt;select('*')-&gt;from ('membership')-&gt;where('username', $username); $query = $this-&gt;db-&gt;get(); if ($query-&gt;num_rows &gt; 0) { echo "&lt;p&gt;"; echo 'username taken'; echo "&lt;/p&gt;"; return true; } else{ return false; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload