Difference between revisions of "Moodle"

From assela Pathirana
Jump to navigationJump to search
(Created page with ' category:Computingcatigorty:UNIX')
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:Koninginnedag_2011_DSC_1884.JPG|thumb|300px|]]
==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';
}


 
?>
[[category:Computing]][[catigorty:UNIX]]
</source>
[[category:Computing]][[category:Unix]]

Latest revision as of 08:23, 2 May 2011

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

?>