`lastlogin` int(10) unsigned NOT NULL default '0',
`currentlogin` int(10) unsigned NOT NULL default '0',
`lastIP` varchar(15) default NULL,
- `personality` varchar(5) default NULL,
+ `secret` varchar(15) default NULL,
`picture` tinyint(1) default NULL,
`url` varchar(255) default NULL,
`description` text,
require("../config.php");
- if ( isset($x) && isset($s) ) { # x = user.id s = user.username
+ if ( isset($p) && isset($s) ) { # p = user.secret s = user.username
- $user = get_user_info_from_db("id", "$x");
+ $user = get_user_info_from_db("secret", "$p");
if ($user) {
if ($user->username == $s) {
$user->password = md5($user->password);
$user->confirmed = 0;
$user->firstaccess = time();
+ $user->secret = random_string(15);
+ echo $user->secret;
+ $db->debug = true;
if (! ($user->id = insert_record("user", $user)) ) {
error("Could not add your record to the database!");
}
+function random_string ($length=15) {
+ $pool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ $pool .= "abcdefghijklmnopqrstuvwxyz";
+ $pool .= "0123456789";
+ $poollen = strlen($pool);
+ mt_srand ((double) microtime() * 1000000);
+ $string = "";
+ for ($i = 0; $i < $length; $i++) {
+ $string .= substr($pool, (mt_rand()%($poollen)), 1);
+ }
+ return $string;
+}
+
+
function send_confirmation_email($user) {
global $CFG;
$data->firstname = $user->firstname;
$data->sitename = $site->fullname;
- $data->link = "$CFG->wwwroot/login/confirm.php?x=$user->id&s=$user->username";
+ $data->link = "$CFG->wwwroot/login/confirm.php?p=$user->secret&s=$user->username";
$data->admin = "$from->firstname $from->lastname ($from->email)";
$message = get_string("emailconfirmation", "", $data);
// If there's something it cannot do itself, it
// will tell you what you need to do.
-$version = 2002090900; // The current version is a date (YYYYMMDDXX) where
+$version = 2002091000; // The current version is a date (YYYYMMDDXX) where
// XX is a number that increments during the day
$release = "1.0.4"; // For humans only, not used for the upgrade process
execute_sql(" ALTER TABLE `course` ADD `teachers` VARCHAR( 100 ) DEFAULT 'Teachers' NOT NULL AFTER `teacher` ");
execute_sql(" ALTER TABLE `course` ADD `students` VARCHAR( 100 ) DEFAULT 'Students' NOT NULL AFTER `student` ");
}
+ if ($oldversion < 2002091000) {
+ execute_sql(" ALTER TABLE `user` CHANGE `personality` `secret` VARCHAR( 15 ) DEFAULT NULL ");
+ }
return true;
}