mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +03:00
captcha: check if gdlib is installed
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@620 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
04a584ffab
commit
4b33346dab
@ -24,6 +24,7 @@ require_once('libs/chat.php');
|
|||||||
require_once('libs/operator.php');
|
require_once('libs/operator.php');
|
||||||
require_once('libs/groups.php');
|
require_once('libs/groups.php');
|
||||||
require_once('libs/expand.php');
|
require_once('libs/expand.php');
|
||||||
|
require_once('libs/captcha.php');
|
||||||
|
|
||||||
loadsettings();
|
loadsettings();
|
||||||
if($settings['enablessl'] == "1" && $settings['forcessl'] == "1") {
|
if($settings['enablessl'] == "1" && $settings['forcessl'] == "1") {
|
||||||
@ -66,7 +67,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
|||||||
setup_logo();
|
setup_logo();
|
||||||
$page['formname'] = topage(getgetparam('name'));
|
$page['formname'] = topage(getgetparam('name'));
|
||||||
$page['formemail'] = topage($email);
|
$page['formemail'] = topage($email);
|
||||||
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" ? "1" : "";
|
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" && can_show_captcha() ? "1" : "";
|
||||||
$page['info'] = topage($info);
|
$page['info'] = topage($info);
|
||||||
expand("styles", getchatstyle(), "leavemessage.tpl");
|
expand("styles", getchatstyle(), "leavemessage.tpl");
|
||||||
exit;
|
exit;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
require_once('libs/common.php');
|
require_once('libs/common.php');
|
||||||
require_once('libs/chat.php');
|
require_once('libs/chat.php');
|
||||||
require_once('libs/expand.php');
|
require_once('libs/expand.php');
|
||||||
|
require_once('libs/captcha.php');
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$page = array();
|
$page = array();
|
||||||
@ -62,7 +63,7 @@ if( !$email ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadsettings();
|
loadsettings();
|
||||||
if($settings["enablecaptcha"] == "1") {
|
if($settings["enablecaptcha"] == "1" && can_show_captcha()) {
|
||||||
$captcha = getparam('captcha');
|
$captcha = getparam('captcha');
|
||||||
$original = $_SESSION['captcha'];
|
$original = $_SESSION['captcha'];
|
||||||
if(empty($original) || empty($captcha) || $captcha != $original) {
|
if(empty($original) || empty($captcha) || $captcha != $original) {
|
||||||
@ -75,7 +76,7 @@ if( count($errors) > 0 ) {
|
|||||||
$page['formname'] = topage($visitor_name);
|
$page['formname'] = topage($visitor_name);
|
||||||
$page['formemail'] = $email;
|
$page['formemail'] = $email;
|
||||||
$page['formmessage'] = topage($message);
|
$page['formmessage'] = topage($message);
|
||||||
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" ? "1" : "";
|
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" && can_show_captcha() ? "1" : "";
|
||||||
$page['info'] = topage($info);
|
$page['info'] = topage($info);
|
||||||
setup_logo();
|
setup_logo();
|
||||||
expand("styles", getchatstyle(), "leavemessage.tpl");
|
expand("styles", getchatstyle(), "leavemessage.tpl");
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
Copyright 2006 WebCheatSheet.com
|
Copyright 2006 WebCheatSheet.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function can_show_captcha() {
|
||||||
|
return extension_loaded("gd");
|
||||||
|
}
|
||||||
|
|
||||||
function gen_captcha() {
|
function gen_captcha() {
|
||||||
$md5_hash = md5(rand(0,9999));
|
$md5_hash = md5(rand(0,9999));
|
||||||
return substr($md5_hash, 15, 5);
|
return substr($md5_hash, 15, 5);
|
||||||
|
Loading…
Reference in New Issue
Block a user