-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdiff.php
41 lines (41 loc) · 1.24 KB
/
diff.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?PHP
if (isset($_GET['id2'])){
$id2 = intval($_GET['id2']);
}else{
die('no get id2');
}
if (isset($_GET['id'])){
$id = intval($_GET['id']);
}else{
die('no get id');
}
$page_description = date('r');
include_once('menu.php');
include_once('/var/www/html/mdwestserve/newsbot.php');
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$id = substr($id,0,10); // protect strlen
$id2 = substr($id2,0,10); // protect strlen
$stmt = $covid_db->prepare('SELECT * FROM coronavirus_api_cache WHERE id = ?');
$stmt->bind_param('i', $id); // https://www.php.net/manual/en/mysqli-stmt.bind-param.php
$stmt->execute();
$result = $stmt->get_result();
$cache = $result->fetch_assoc();
if ($cache['id'] < 1){
die('id less than 1');
}
$stmt = $covid_db->prepare('SELECT * FROM coronavirus_api_cache WHERE id = ?');
$stmt->bind_param('i', $id2); // https://www.php.net/manual/en/mysqli-stmt.bind-param.php
$stmt->execute();
$result = $stmt->get_result();
$cache2 = $result->fetch_assoc();
if ($cache['id'] < 1){
die('id2 less than 1');
}
$diff = xdiff_string_diff($cache['raw_response'], $cache2['raw_response'], 1, true);
if (is_string($diff)) {
echo "Differences:\n<pre>";
echo $diff.'</pre>';
}
include_once('footer.php');