Durukan Bal Posted March 7, 2021 Share Posted March 7, 2021 Hello, The button on the template for email verification is spammed by customers. We wrote a code to prevent spamming , The session on php smart is constantly being reset, the code is below. Can you help with this? Best Regards. {if $showEmailVerificationBanner} <div class="email-verification"> <div class="container"> <div class="row"> <div class="col-xs-2 col-xs-push-10 col-sm-1 col-sm-push-11"> <!-- <button id="btnEmailVerificationClose" type="button" class="btn close" data-uri="{routePath('dismiss-email-verification')}"><span aria-hidden="true">×</span></button> --> </div> <div class="col-xs-10 col-xs-pull-2 col-sm-7 col-sm-pull-1 col-md-8"> <i class="fas fa-exclamation-triangle"></i> <span class="text">{$LANG.verifyEmailAddress}</span> </div> <div class="col-xs-12 col-sm-4 col-md-3 col-sm-pull-1"> {if isset($_SESSION['CheckVerificationEmail223']) } <!-- test duru --> {else} <!-- test duru2 --> {$_SESSION['CheckVerificationEmail223']="7"} {/if} {if $_SESSION['CheckVerificationEmail223'] eq "1"} {$_SESSION['CheckVerificationEmail223']="2"} <button id="btnResendVerificationEmail" class="btn btn-default btn-sm btn-block btn-resend-verify-email" data-email-sent="{$LANG.emailSent}" data-error-msg="{$LANG.error}" data-uri="{routePath('user-email-verification-resend')}"> <span class="loader hidden"><i class="fa fa-spinner fa-spin"></i></span> {$LANG.resendEmail} </button> {elseif $_SESSION['CheckVerificationEmail223'] neq "2"} {$_SESSION['CheckVerificationEmail223']="1"} {/if} </div> </div> </div> </div> {/if} 0 Quote Link to comment Share on other sites More sharing options...
Durukan Bal Posted March 17, 2021 Author Share Posted March 17, 2021 solved :) /includes/hooks/ReSendVerificationEmailNoSpam.php <?php /** * Limit Access For Unverified Accounts * * * @package WHMCS ActionHook * @author Sentq <sales@whmcms.com> * @copyright Copyright (c) Sentq 2011-2016 * @link http://www.whmcms.com/ */ if (!defined("WHMCS")) die("This file cannot be accessed directly"); use WHMCS\Database\Capsule; add_hook('ClientAreaPage', 1, function($vars) { $UserID = $_SESSION['uid']; $ClientExtentTempVeriables = array(); $OverDueHour=1; $UserInfo = Capsule::table("tblclients")->where("id",$UserID)->get(); foreach ( $UserInfo as $data ) { $UserEmailVerifidInfo = Capsule::table("tblusers")->where("email",$data->email)->get(); foreach ( $UserEmailVerifidInfo as $data ) { if ( $data->email_verified_at == NULL ) { $ClientExtentTempVeriables['CheckVerificationEmailShowStatus'] = true; if ( $data->email_verification_token_expiry == NULL ) { $ClientExtentTempVeriables['CheckVerificationEmailStatus'] = true; } else if ( $data->email_verification_token_expiry < date ( "Y-m-d H:m:s", strtotime ( "-$OverDueHour hours" ) ) ) { $ClientExtentTempVeriables['CheckVerificationEmailStatus'] = true; } else { $ClientExtentTempVeriables['CheckVerificationEmailStatus'] = false; } } else { $ClientExtentTempVeriables['CheckVerificationEmailShowStatus'] = false; $ClientExtentTempVeriables['CheckVerificationEmailStatus'] = false; } } } return $ClientExtentTempVeriables; }); /templates/(TempletsName)/includes/verifyemail.tpl {if $CheckVerificationEmailShowStatus} {* if $showEmailVerificationBanner *} <div class="email-verification"> <div class="container"> <div class="row"> <div class="col-xs-2 col-xs-push-10 col-sm-1 col-sm-push-11"> </div> <div class="col-xs-10 col-xs-pull-2 col-sm-7 col-sm-pull-1 col-md-8"> <i class="fas fa-exclamation-triangle"></i> <span class="text">{$LANG.verifyEmailAddress} </span> </div> <div class="col-xs-12 col-sm-4 col-md-3 col-sm-pull-1"> {if $CheckVerificationEmailStatus} <button id="btnResendVerificationEmail" class="btn btn-default btn-sm btn-block btn-resend-verify-email" data-email-sent="{$LANG.emailSent}" data-error-msg="{$LANG.error}" data-uri="{routePath('user-email-verification-resend')}"> <span class="loader hidden"><i class="fa fa-spinner fa-spin"></i></span> {$LANG.resendEmail} </button> {/if} </div> </div> </div> </div> {/if} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.