indexu.com

developer blog

Convert md5 password

In indexu 5.x the password is stored in plain text.
If you upgrade from indexu 5.x to indexu deluxe, the installer will convert it automatically to md5.

If you experience user can not login after upgrade, then it could be that the conversion process fail.
If you have this problem, here is a solution.

Create a file called convertmd5.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
include "application.php";
 
if ($_REQUEST['c']) {
  ConvertMD5password();
}
else {
  print "<p>Do you want to convert user password to MD5? <br>
         Make sure that the password is not in MD5</p>
         <p><a href='convertmd5.php?c=yes'>Convert now</a></p>";
}
 
function ConvertMD5password(){
  global $dbConn;
 
  $result = $dbConn->Execute("select * from `idx_users` where length(password) <30");
  while (!$result->EOF) {
    $dbConn->Execute("UPDATE `idx_users` SET `password` = '".md5($result->Fields("password"))."' WHERE `username` = '".$result->Fields("username")."'");
    $result->MoveNext();
  }
 
  return true;
}
?>

Upload this file to indexu root folder, then run with browser.
After it is done, you need to delete this file for security.