include 'classes/hackerearth_api_connect.php';
include 'classes/hackerearth_data.php';
include 'classes/hackerearth_candidate_api_connect.php';
include 'classes/admin.php';
include 'classes/api_table.php';
//including functions
include 'functions/new_rating.php';
include 'functions/probability_function.php';
//declaring contest variables
$contest = new contest();
$contest_id = $contest->get_not_evaluated_contest();
$cid = $contest->get_contest_no($contest_id);
$contest_type = $contest->get_contest_type($contest_id);
//calling the function
if ($contest_type == 1) {
    update_details($contest, $contest_id, $contest_type, $cid);
} else {
    update_details_global($contest, $contest_id, $contest_type, $cid);
}
function update_details($contest, $contest_id, $contest_type, $cid)
{
    //adding contest details
    //creating object of api
    echo "inside update details ";
    $provider = "hackerearth";
    $api_table = new api_table();
    $api = new api($api_table->get_api_url($provider), $api_table->get_client_id($provider), $api_table->get_client_secret($provider));
    $json_data = $api->connect_api($contest_id);
    //creating object of data for getting valuable information from json data
    $data = new data();
    $coders_size = $data->coders_participated($json_data);
Example #2
0
$php_root_path = "..";
require_once "{$php_root_path}/includes/include_all_fns.inc";
require_once "{$php_root_path}/includes/page_includes/page_fns.php";
session_start();
$err_message = " Unable to process your request due to the following problems: <br>\n";
$header = "Edit Personal Details";
$accepted_privilegeID_arr = array(1 => "");
$accepted_phaseID_arr = array(1 => "", 2 => "", 3 => "", 4 => "");
authentication($header, $accepted_privilegeID_arr, $accepted_phaseID_arr, $homepage, $php_root_path, $GLOBALS["DB_PREFIX"], &$err_message);
$error_array = array();
$exempt_array = get_user_details_form_exemptions();
check_form($_POST, $error_array, &$exempt_array);
// echo dump_array($error_array);
if (count($error_array) == 0 && count($_POST) > 0) {
    if ($_POST["submit"] == "Update") {
        if ($result = update_details($_POST, &$err_message)) {
            do_html_header("Personal Details Updated Successfully", &$err_message);
            echo " Your personal information was updated successfully. <br><br><a href='edit_details.php'>View</a> your updated details?<br>\n";
            do_html_footer($err_message);
            exit;
        } else {
            do_html_header("Updating Personal Details Failed...", &$err_message);
            $err_message .= "<br><br> Try <a href='edit_details.php'>again</a>?<br>\n";
        }
    } else {
        if ($_POST["submit"] == "Undo Changes") {
            //Redirect to the same page to undo changes
            $str = "Location: edit_details.php";
            header($str);
            exit;
        }