I tried to create a page in PHP using the Moodle libraries, this page is located in different path that my moodle instalacion, but is in the same server. When I try to call the Moodle Libraries my PHP page redirect to the Moodle Dashboard. This is my code.
$user = $DB->get_record('user', array ('idnumber' => 10252, 'deleted' => 0));
//Save picture of the employee in Moodle System
if ($newrev = $this->my_save_profile_image($user->id, $file))
$DB->set_field('user', 'picture', $newrev, array('id'=>$user->id));
I do not know if I am missing something in my code or I need to configure something in my Moodle, I will really appreciate any idea.