-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe_module.php
More file actions
95 lines (72 loc) · 2.38 KB
/
Copy pathe_module.php
File metadata and controls
95 lines (72 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* [ RECAPTCHA PLUGIN FOR 0.7.25+ version] [ © JIMAKO FROM e107sk.com]
*
*
*/
global $pref, $override;
if (!isset($pref['plug_installed']['recaptcha']))
{
return ;
}
$recaptchaActive = $pref['recaptcha_active'];
$signup_imagecode = $pref['signcode'];
$use_imagecode = $pref['logcode'];
if($recaptchaActive)
{
/* do it old good way */
@include_once e_PLUGIN."recaptcha/languages/".e_LANGUAGE.".php";
@include_once e_PLUGIN."recaptcha/languages/English.php";
if($_POST) {
// not load everywhere
// contact page
if (e_PAGE=="contact.php" || (e_PAGE == "SP_ContactUs.php") ||
(e_PAGE == "form.php") ||
(e_PAGE=="signup.php" && $signup_imagecode) ||
(e_PAGE=="login.php" && $use_imagecode) ||
(e_PAGE=="admin.php" && $use_imagecode && !ADMIN)
)
{
require_once e_PLUGIN.'recaptcha/inc/autoload.php';
//require_once e_PLUGIN.'recaptcha/inc/recaptchalib.php';
// your secret key
$secret = $pref['recaptcha_secretkey'];
// empty response
$response = null;
// check secret key
//$reCaptcha = new ReCaptcha($secret);
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
// if submitted check response
if ($_POST["g-recaptcha-response"]) {
$response = $recaptcha->setExpectedHostname($_SERVER["SERVER_NAME"])
->verify($_POST["g-recaptcha-response"], $_SERVER["SERVER_NAME"]);
/* $response = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
); */
}
if ($response->isSuccess()) {
$del_time = time()+1300; //original 1200
$code = substr($_POST["g-recaptcha-response"],0,19);
// fix for 1.0.4
$code = preg_replace("/[^0-9\.]/", "", $code);
$sql->db_Insert("tmp", "'{$code}',{$del_time},'{$code}'");
$_POST['rand_num']= $code;
$_POST['code_verify']= $code;
$_POST['codeverify']= $code;
// return true;
} else {
$_POST['rand_num']= 'rand_num';
$_POST['code_verify']= 'code_verify';
$_POST['codeverify']= 'codeverify';
//return false;
}
}
}
}