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