mirror of
https://github.com/gamaio/lobli.git
synced 2024-12-22 19:52:40 +00:00
Test for valid token.
Whoops. http://lob.li/8pg While functional in theory, header(location:index.php) will load the index again in the message field with non-functioning javascript
This commit is contained in:
parent
28e0ce013a
commit
cb3008536d
@ -50,10 +50,16 @@
|
||||
require('Include/PHP/functions.php');
|
||||
|
||||
if(isset($_GET['resolve']) && !empty($_POST['link'])){
|
||||
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
|
||||
if(empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
|
||||
die("<div id=\"danger\" class=\"alert alert-danger\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://lob.li\">lob.li</a>.</div>");
|
||||
}
|
||||
|
||||
if(!$redis->exists("tokens:".$_SESSION['token']) || $redis->get("tokens:".$_SESSION['token']) == 1){
|
||||
echo "<script>alert('Invalid or expired token. Please try again');</script>";
|
||||
include("Include/PHP/token.php");
|
||||
header("location:index.php");
|
||||
}
|
||||
|
||||
$link = $_POST['link'];
|
||||
$trTtl = $redis->ttl("links:$link");
|
||||
if($trTtl == -2){ // Didn't find links:linkid, checking if long link
|
||||
@ -76,10 +82,18 @@
|
||||
}
|
||||
|
||||
if(!empty($_POST['link']) || !empty($_POST['linkage'])){
|
||||
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
|
||||
if(empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
|
||||
die("<div id=\"danger\" class=\"alert alert-danger\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://lob.li\">lob.li</a>.</div>");
|
||||
}
|
||||
|
||||
if(!$redis->exists("tokens:".$_SESSION['token']) || $redis->get("tokens:".$_SESSION['token']) == 1){
|
||||
echo "<script>alert('Invalid or expired token. Please try again');</script>";
|
||||
include("Include/PHP/token.php");
|
||||
header("location:index.php");
|
||||
}
|
||||
|
||||
$redis->set("tokens:".$_SESSION['token'], 1);
|
||||
|
||||
//$short = sanitize($_POST['link'], $seperator);
|
||||
$short = $_POST['link'];
|
||||
$linkage = $_POST['linkage'];
|
||||
|
Loading…
Reference in New Issue
Block a user