mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
Remove old validation system
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
$(function(){
|
||||
$("#refreshimg").click(function(){
|
||||
$.post('newsession.php');
|
||||
$("#captchaimage").load('image_req.php');
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#captchaform").validate({
|
||||
rules: {
|
||||
captcha: {
|
||||
required: true,
|
||||
remote: "process.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
captcha: "Correct captcha is required. Click the captcha to generate a new one"
|
||||
},
|
||||
submitHandler: function() {
|
||||
alert("Correct captcha!");
|
||||
},
|
||||
success: function(label) {
|
||||
label.addClass("valid").text("Valid captcha!")
|
||||
},
|
||||
onkeyup: false
|
||||
});
|
||||
|
||||
});
|
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Echo the image - timestamp appended to prevent caching
|
||||
echo '<a href="index.php" onclick="refreshimg(); return false;" title="Click to refresh image"><img src="images/image.jpg?' . time() . '" width="132" height="46" alt="Captcha image" /></a>';
|
||||
|
||||
?>
|
@@ -1 +0,0 @@
|
||||
AddType application/x-httpd-php .jpg
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Begin the session
|
||||
session_start();
|
||||
|
||||
// If the session is not present, set the variable to an error message
|
||||
if(!isset($_SESSION['captcha_id']))
|
||||
$str = 'ERROR!';
|
||||
// Else if it is present, set the variable to the session contents
|
||||
else
|
||||
$str = $_SESSION['captcha_id'];
|
||||
|
||||
// Set the content type
|
||||
//header('Content-type: image/png');
|
||||
header('Cache-control: no-cache');
|
||||
|
||||
// Create an image from button.png
|
||||
$image = imagecreatefrompng('button.png');
|
||||
|
||||
// Set the font colour
|
||||
$colour = imagecolorallocate($image, 183, 178, 152);
|
||||
|
||||
// Set the font
|
||||
$font = '../fonts/Anorexia.ttf';
|
||||
|
||||
// Set a random integer for the rotation between -15 and 15 degrees
|
||||
$rotate = rand(-15, 15);
|
||||
|
||||
// Create an image using our original image and adding the detail
|
||||
imagettftext($image, 14, $rotate, 18, 30, $colour, $font, $str);
|
||||
|
||||
// Output the image as a png
|
||||
imagepng($image);
|
||||
|
||||
?>
|
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Make the page validate
|
||||
ini_set('session.use_trans_sid', '0');
|
||||
|
||||
// Include the random string file
|
||||
require 'rand.php';
|
||||
|
||||
// Begin the session
|
||||
session_start();
|
||||
|
||||
// Set the session contents
|
||||
$_SESSION['captcha_id'] = $str;
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<title>AJAX CAPTCHA</title>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="keywords" content="AJAX,JHR,PHP,CAPTCHA,download,PHP CAPTCHA,AJAX CAPTCHA,AJAX PHP CAPTCHA,download AJAX CAPTCHA,download AJAX PHP CAPTCHA" />
|
||||
<meta name="description" content="An AJAX CAPTCHA script, written in PHP" />
|
||||
|
||||
<script type="text/javascript" src="../../lib/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="captcha.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<style type="text/css">
|
||||
img { border: 1px solid #eee; }
|
||||
p#statusgreen { font-size: 1.2em; background-color: #fff; color: #0a0; }
|
||||
p#statusred { font-size: 1.2em; background-color: #fff; color: #a00; }
|
||||
fieldset label { display: block; }
|
||||
fieldset div#captchaimage { float: left; margin-right: 15px; }
|
||||
fieldset input#captcha { width: 25%; border: 1px solid #ddd; padding: 2px; }
|
||||
fieldset input#submit { display: block; margin: 2% 0% 0% 0%; }
|
||||
#captcha.success {
|
||||
border: 1px solid #49c24f;
|
||||
background: #bcffbf;
|
||||
}
|
||||
#captcha.error {
|
||||
border: 1px solid #c24949;
|
||||
background: #ffbcbc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1><acronym title="Asynchronous JavaScript And XML">AJAX</acronym> <acronym title="Completely Automated Public Turing test to tell Computers and Humans Apart">CAPTCHA</acronym>, based on <a href="http://psyrens.com/captcha/">http://psyrens.com/captcha/</a></h1>
|
||||
|
||||
<form id="captchaform" action="">
|
||||
<fieldset>
|
||||
<div id="captchaimage"><a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="refreshimg" title="Click to refresh image"><img src="images/image.php?<?php echo time(); ?>" width="132" height="46" alt="Captcha image" /></a></div>
|
||||
<label for="captcha">Enter the characters as seen on the image above (case insensitive):</label>
|
||||
<input type="text" maxlength="6" name="captcha" id="captcha" />
|
||||
<input type="submit" name="submit" id="submit" value="Check" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<p>If you can't decipher the text on the image, click it to dynamically generate a new one.</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Include the random string file
|
||||
require 'rand.php';
|
||||
|
||||
// Begin a new session
|
||||
session_start();
|
||||
|
||||
// Set the session contents
|
||||
$_SESSION['captcha_id'] = $str;
|
||||
|
||||
?>
|
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Begin the session
|
||||
session_start();
|
||||
|
||||
// To avoid case conflicts, make the input uppercase and check against the session value
|
||||
// If it's correct, echo '1' as a string
|
||||
if(strtoupper($_GET['captcha']) == $_SESSION['captcha_id'])
|
||||
echo 'true';
|
||||
// Else echo '0' as a string
|
||||
else
|
||||
echo 'false';
|
||||
|
||||
?>
|
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Create a random string, leaving out 'o' to avoid confusion with '0'
|
||||
$char = strtoupper(substr(str_shuffle('abcdefghjkmnpqrstuvwxyz'), 0, 4));
|
||||
|
||||
// Concatenate the random string onto the random numbers
|
||||
// The font 'Anorexia' doesn't have a character for '8', so the numbers will only go up to 7
|
||||
// '0' is left out to avoid confusion with 'O'
|
||||
$str = rand(1, 7) . rand(1, 7) . $char;
|
||||
|
||||
?>
|
@@ -1,140 +0,0 @@
|
||||
body {
|
||||
margin: 3% 5%;
|
||||
padding: 0;
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font: 0.9em/1.3 Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:hover, a:focus, a:active {
|
||||
background-color: #ffb;
|
||||
color: #454545;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 2% 0%;
|
||||
padding: 1%;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
color: #666;
|
||||
font: normal 1.5em Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 2% 0%;
|
||||
padding: 1%;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
color: #666;
|
||||
font: normal 1.3em Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 2% 0%;
|
||||
padding: 1%;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
color: #666;
|
||||
font: normal 1.2em Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table th {
|
||||
border: 1px solid #ddd;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
padding: 1%;
|
||||
}
|
||||
|
||||
table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 1%;
|
||||
}
|
||||
|
||||
dl, dt, dd {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #ddd;
|
||||
margin: 0% 0% 2% 0%;
|
||||
padding: 2%;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
margin: 0;
|
||||
padding: 0 4px;
|
||||
background-color: inherit;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
code {
|
||||
font: 1em "Courier New", Courier, Monospace;
|
||||
}
|
||||
|
||||
pre code {
|
||||
font: 1.1em "Courier New", Courier, Monospace;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
p#statusgreen {
|
||||
font-size: 1.2em;
|
||||
background-color: #fff;
|
||||
color: #0a0;
|
||||
}
|
||||
|
||||
p#statusred {
|
||||
font-size: 1.2em;
|
||||
background-color: #fff;
|
||||
color: #a00;
|
||||
}
|
||||
|
||||
fieldset label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
fieldset label.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
fieldset label.valid {
|
||||
color: green;
|
||||
}
|
||||
|
||||
fieldset div#captchaimage {
|
||||
float: left;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
fieldset input#captcha {
|
||||
width: 25%;
|
||||
border: 1px solid #ddd;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
fieldset input#submit {
|
||||
display: block;
|
||||
margin: 2% 0% 0% 0%;
|
||||
}
|
Reference in New Issue
Block a user