Moodle

From assela Pathirana
Revision as of 08:23, 2 May 2011 by Root (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Koninginnedag 2011 DSC 1884.JPG

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';
}

?>