Skip to content

Commit

Permalink
Merge pull request #5 from paintballrefjosh/4.0.1
Browse files Browse the repository at this point in the history
4.0.1
  • Loading branch information
paintballrefjosh authored Jan 22, 2017
2 parents 10b8642 + 3c1d4ee commit a95eb8e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 33 deletions.
4 changes: 3 additions & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
$account_key_retain_length = 31536000;
$require_act_activation = 0;
$reg_invite = 0;
$reg_act_imgvar = 1;
$reg_use_recaptcha = 1;
$reg_recaptcha_private_key = '';
$reg_recaptcha_public_key = '';
$reg_secret_questions = 1;
$allow_user_passchange = 1;
$allow_user_emailchange = 1;
Expand Down
15 changes: 3 additions & 12 deletions inc/account/account.register.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,15 @@ function Register()

// Ext 1 - Image verification
// We need to see if its enabled, and if the user put in the right code
if($Config->get('reg_act_imgvar') == 1)
if($Config->get('reg_use_recpatcha') == 1)
{
$image_key =& $_POST['image_key'];
$filename = $DB->real_escape_string($_POST['filename_image']);
$correctkey = $DB->selectCell("SELECT `key` FROM `mw_acc_creation_captcha` WHERE `filename` ='".$filename."'");
$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$Config->get('reg_recaptcha_private_key')."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']), true);

// Check for key match
if(strtolower($correctkey) != strtolower($image_key) || $image_key == '')
if($response['success'] != true)
{
$notreturn = TRUE;
$err_array[] = $lang['image_var_incorrect'];
}
else # keys match
{
// Delete the key from the DB, and delete the image from the cache folder
$DB->query("DELETE FROM `mw_acc_creation_captcha` WHERE filename='".$filename."'");
@unlink($filename);
}
}

// Ext 2 - secret questions
Expand Down
4 changes: 2 additions & 2 deletions inc/admin/template_files/admin.siteconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@

<div class="field">
<label for="Site reg_invite">Registration captcha: </label>
<select id="type" class="small" name="cfg__reg_act_imgvar">
<select id="type" class="small" name="cfg__reg_use_recaptcha">
<?php
if($Config->get('reg_act_imgvar') == 1)
if($Config->get('reg_use_recaptcha') == 1)
{ $e_ariv = 'selected="selected"'; $e_ariv2 = ''; }else{ $e_ariv2 = 'selected="selected"'; $e_ariv = ''; }
?>
<option value="1" <?php echo $e_ariv; ?>>Enabled</option>
Expand Down
22 changes: 5 additions & 17 deletions templates/blizzlike/account/account.register.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,13 @@
</select><br /><br />

<?php
if ((int)$Config->get('reg_act_imgvar') == 1)
{
// Initialize random image:
$captcha = new Captcha;
$captcha->load_ttf();
$captcha->make_captcha();
$captcha->delold();
$filename = $captcha->filename;
$privkey = $captcha->privkey;
$DB->query("INSERT INTO `mw_acc_creation_captcha`(`filename`, `key`) VALUES('$filename','$privkey')");
if ((int)$Config->get('reg_use_recaptcha') == 1)
{
?>
<img src="<?php echo $filename; ?>" alt=""/><br />
<input type="hidden" name="filename_image" value="<?php echo $filename; ?>"/>
<b>Type letters above (6 characters)</b>
<br />
<input type="text" name="image_key"/><br />
<div class="g-recaptcha" data-sitekey="<?php echo $Config->get('reg_recaptcha_public_key');?>"></div>
<?php
} ?>

}
?>
<br />
<center>
<input type='image' class="button" src='<?php echo $Template['path']; ?>/images/buttons/createaccount-button2.gif' />
Expand Down
3 changes: 2 additions & 1 deletion templates/blizzlike/body_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<script src="<?php echo $Template['path']; ?>/js/detection.js" type="text/javascript"></script>
<script src="<?php echo $Template['path']; ?>/js/functions.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $Template['script_path']; ?>/js/global.js"></script>
<script type="text/javascript" src="<?php echo $Template['script_path']; ?>/js/compressed/prototype.js"></script>
<script type="text/javascript" src="<?php echo $Template['script_path']; ?>/js/compressed/controls.js"></script>
<script type="text/javascript" src="<?php echo $Template['script_path']; ?>/js/compressed/behaviour.js"></script>
<script type="text/javascript" src="<?php echo $Template['script_path']; ?>/js/core.js"></script>
<script type="text/javascript"><!--
Expand All @@ -44,6 +44,7 @@ function loadPage(list) {
location.href=list.options[list.selectedIndex].value
}
--></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<!-- Top Navbar Start -->
Expand Down

0 comments on commit a95eb8e

Please sign in to comment.