I have written an external script to update user data in moodle. I included moodle/onfig.php file in the external script. When I access the external script I receive 303 error and redirected to dashboard page, I cannot share the code.
<?php
require_once('../config.php');
if (!empty($CFG->forcelogin) or !isloggedin()) {
echo "<a href='$CFG->wwwroot/login/' target='_blank'>you are not logged in.</a><br/>";
exit();
}
?>
when I comment the require_once('../config.php');
the script is working fine. But I need the config file to update users data.