} if (isset($_GET["action"])) { if ($_GET["action"] == "register") { action_register(); } if ($_GET["action"] == "login") { action_login(); } if ($_GET["action"] == "logout") { action_logout(); } if ($_GET["action"] == "updatepass") { action_updatepass(); } if ($_GET["action"] == "ajaxrefresh") { echo action_ajaxrefresh(0); mysql_terminate(); exit; } if ($_GET["action"] == "submitcode") { $rid = action_submitcode(); } if ($_GET["action"] == "makeproblem") { action_makeproblem(); } if ($_GET["action"] == "updateproblem") { action_updateproblem(); } if ($_GET["action"] == "updateproblemhtml") { action_updateproblemhtml(); }
else if(key=="ajax-contest-status") $("div#"+key).html(value=="Active"?"CQM":value=="Passive"?"Practice":value); else if(key=="ajax-contest-time") countdown = parseInt(value); else $("div#"+key).html(value); } function init(){ if(BrowserDetect.browser!="Firefox") $("input[type=button]").css('padding','3px'); $("code").each( function(index){ $(this).html( "<div class='limit code'>"+$(this).html().replace(/<br>/,'')+"</div>" ); $(this).attr('id','select_code_'+index).attr('title','Double click to select all code.'); $(this).dblclick(function(index){ selectElement($(this).attr('id')); }); } ); } function load(){ data = eval("(<?php if ($admin["ajaxrr"] == 0) { echo addslashes(action_ajaxrefresh(1)); } ?> )"); $.each(data,function(key,value){ process(key,value); }); } function reload(){ $('#ajaxtimer').html('Contacting server via Ajax ...'); $.getJSON("index.php",{action:"ajaxrefresh"},function(data){ $('#ajaxtimer').html('Updating data ...'); $.each(data,function(key,value){ process(key,value); }); ajaxtimer = <?php echo $admin["ajaxrr"]; ?> ; for(i=ajaxtimer;i>0;i--) window.setTimeout("$('#ajaxtimer').html('Updating data in "+i+" second(s).')",(ajaxtimer-i)*1000);