mirror of
https://github.com/hnhx/librebin.git
synced 2025-01-09 11:07:26 -03:00
added API key support
This commit is contained in:
parent
b5226eebaa
commit
36d585fdb6
3 changed files with 15 additions and 3 deletions
3
config.php
Normal file
3
config.php
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
$api_keys = array("857db8bac39d3a6374fe57635a21ce09024403def203e01bc0906ebe4e4fdff21c74afcc1ed5315258b23cdf33c90a2368fe");
|
||||
?>
|
3
config.php.example
Normal file
3
config.php.example
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
$api_keys = array();
|
||||
?>
|
12
index.php
12
index.php
|
@ -13,6 +13,8 @@
|
|||
<a href="./index.php">Upload</a>
|
||||
|
||||
<?php
|
||||
require("config.php");
|
||||
|
||||
$content = NULL;
|
||||
|
||||
if (isset($_REQUEST["p"]))
|
||||
|
@ -55,7 +57,7 @@
|
|||
}
|
||||
|
||||
|
||||
if (!isset($_REQUEST["content"]) || !isset($_REQUEST["captcha"]))
|
||||
if (!isset($_REQUEST["content"]))
|
||||
die();
|
||||
|
||||
session_start();
|
||||
|
@ -64,8 +66,12 @@
|
|||
|
||||
if ($_SESSION["captcha"] != strtoupper($_REQUEST["captcha"]))
|
||||
{
|
||||
$valid_upload = false;
|
||||
echo "<p>Invalid captcha!</p>";
|
||||
|
||||
if (!in_array($_REQUEST["api_key"], $api_keys))
|
||||
{
|
||||
$valid_upload = false;
|
||||
echo "<p>Invalid captcha!</p>";
|
||||
}
|
||||
}
|
||||
|
||||
$content_len = strlen($content);
|
||||
|
|
Loading…
Reference in a new issue