-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
114 changed files
with
49,125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# DISABLE INDEXING | ||
|
||
Options -Indexes | ||
|
||
|
||
# BROWSER REDIRECT | ||
|
||
RewriteEngine On | ||
RewriteCond %{REQUEST_URI} !^/alerts | ||
RewriteCond %{REQUEST_URI} !^/api | ||
RewriteCond %{REQUEST_URI} !^/core | ||
RewriteCond %{REQUEST_URI} !^/media | ||
RewriteCond %{REQUEST_URI} !^/utils | ||
RewriteCond %{REQUEST_URI} !^/versions | ||
RewriteCond %{REQUEST_URI} !^/visual | ||
RewriteRule ^(.*)$ /home [R] | ||
|
||
|
||
# BEGIN GZIP | ||
|
||
<ifmodule mod_deflate.c> | ||
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript image/jpg image/png | ||
</ifmodule> | ||
|
||
# END GZIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
require_once '../core/dbconfig.php'; | ||
|
||
class ALERTS | ||
{ | ||
|
||
private $conn; | ||
|
||
public function __construct() | ||
{ | ||
$database = new Database(); | ||
$db = $database->dbConnection(); | ||
$this->conn = $db; | ||
} | ||
|
||
public function runQuery($sql) | ||
{ | ||
$stmt = $this->conn->prepare($sql); | ||
return $stmt; | ||
} | ||
|
||
public function get_alerts($request,$id) | ||
{ | ||
try { | ||
if ($request == "last") { | ||
$stmt = $this->conn->prepare("SELECT MAX(id) FROM `alerts`;"); | ||
$stmt->execute(); | ||
$result = $stmt->fetch(PDO::FETCH_ASSOC); | ||
return $result; | ||
} else { | ||
$stmt = $this->conn->prepare("SELECT $request FROM `alerts` WHERE id=$id"); | ||
$stmt->execute(); | ||
$result = $stmt->fetch(PDO::FETCH_ASSOC); | ||
return $result; | ||
} | ||
} catch(PDOException $ex) { | ||
echo $ex->getMessage(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
// For DEBUG: Display all errors | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', 'On'); | ||
|
||
//Start API | ||
session_start(); | ||
require_once('functions.php'); | ||
$ALERTS = new ALERTS(); | ||
|
||
// Security Methods | ||
$key = "ChatAble"; | ||
if (!isset($_GET['key'])) { | ||
http_response_code(403); | ||
exit("No Key"); | ||
} else { | ||
if ($_GET['key'] != $key) { | ||
http_response_code(403); | ||
exit("Incorrect Key"); | ||
} | ||
} | ||
|
||
|
||
// Function | ||
if (isset($_GET['alerts'])) { | ||
if (!isset($_GET['id'])) { | ||
$request = "last"; | ||
$id = 0; | ||
$result = $ALERTS->get_alerts($request,$id); | ||
print($result['MAX(id)']); | ||
} else { | ||
if (!isset($_GET['request'])) { | ||
exit("Request a row"); | ||
} | ||
$id = $_GET['id']; | ||
$request = $_GET['request']; | ||
$result = $ALERTS->get_alerts($request,$id); | ||
print($result[$request]); | ||
} | ||
} |
Oops, something went wrong.