[tipos commit] r1610 - trunk/Tipos/Captcha

0 views
Skip to first unread message

codesite...@google.com

unread,
Oct 8, 2008, 4:37:34 PM10/8/08
to tipo...@googlegroups.com
Author: rodrigo.moraes
Date: Wed Oct 8 13:37:22 2008
New Revision: 1610

Modified:
trunk/Tipos/Captcha/Image.php

Log:
Small improvement|: try to delete the image file every time a session flash
is get, and not only when the captcha is valid.

Modified: trunk/Tipos/Captcha/Image.php
==============================================================================
--- trunk/Tipos/Captcha/Image.php (original)
+++ trunk/Tipos/Captcha/Image.php Wed Oct 8 13:37:22 2008
@@ -121,20 +121,20 @@
settype($key, 'string');
list($solution, $file) = explode(':', $key . ':');

+ // sanitize file name and try to delete file
+ $file = preg_replace('/[^a-z0-9]/i', '', $file);
+ $path = $this->_config['save_path'] . $file . '.jpg';
+ if (file_exists($path)) {
+ unlink($path);
+ }
+
// hash the attempted value
$hash = hash($this->_config['hash_algo'],
$this->_config['salt'] . $value);

// valid solution?
if ($solution == $hash) {
- // valid: sanitize file name and delete file
- $file = preg_replace('/[^a-z0-9]/i', '', $file);
- $path = $this->_config['save_path'] . $file . '.jpg';
- if (file_exists($path)) {
- unlink($path);
- }
-
- // done
+ // yes, it is valid
return true;
}
}

Reply all
Reply to author
Forward
0 new messages