Difference between revisions of "Moodle"

From assela Pathirana
Jump to navigationJump to search
Line 1: Line 1:
==Changing The Root Password==
* Forgotten the root password. E-mail is not provided when creating the account or no e-mail working.
<source lang=php>
<?php
include('config.php'); # need to run at the moodle root via web browser!
//////////
$username = 'foo';
$newpassword = 'bar';
/////////
if ($userobj = get_record_select('user', "username='$username'", 'id, password')) {
        $userobj->password = md5($newpassword);
            update_record('user', $userobj);
                echo 'Password changed';
} else {
        echo 'Invalid username';
}
?>
</source>
[[category:Computing]][[category:Unix]]
[[category:Computing]][[category:Unix]]

Revision as of 08:21, 2 May 2011

Changing The Root Password

  • Forgotten the root password. E-mail is not provided when creating the account or no e-mail working.
<?php
include('config.php'); # need to run at the moodle root via web browser!
//////////
$username = 'foo';
$newpassword = 'bar';
/////////
if ($userobj = get_record_select('user', "username='$username'", 'id, password')) {
        $userobj->password = md5($newpassword);
            update_record('user', $userobj);
                echo 'Password changed';
} else {
        echo 'Invalid username';
}

?>