mirror of https://github.com/itflow-org/itflow
Added an API along with a an API key
This commit is contained in:
parent
eddb065833
commit
7b2f608355
13
alerts.php
13
alerts.php
|
|
@ -1,11 +1,22 @@
|
|||
<?php include("header.php"); ?>
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM alerts ORDER BY alert_id DESC"); ?>
|
||||
<?php
|
||||
if($_GET['status'] == "archived"){
|
||||
$where_clause = "> 0";
|
||||
}else{
|
||||
$where_clause = "= 0";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM alerts WHERE alert_ack_date $where_clause ORDER BY alert_id DESC"); ?>
|
||||
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h6 class="float-left mt-1"><i class="fa fa-exclamation-triangle"></i> Alerts</h6>
|
||||
<a href="?status=new" class="btn btn-primary btn-sm badge-pill float-right">New</a>
|
||||
<a href="?status=archived" class="btn btn-primary btn-sm badge-pill float-right mr-2">Archived</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
include("config.php");
|
||||
|
||||
if($_GET['api_key'] == $config_api_key){
|
||||
|
||||
if(isset($_GET['cid'])){
|
||||
|
||||
$cid = intval($_GET['cid']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients WHERE client_phone = $cid");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
echo $client_name;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['client_numbers'])){
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients;");
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_name = $row['client_name'];
|
||||
$client_phone = $row['client_phone'];
|
||||
|
||||
echo "$client_name - $client_phone<br>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['client_emails'])){
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients;");
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_name = $row['client_name'];
|
||||
$client_email = $row['client_email'];
|
||||
|
||||
echo "$client_name - $client_email<br>";
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
echo "<h1> Ma!! You've been BAAAAADDDDD!! </h1>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -43,6 +43,8 @@
|
|||
$config_mail_from_name = $row['config_mail_from_name'];
|
||||
$config_account_balance_threshold = $row['config_account_balance_threshold'];
|
||||
|
||||
$config_api_key = $row['config_api_key'];
|
||||
|
||||
$_SESSION['alert_message'] = '';
|
||||
$_SESSION['alert_type'] = "warning";
|
||||
|
||||
|
|
|
|||
3
post.php
3
post.php
|
|
@ -19,8 +19,9 @@ if(isset($_POST['edit_general_settings'])){
|
|||
|
||||
$config_start_page = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_start_page']));
|
||||
$config_account_balance_threshold = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_account_balance_threshold']));
|
||||
$config_api_key = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_api_key']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_start_page = '$config_start_page', config_account_balance_threshold = '$config_account_balance_threshold'");
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_start_page = '$config_start_page', config_account_balance_threshold = '$config_account_balance_threshold', config_api_key = '$config_api_key'");
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-5">
|
||||
<div class="form-group">
|
||||
<label>Account Threshold</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
|
|
@ -32,6 +32,16 @@
|
|||
<input type="text" class="form-control" name="config_account_balance_threshold" placeholder="Set an alert for dollar amount" value="<?php echo $config_account_balance_threshold; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-5">
|
||||
<label>API Key</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_api_key" placeholder="No spaces only numbers and letters" value="<?php echo $config_api_key; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue