Delete 'oldapi.php'
This commit is contained in:
parent
c3e0c86604
commit
8b98f69be4
39
oldapi.php
39
oldapi.php
@ -1,39 +0,0 @@
|
|||||||
<?php header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); ?>
|
|
||||||
{
|
|
||||||
"posts": [
|
|
||||||
<?php
|
|
||||||
require "creds.php";
|
|
||||||
|
|
||||||
function test_input($data) {
|
|
||||||
$data = stripslashes($data);
|
|
||||||
$data = htmlspecialchars($data);
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET["postID"])) {
|
|
||||||
$postID = test_input($_GET["postID"]);
|
|
||||||
$result = mysqli_query($mysqli, "SELECT PostID,Username,Time,Message FROM posts WHERE PostID = ".$postID);
|
|
||||||
} else {
|
|
||||||
$postID = "";
|
|
||||||
$result = mysqli_query($mysqli, "SELECT PostID,Username,Time,Message FROM posts ORDER BY PostID DESC");
|
|
||||||
}
|
|
||||||
|
|
||||||
while($res = mysqli_fetch_array($result)) {
|
|
||||||
echo " {\n";
|
|
||||||
echo ' "postID": '.$res['PostID'].",\n";
|
|
||||||
echo ' "username": "'.$res['Username'].'"'.",\n";
|
|
||||||
echo ' "time": "'.$res['Time'].'"'.",\n";
|
|
||||||
$message = str_replace("\r\n","",$res['Message']);
|
|
||||||
$message = str_replace("\r","",$res['Message']);
|
|
||||||
$message = str_replace("\n","\\n",$res['Message']);
|
|
||||||
//$message = str_replace('"','a',$amessage]);
|
|
||||||
echo ' "message": "'.test_input($message).'"'."\n";
|
|
||||||
if($res['PostID'] == "1" || $res['PostID'] == $postID) {
|
|
||||||
echo " }\n";
|
|
||||||
} else {
|
|
||||||
echo " },\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user