Esempio n. 1
0
if ($_REQUEST['method'] == "POST") {
    curl_setopt($ch, CURLOPT_POST, $_REQUEST['method'] == "POST");
}
curl_setopt($ch, CURLOPT_HTTPGET, $_REQUEST['method'] == "GET");
if (in_array("Content-Type: application/json", $headerKeyValue)) {
    $keyValue = json_encode($keyValue);
}
if ($_REQUEST['method'] == "POST") {
    curl_setopt($ch, CURLOPT_POSTFIELDS, $_REQUEST['method'] == "POST" ? $keyValue : null);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerKeyValue);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLINFO_HEADER_OUT, false);
$result = curl_exec($ch);
if ($result === false) {
    $result = "<div style='color:red;'>" . curl_error($ch) . "</div>";
}
$headerSent = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$insertData = array('url' => $_REQUEST['url'], 'params' => serialize(json_decode($keyValue, true)), 'method' => $_REQUEST['method'], 'response' => $result, 'time' => time());
$history_id = has_in_history($insertData);
if (!$history_id) {
    $id = re_db_insert("history", $insertData);
} else {
    $id = $history_id;
    re_db_update("history", $insertData, "id=" . $history_id);
}
$history = re_db_select("history", array("*"), "id = {$id}");
$his = $history[0];
$return = array("id" => $id, "history" => getHistoryAcc($his));
echo json_encode($return);
exit;
Esempio n. 2
0
<?php

require_once 'config.php';
?>

<div>
  	<div><a href="javascript:void(0);" id="clearHistory">Clear History</a><br/><br/></div>
    <div id="accordion">
    	<?php 
$history = re_db_select("history", array("*"), "1=1 order by `time` desc limit 0," . HISTORY_RECORDS);
if ($history) {
    foreach ($history as $his) {
        $str .= getHistoryAcc($his);
    }
}
echo $str;
?>
  	</div>
  </div>
  
  <script type="text/javascript">
$(document).ready(function(){
	$( "#accordion" ).accordion({
	     collapsible: true,
	     heightStyle: "content"
	 }).find('a.openWithPoster').click(function(ev){
		 	ev.preventDefault();
		    ev.stopPropagation();
		    openWithPoster($(this).attr("hisid"));
		 });