public function service() { $validateData = $this->validateData(); if ($validateData) { list($hash, $email, $phone, $will_vote, $will_be_in_arm, $is_death, $ip_address, $country, $browser, $version, $os) = $validateData; $rows = VoterDataManager::getInstance()->selectAdvance('*', ['ip_address', '=', "'{$ip_address}'"], ['datetime'], 'DESC'); if (!empty($rows) && count($rows) > 5) { $this->addParam('status', 'error'); $supportPhoneNumber = $this->getSetting('support_phone_number'); require_once NGS()->getClassesDir('ngs') . "/lib/captcha/simple-php-captcha.php"; list($code, $base64Png) = generateCaptcha(); $_SESSION['captcha_code'] = $code; $this->addParam('captcha', 'data:image/png;base64,' . $base64Png); $this->addParam('message', 'Sorry, you tried to vote for many peaple, please call us on ' . $supportPhoneNumber, ' for support.'); return; } $voter = VoterManager::getInstance()->getByHash($hash); if (isset($voter)) { $this->addParam('hash', $hash); VoterDataManager::getInstance()->addRow($voter->getId(), $email, $phone, $will_vote, $will_be_in_arm, $is_death, $ip_address, $country, $browser, $version, $os); /* if (!empty($email)) { $mailgunManager = MailgunEmailSenderManager::getInstance(); $mailgunManager->sendSingleHtmlEmail('*****@*****.**', 'Hi!!!', $this->getEmailHtml(), '*****@*****.**', 'Հանրաքվե'); } */ } } }
public function service() { $phoneNumber = NGS()->args()->getPhoneNumber(); $captchaCode = NGS()->args()->getCaptchaCode(); if (!preg_match('/^\\+?\\d+$/', $phoneNumber) || !isset($_SESSION['captcha_code']) || $captchaCode !== $_SESSION['captcha_code']) { if (!isset($_SESSION['captcha_code']) || $captchaCode !== $_SESSION['captcha_code']) { $this->addParam('message', $this->getPhrase(58)); } else { if (!preg_match('/^\\+?\\d+$/', $phoneNumber)) { $this->addParam('message', $this->getPhrase(59)); } } require_once NGS()->getClassesDir('ngs') . "/lib/captcha/simple-php-captcha.php"; list($code, $base64Png) = generateCaptcha(); $_SESSION['captcha_code'] = $code; $this->addParam('captcha', 'data:image/png;base64,' . $base64Png); $this->addParam('status', 'error'); return; } $rows = VoterDataManager::getInstance()->selectByField('ip_address', $_SERVER['REMOTE_ADDR']); if (!empty($rows)) { VoterDataManager::getInstance()->updateField($rows[0]->getId(), 'ip_address', $rows[0]->getIpAddress() . '_'); } EmergencyPhoneNumberManager::getInstance()->addRow($phoneNumber); }
function login() { $login = $_POST['login']; $pass = $_POST['pass']; if (checkInputEmpty($login, $pass)) { if ($result = issetLogin($login)) { if (loginActions($pass, $result)) { $_SESSION['usuario_logueado'] = true; $GLOBALS['log_user'] = true; unset($_COOKIE['access_error']); setcookie("access_error", null, -1); } else { setcookie("access_error", $_COOKIE['access_error'] + 1, 0); generateCaptcha(); $GLOBALS['log_user'] = false; } } else { setcookie("access_error", $_COOKIE['access_error'] + 1, 0); generateCaptcha(); $GLOBALS['log_user'] = false; } } }
<td><input type="text" id="phone" name="phone" size="50" value="<?php echo html_encode($mailcontent['phone']); ?> "<?php if ($_processing_post) { echo ' disabled="disabled"'; } ?> /></td> </tr> <?php } ?> <?php if (getOption("contactform_captcha") && !$_processing_post) { $captchaCode = generateCaptcha($img); ?> <tr> <td> <?php echo gettext("Enter CAPTCHA<strong>*</strong>:"); ?> <img src=<?php echo "\"{$img}\""; ?> alt="Code" align="middle" /> </td> <td><input type="text" id="code" name="code" size="50" /> <input type="hidden" name="code_h" value="<?php echo $captchaCode; ?>
header("Location: login.php"); exit; } //Prevent the user visiting the logged in page if he/she is already logged in if (isUserLoggedIn()) { addAlert("danger", "I'm sorry, you cannot register for an account while logged in. Please log out first."); apiReturnError(false, SITE_ROOT); } ?> <!DOCTYPE html> <html lang="en"> <?php echo renderTemplate("head.html", array("#SITE_ROOT#" => SITE_ROOT, "#SITE_TITLE#" => SITE_TITLE, "#PAGE_TITLE#" => "Register")); $fields = ['user_name' => ['type' => 'text', 'label' => 'Username', 'icon' => 'fa fa-fw fa-edit', 'validator' => ['minLength' => 1, 'maxLength' => 25, 'label' => 'Username'], 'placeholder' => 'User name'], 'display_name' => ['type' => 'text', 'label' => 'Display Name', 'icon' => 'fa fa-fw fa-edit', 'validator' => ['minLength' => 1, 'maxLength' => 50, 'label' => 'Display name'], 'placeholder' => 'Display name'], 'email' => ['type' => 'text', 'label' => 'Email', 'icon' => 'fa fa-fw fa-envelope', 'validator' => ['minLength' => 1, 'maxLength' => 150, 'email' => true, 'label' => 'Email'], 'placeholder' => 'Email address'], 'password' => ['type' => 'password', 'label' => 'Password', 'icon' => 'fa fa-fw fa-key', 'validator' => ['minLength' => 8, 'maxLength' => 50, 'label' => 'Password', 'passwordMatch' => 'passwordc'], 'placeholder' => '8-50 characters'], 'passwordc' => ['type' => 'password', 'label' => 'Confirm password', 'icon' => 'fa fa-fw fa-key', 'validator' => ['minLength' => 8, 'maxLength' => 50, 'label' => 'Password'], 'placeholder' => 'Re-enter your password'], 'captcha' => ['type' => 'text', 'label' => 'Confirm Security Code', 'icon' => 'fa fa-fw fa-eye', 'validator' => ['minLength' => 1, 'maxLength' => 50, 'label' => 'Security code'], 'placeholder' => "Enter the code below, human!"]]; $captcha = generateCaptcha(); $template = "\n <form name='newUser' class='form-horizontal' id='newUser' role='form' action='api/create_user.php' method='post'>\n\t\t <div class='row'>\n\t\t\t<div id='display-alerts' class='col-lg-12'>\n\t\t \n\t\t\t</div>\n\t\t </div>\t\t\n\t\t <div class='row'>\n\t\t\t<div class='col-sm-12'>\n {{user_name}}\n </div>\n\t\t </div>\n\t\t <div class='row'>\n <div class='col-sm-12'>\n {{display_name}}\n </div>\n\t\t </div>\n\t\t <div class='row'>\n\t\t\t<div class='col-sm-12'>\n {{email}}\n </div>\n\t\t </div>\t\t \n\t\t <div class='row'>\n <div class='col-sm-12'>\n {{password}}\n </div>\n\t\t </div>\n\t\t <div class='row'>\n <div class='col-sm-12'>\n {{passwordc}}\n </div>\n\t\t </div>\n\t\t <div class='row'>\n <div class='col-sm-12'>\n {{captcha}}\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-12'>\n <img src='{$captcha}' id='captcha'>\n </div>\n\t\t </div>\n\t\t <br>\n\t\t <div class='form-group'>\n\t\t\t<div class='col-sm-12'>\n\t\t\t <button type='submit' class='btn btn-success submit' value='Register'>Register</button>\n\t\t\t</div>\n\t\t </div>\n <div class='collapse'>\n <label>Spiderbro: Don't change me bro, I'm tryin'a catch some flies!</label>\n <input name='spiderbro' id='spiderbro' value='http://'/>\n </div> \n\t\t</form>"; $fb = new FormBuilder($template, $fields, [], [], true); ?> <body> <div class="container"> <div class="header"> <ul class="nav nav-pills navbar pull-right"> </ul> <h3 class="text-muted">UserFrosting</h3> </div> <div class="jumbotron"> <h1>Let's get started!</h1> <p class="lead">Registration is fast and simple.</p> <?php
<p class="name-help">Please enter your character name.</p> </div> <input class="name2" id="lname" type="text" name="lname" placeholder="Second name of character"> <div> <p class="name-help2">If your character doesn't have a second name, please enter a blank space in this field (a second name is mandatory for Slack, but a space is enough).</p> </div> <input type="text" id="email" name="email" placeholder="E-mail" class="email"> <div> <p class="email-help">Please enter your current email address.</p> </div> <input type="text" id="captcha" name="captcha" placeholder="Captcha (please type the below code here)"> <div> <p class="captcha-help">Please enter the captcha text below.</p> </div> <?php $fname = generateCaptcha($cap); display($fname); ?> <input type="hidden" name="attempt" value="true"> <input type="submit" value="Register"> </form> <p class="optimize"> <a href="https://spectrefleet.slack.com/messages/general/"><img src="/img/layout/spectre_fleet_slack.png"></a> </p> </div> <script src="/lib/jquery/jquery-2.1.4.min.js" type="text/javascript"></script> <script> $(document).ready(function() { $('#register').submit(function() { var $form = $(this); var $inputs = $form.find("input, select, button, textarea");
<?php /* UserFrosting Version: 0.2.2 By Alex Weissman Copyright (c) 2014 Based on the UserCake user management system, v2.0.2. Copyright (c) 2009-2012 UserFrosting, like UserCake, is 100% free and open-source. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ require_once "../models/config.php"; echo generateCaptcha();
function render_captcha($method, &$request, &$template) { // Render a captcha image and store the hash. See register.tpl. $hash = generateCaptcha(PHP_SERVER_PATH . "/src/fonts/FreeSans.ttf", 6); // Put the captcha hash into the session so it can be checked. $_SESSION['hash'] = $hash; }