From 622617e0681cf80edfb85f986defe3a0a42db919 Mon Sep 17 00:00:00 2001 From: alopexc0de Date: Tue, 25 Dec 2012 01:25:31 -0500 Subject: [PATCH] Fixed captcha with cookies --- short/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/short/index.php b/short/index.php index 52fb88d..4f23fa3 100755 --- a/short/index.php +++ b/short/index.php @@ -4,6 +4,8 @@ $_SESSION = array(); include("captcha.php"); $_SESSION['captcha'] = captcha(); +$code = $_SESSION['captcha']['code']; +setcookie("foxes", $code, time()+120); ?> @@ -50,8 +52,6 @@ function checkRemoteFile($url) } } -$submit; // Declare this since my logs are annoying me to no end x.x - if(isset($_GET['l'])) { // if there is a link... $l = $_GET['l']; // Bring the link into a variable $l = input($l); // Clean said variable to be used in mysql @@ -86,7 +86,6 @@ if(isset($_GET['l'])) { // if there is a link... CAPTCHA security code
- @@ -94,7 +93,8 @@ if(isset($_GET['l'])) { // if there is a link... if($_POST["submit"]){ // If submit button was pressed... if(!isset($_POST['captcha'])) die('You didn\'t enter the captcha'); $captcha = $_POST['captcha']; - if ($captcha != $_SESSION['captcha']['code']) die('You entered the wrong captcha'); + if (!isset($_COOKIE['foxes'])) die('Please allow cookies'); + if ($captcha != $_COOKIE['foxes']) die('You entered the wrong captcha'); if(isset($_POST['dest'])) { // If the text box has something in it $dest=$_POST['dest']; // Pull that into a variable if (strpos(strtolower($dest), 'http://') === false) { // Simple test to see if http:// not part of the link