Creating Batch Users in TankAuth (CodeIgniter)

As detailed in this Stack Overflow request, I had the need to convert an existing database of users/passwords (stored in plaintext) to our new authentication library driven by CI and TankAuth. User jondavidjohn got me on the right track, and here’s the code I ended up writing to submit to Stack Overflow for sample use:

function batchReg()

// connect to the database

// build it
$query = "SELECT user, email, pass from newusers ORDER BY user ASC";

// ship it
$result = mysql_query($query);

// loop it
while ($row = mysql_fetch_array($result))
$data = $this->tank_auth->create_user($row[‘user’], $row[’email’], $row[‘pass’], FALSE);
echo "<p>";


Leave a Reply

Your email address will not be published. Required fields are marked *