/[drupal]/contributions/modules/sql_auth/sql_auth_update.module
ViewVC logotype

Diff of /contributions/modules/sql_auth/sql_auth_update.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by anarcat, Thu Feb 23 20:27:32 2006 UTC revision 1.3 by anarcat, Thu Feb 23 21:22:57 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: sql_auth_update.module,v 1.1 2006/02/23 20:24:06 anarcat Exp $  // $Id: sql_auth_update.module,v 1.2 2006/02/23 20:27:32 anarcat Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 28  function sql_auth_update_user($op, &$edi Line 28  function sql_auth_update_user($op, &$edi
28         */         */
29        if (variable_get('user_register', 1) == 1) {        if (variable_get('user_register', 1) == 1) {
30          $salt = '';          $salt = '';
31          if (variable_get('mysql_auth_pass_salt', 0)) {          if (variable_get('sql_auth_pass_salt', 0)) {
32            $salt = ", '". user_password() . "'"; // use a random string as an initial salt            $salt = ", '". user_password() . "'"; // use a random string as an initial salt
33          }          }
34          $res = _mysql_auth_query("INSERT INTO %s (%s, %s) VALUES ('%s', %s('%s'".$salt."))", array(variable_get('mysql_auth_table', 'users'), variable_get('mysql_auth_user_col', 'name'), variable_get('mysql_auth_pass_col', 'pass'), $edit['name'], _mysql_auth_current_scheme(), $edit['pass']));          $res = _sql_auth_query("INSERT INTO %s (%s, %s) VALUES ('%s', %s('%s'".$salt."))", array(variable_get('sql_auth_table', 'users'), variable_get('sql_auth_user_col', 'name'), variable_get('sql_auth_pass_col', 'pass'), $edit['name'], _sql_auth_current_scheme(), $edit['pass']));
35        }        }
36        break;        break;
37      case 'update':      case 'update':
38        $salt = '';        $salt = '';
39        if (variable_get('mysql_auth_pass_salt', 0)) {        if (variable_get('sql_auth_pass_salt', 0)) {
40          $salt = ', '. variable_get('mysql_auth_pass_col', 'pass');          $salt = ', '. variable_get('sql_auth_pass_col', 'pass');
41        }        }
42        $res = _mysql_auth_query("UPDATE %s SET %s=%s('%s'%s) WHERE %s='%s'", array(variable_get('mysql_auth_table', 'users'), variable_get('mysql_auth_pass_col', 'pass'), _mysql_auth_current_scheme(), $edit['pass'], $salt, variable_get('mysql_auth_user_col', 'name'), $edit['name']));        $res = _sql_auth_query("UPDATE %s SET %s=%s('%s'%s) WHERE %s='%s'", array(variable_get('sql_auth_table', 'users'), variable_get('sql_auth_pass_col', 'pass'), _sql_auth_current_scheme(), $edit['pass'], $salt, variable_get('sql_auth_user_col', 'name'), $edit['name']));
43        break;        break;
44    }    }
45  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.3