function error($e = null) { global $timer; error_log("ERROR: {$e}"); if ($e !== null) { echo '{"status": "ERROR", "results":"' . $e . '"}'; } else { echo '{"status": "ERROR"}'; } if (isset($timer)) { $timer->setMarker('ERROR'); InsertBenchmarkDB($timer); //Save the data on DB } die; }
if (!isset($value['f']) || !isset($value['l']) || !isset($value['v']) || !isset($value['u'])) { error('missing parameters'); } $u = $value['u']; } else { error('unrecognized command'); } $timer->setMarker('setup'); //print "u: $u, ids_text: $ids_text<br>"; if ($col == 'login') { if ($realUser == $u) { //Do not overwrite name in mock mode! $good = User::SetDataFromFB($u, $value['f'], $value['l'], $value['v']); } } else { if (!User::SetColumn($u, $col, $value)) { error('Problem on the server, this field cannot be updated. Please retry later.'); } } $timer->setMarker('query'); InsertBenchmarkDB($timer); //Save the data on DB echo '{"result": "OK"}'; if (isset($XML_debug)) { $timer->display(true); // if you want to display immidiately and to output html formated //$profiling = $timer->getProfiling(); // get the profiler info as an associative array //echo "<br> This is the array: <br> <pre>"; //print_r($profiling); //echo "</pre><br>"; }