示例#1
0
check_permissions();
//ensue that we can read and write to the cache file
$cached_ip = get_cached_IP($PWD . $DIR_SLASH . $CONFIG['cache_ip']);
$CONFIG['client_id'] = 'DNSmadeEasy.com Updater/2016.01.24 https://www.mysupportforum.com/kaisersoft/';
// get external IP of system
$external_ip = get_external_ip($argv, $CONFIG['ipscript']);
// update DNS if it changed
if ($external_ip === $cached_ip) {
    echo date('r') . " - external IP has not changed: {$external_ip}{$LF}";
    exit(0);
} elseif ($external_ip == '') {
    echo date('r') . " - IP lookup server returned invalid data. {$external_ip}{$LF}";
    exit(99);
} elseif ($external_ip !== $cached_ip && strpos($external_ip, '.') !== false) {
    // update DNS record
    process_records($CONFIG, $RECORDS, $external_ip);
    put_cached_IP($PWD . $DIR_SLASH . $CONFIG['cache_ip'], $external_ip);
    exit(0);
} else {
    echo date('r') . " - ERROR: unhandeld script condition{$LF}";
    exit(99);
}
/*
 * ###################
 * # functions below #
 * ###################
 */
/**
 * get external IP from script agrument or from URL
 * @param array &$argv script arguments array (CLI)
 * @param string $ip_script URL to external IP lookup script
\t}
\telse{

\t}
}
//-->
</script>

JSCRIPT;
echo $javascript;
echo '</head><body>';
// Query to show the bugged courses
$sql = 'select gi.id,list.courseid,list.fullname,list.idnumber from (select c.fullname,c.idnumber,courseid,itemtype,count(courseid) as amount from mdl_grade_items g LEFT JOIN mdl_course c ON (g.courseid = c.id) where itemtype=\'course\' group by c.fullname,c.idnumber,courseid,itemtype having count(courseid) > 1) as list JOIN mdl_grade_items gi ON (list.courseid = gi.courseid) where gi.itemtype=\'course\' order by list.courseid,gi.id';
$records = $DB->get_recordset_sql($sql, null);
$processed_rec = array();
process_records($processed_rec, $records);
if (isset($_POST['ids'])) {
    //    print_r($_POST['ids']);
    $id_strs = $_POST['ids'];
    //first we process the passed ids
    if (is_array($id_strs)) {
        foreach ($id_strs as $id_str) {
            if (preg_match('/(\\d+)_(\\d+)/', $id_str, $a_matches)) {
                check_and_unset($processed_rec, $a_matches[1], $a_matches[2]);
            }
        }
    } else {
        echo 'Not valid post';
    }
    $where = "";
    //process the resulting array