remove old readme
[atutor.git] / install / include / ustep_pwd_encryt.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* http://atutor.ca                                                     */
7 /* This program is free software. You can redistribute it and/or        */
8 /* modify it under the terms of the GNU General Public License          */
9 /* as published by the Free Software Foundation.                        */
10 /************************************************************************/
11 // $Id$
12
13 define('AT_INCLUDE_PATH', '../../include/');
14 require (AT_INCLUDE_PATH.'vitals.inc.php');
15
16 print "Checking database<br><br>";
17
18 $sql = "SELECT member_id, first_name, last_name, password FROM ".TABLE_PREFIX."members";
19 $result = mysql_query($sql, $db);
20
21 while ($row = mysql_fetch_assoc($result))
22 {
23         if (strlen($row["password"]) < 40)
24         {
25                 print "updating member ".$row["first_name"]." ".$row["last_name"].": from ".$row["password"]." to " .sha1($row["password"])."<br>";
26                 $sql_update = "UPDATE ".TABLE_PREFIX."members set password = '".sha1($row["password"])."', creation_date = creation_date WHERE member_id=".$row["member_id"];
27                 $result_update = mysql_query($sql_update, $db);
28         }
29 }
30
31 print "<br>Done!";
32 ?>