X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Flibs%2Fptitcaptcha.php;fp=mw%2Flibs%2Fptitcaptcha.php;h=0262931d3f6b682be35b606f18750ea62053d5f1;hb=36ed114046cbe3d72a3589230e9f306a54fcc79d;hp=0000000000000000000000000000000000000000;hpb=281c96e95451269f2614684b8de5be25862c8374;p=mtweb
diff --git a/mw/libs/ptitcaptcha.php b/mw/libs/ptitcaptcha.php
new file mode 100644
index 0000000..0262931
--- /dev/null
+++ b/mw/libs/ptitcaptcha.php
@@ -0,0 +1,127 @@
+\n";
+ }
+
+ /**
+ * Generate hidden tag (must be in a form)
+ *
+ * @return input hidden tag
+ */
+ static function generateHiddenTags()
+ {
+ return "";
+ }
+
+ /**
+ * Generate input tag (must be in a form)
+ *
+ * @return input tag
+ */
+ static function generateInputTags()
+ {
+ return "";
+ }
+
+ /**
+ * Check if user input is correct
+ *
+ * @return boolean (true=correct, false=incorrect)
+ */
+ static function checkCaptcha()
+ {
+ if( isset($_POST['ptitcaptcha_entry']) &&
+ $_POST['ptitcaptcha_entry'] == PtitCaptchaHelper::_getDisplayText($_POST['ptitcaptcha_key']))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Internal function
+ *
+ * @param string $pck
+ * @return string
+ */
+ static function _getDisplayText($pck) // internal function
+ {
+ $src=md5(PTITCAPTCHA_ENTROPY.$pck);
+ $txt="";
+ for($i=0;$i
\ No newline at end of file