mirror of
https://github.com/gamaio/unps.us-Shortener.git
synced 2025-07-30 13:50:17 +00:00
Add red error boxes in return messages
This is continuing development on the interface, they will fade in the next commit
This commit is contained in:
22
process.php
22
process.php
@@ -1,4 +1,13 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
$catches = explode(":", $_SESSION['catch']);
|
||||
$catchid = $catches[0];
|
||||
$catchVal = $catches[1];
|
||||
|
||||
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
|
||||
die("Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://unps.us\">http://unps.us</a>.");
|
||||
}
|
||||
|
||||
require('api/api.backend.php');
|
||||
require('api/dbsettings.php');
|
||||
@@ -6,7 +15,7 @@
|
||||
$key = '9a211e90b0a0570ed33e47428231e702af47b6f54fb347960f661184e063a1d0'; // KEEP THIS PRIVATE! This is the only thing that authenticates the application
|
||||
|
||||
function sanitize($input){
|
||||
if ($input == null) die("Sanatize() - No Input Provided, Aborting\r\n<br>");
|
||||
if ($input == null) die("<div id=\"error\">Sanatize() - No Input Provided, Aborting</div>");
|
||||
include('api/dbsettings.php');
|
||||
$output = strip_tags($input);
|
||||
$output = stripslashes($output);
|
||||
@@ -23,22 +32,25 @@
|
||||
echo $unpsAPI->shorten($apidb, $key, $shortdb, $short);
|
||||
break;
|
||||
case "dellink":
|
||||
if(empty($_POST['password'])) die("Something went wrong somewhere, but there's no password here");
|
||||
if(empty($_POST['password'])) die("<div id=\"error\">Something went wrong somewhere, but there's no password here</div>");
|
||||
$link = sanitize($_POST['link']);
|
||||
$password = sanitize($_POST['password']);
|
||||
$link = explode("=", $link);
|
||||
if(count($link) != 2){
|
||||
die("<div id=\"error\">I'm sorry, but something went wrong... did you paste the whole link?</div>");
|
||||
}
|
||||
$link = $link[1];
|
||||
echo $unpsAPI->delShort($apidb, $key, $shortdb, $link, $password);
|
||||
break;
|
||||
case "replink":
|
||||
if(empty($_POST['report-details'])) die("Something went wrong somewhere, but I can't find the reason for reporting this link");
|
||||
if(empty($_POST['report-details'])) die("<div id=\"error\">Something went wrong somewhere, but I can't find the reason for reporting this link</div>");
|
||||
$link = sanitize($_POST['link']);
|
||||
$details = sanitize($_POST['report-details']);
|
||||
echo $unpsAPI->reportLink($apidb, $key, $shortdb, $link, $details);
|
||||
break;
|
||||
default:
|
||||
die("I don't know what you want to do... [-Check linkmod-]");
|
||||
die("<div id=\"error\">I don't know what you want to do... [-Check linkmod-]</div>");
|
||||
}
|
||||
}else{ die("I can't do my job if I'm not given a link to work on..."); }
|
||||
}else{ die("<div id=\"error\">I can't do my job if I'm not given a link to work on...</div>"); }
|
||||
|
||||
?>
|
Reference in New Issue
Block a user