function faucet_get_captcha($SETTINGS) { if ($SETTINGS->get("use_captcha")) { //Settings to pass to captcha functions $captcha_config = array(); //Load Captcha HTML if ($SETTINGS->get("captcha") == "simple-captcha") { //Load simple captcha library $simplecaptcha = './libraries/simple-captcha/simple-php-captcha.php'; require_once $simplecaptcha; $captcha_config['session_name'] = $SETTINGS->config["captcha_config"]["simple_captcha_session_name"]; @session_name($captcha_config['session_name']); @session_start(); $_SESSION['captcha'] = simple_php_captcha($captcha_config); // set a new CAPTCHA return isset($_SESSION['captcha']) ? '<img src="' . $simplecaptcha . $_SESSION['captcha']["image_request"] . '" alt="[captcha]"/>' : ''; } elseif ($SETTINGS->get("captcha") == "solvemedia") { //Load solvemedia library require_once './libraries/solvemedialib.php'; $captcha_config['solvemedia_challenge_key'] = $SETTINGS->config["captcha_config"]["solvemedia_challenge_key"]; return solvemedia_get_html($captcha_config["solvemedia_challenge_key"]); } elseif ($SETTINGS->get("captcha") == "recaptcha") { //Load re-captcha library require_once './libraries/recaptchalib.php'; $captcha_config['recpatcha_public_key'] = $SETTINGS->config["captcha_config"]["recpatcha_public_key"]; return recaptcha_get_html($captcha_config["recpatcha_public_key"]); } } else { return ''; //Emtpy } }
/** * init library * @require */ public function init() { @session_start(); if (function_exists('simple_php_captcha')) { $_SESSION['captcha'] = simple_php_captcha($this->options); } return isset($_SESSION['captcha']) ? $_SESSION['captcha'] : ''; }
<?php session_start(); if ($_SESSION['id']) { include "ajax/simple-php-captcha.php"; $_SESSION['captcha'] = simple_php_captcha(); ?> <div class="col-md-8"> <div class="panel panel-info"> <div class="panel-heading"> <h3 class="panel-title">Panel de control</h3> </div> <div class="panel-group"> <div class="panel panel-default" style="width:90%; margin-left:5%; margin-top:5px; font-size:11px;"> <div class="panel-heading"> <h4 class="panel-title"> <button class="btn btn-warning btn-xs" style="width:200px;" data-toggle="collapse" href="#collapse1">Mover Personaje</button> </h4> </div> <div id="collapse1" class="panel-collapse collapse"> <div class="panel-body"> <div class="text">El personaje sera reinstaurado en el centro de la ciudad correspontiente a tu reino.</div> <form action="index.php?s=usercp" method="get" class="form-inline"> <div class="form-group"> <div class="text">Personajes</label> <select name="pid" id="pid" class=""> <?php $pj = new user_panel(); echo $pj->getplayers($_SESSION['id']); ?>
<textarea maxlength="5000" data-msg-required="Por favor deje su mensaje." rows="6" class="form-control" name="message" id="message" required></textarea> </div> </div> </div> <div class="row"> <div class="col-md-12"> <label>Verificación *</label> </div> </div> <div class="row"> <div class="form-group"> <div class="col-md-4"> <div class="captcha form-control"> <div class="captcha-image"> <?php $_SESSION['captcha'] = simple_php_captcha(array('min_length' => 6, 'max_length' => 6, 'min_font_size' => 22, 'max_font_size' => 22, 'angle_max' => 3)); $_SESSION['captchaCode'] = $_SESSION['captcha']['code']; echo '<img id="captcha-image" src="' . "php/simple-php-captcha/simple-php-captcha.php/" . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA code">'; ?> </div> <div class="captcha-refresh"> <a href="#" id="refreshCaptcha"><i class="fa fa-refresh"></i></a> </div> </div> </div> <div class="col-md-8"> <input type="text" value="" maxlength="6" data-msg-captcha="Error de código de verificación." data-msg-required="Introduzca una verificación válida." placeholder="Introduzca el codigo." class="form-control input-lg captcha-input" name="captcha" id="captcha" required> </div> </div> </div> <div class="row">
public function __construct($config) { if (!defined("SF_STATUS_OPERATIONAL")) { define("SF_STATUS_OPERATIONAL", 100); define("SF_STATUS_PAYOUT_ACCEPTED", 101); //define("SF_STATUS_SUCCESS",102); define("SF_STATUS_RPC_CONNECTION_FAILED", 200); define("SF_STATUS_MYSQL_CONNECTION_FAILED", 201); define("SF_STATUS_PAYOUT_DENIED", 202); define("SF_STATUS_INVALID_KITTEH_ADDRESS", 203); define("SF_STATUS_PAYOUT_ERROR", 204); define("SF_STATUS_CAPTCHA_INCORRECT", 205); define("SF_STATUS_DRY_FAUCET", 206); define("SF_STATUS_BANNED_IP;", 207); define("SF_STATUS_FAUCET_INCOMPLETE", 300); } $defaults = array("minimum_payout" => 0.01, "maximum_payout" => 10, "payout_threshold" => 250, "payout_interval" => "7h", "total_donated" => 0, "user_check" => "both", "wallet_passphrase" => "", "use_captcha" => true, "captcha" => "simple-captcha", "captcha_config" => array(), "mysql_table_prefix" => "sf_", "donation_address" => "KHi1Lf6Hi81yc61r5SKQMvkCMSF5s9JbSY", "title" => "Kitteh Faucet", "template" => "default"); $this->config = array_merge($defaults, $config); if ($this->config["user_check"] != "ip_address" && $this->config["user_check"] != "kitteh_address") { $this->config["user_check"] = "both"; } if ($this->config["captcha"] != "recaptcha" && $this->config["captcha"] != "simple-captcha") { $this->config["captcha"] = "simple-captcha"; } // TODO: add config for different CAPTCHAs instead of having it hard coded here. if ($this->config["captcha"] == "recaptcha") { require_once './lib/recaptchalib.php'; } else { $this->config["captcha_config"]["session_name"] = "dgsfauc"; require_once './lib/simple-captcha/simple-php-captcha.php'; } // --- if (isset($config["rpc_user"], $config["rpc_password"], $config["rpc_host"], $config["rpc_port"], $config["mysql_user"], $config["mysql_password"], $config["mysql_host"], $config["mysql_database"])) { if (class_exists("jsonRPCClient")) { $this->rpc_client = new jsonRPCClient('http://' . urlencode($config["rpc_user"]) . ':' . urlencode($config["rpc_password"]) . '@' . urlencode($config["rpc_host"]) . ':' . urlencode($config["rpc_port"])); $this->db = @new mysqli($config["mysql_host"], $config["mysql_user"], $config["mysql_password"], $config["mysql_database"]); //if (!$this->db->connect_error) if (!mysqli_connect_error() && !is_null($this->balance = $this->rpc("getbalance"))) { $this->total_donated = $this->rpc("getreceivedbyaddress", array($this->config["donation_address"])); if ($this->balance >= $this->config["payout_threshold"]) { $this->status = SF_STATUS_OPERATIONAL; if ($this->config["use_captcha"] && $this->config["captcha"] == "simple-captcha") { @session_name("dgsfauc"); @session_start(); //$_SESSION['captcha'] = simple_php_captcha($this->config["captcha_config"]); } if (isset($_POST["kittehcoin_address"]) && ($this->config["use_captcha"] && $this->valid_captcha() || !$this->config["use_captcha"])) { $kittehcoin_address = $_POST["kittehcoin_address"]; $validation = $this->rpc("validateaddress", array($kittehcoin_address)); if ($validation["isvalid"]) { $interval = "7 HOUR"; // hardcoded default interval if the custom interval is messed up $interval_value = intval(substr($this->config["payout_interval"], 0, -1)); $interval_function = strtoupper(substr($this->config["payout_interval"], -1)); if ($interval_value >= 0 && ($interval_function == "H" || $interval_function == "M" || $interval_function == "D")) { $interval = $interval_value . " "; switch ($interval_function) { case "M": $interval .= "MINUTE"; break; case "H": $interval .= "HOUR"; break; case "D": $interval .= "DAY"; break; } } $ch = curl_init("https://www.dan.me.uk/torlist/"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $text = curl_exec($ch); $test = strpos($text, $_SERVER["REMOTE_ADDR"]); if ($test == false) { $user_check = " AND ("; if ($this->config["user_check"] == "ip_address" || $this->config["user_check"] == "both") { $user_check .= " `ip_address` = '" . $this->db->escape_string($_SERVER["REMOTE_ADDR"]) . "'"; } if ($this->config["user_check"] == "kitteh_address" || $this->config["user_check"] == "both") { $user_check .= ($this->config["user_check"] == "both" ? " OR" : "") . " `payout_address` = '" . $this->db->escape_string($kittehcoin_address) . "'"; } $user_check .= ")"; $result = $this->db->query("SELECT `id` FROM `" . $this->db->escape_string($this->config["mysql_table_prefix"]) . "payouts` WHERE `timestamp` > NOW() - INTERVAL " . $interval . $user_check); if ($row = $result->fetch_assoc()) { $this->status = SF_STATUS_PAYOUT_DENIED; } else { $this->payout_amount = mt_rand($this->config["minimum_payout"] * 10000, $this->config["maximum_payout"] * 10000) / 10000; // calculate a random MEOW amount $this->db->query("INSERT INTO `" . $this->db->escape_string($this->config["mysql_table_prefix"]) . "payouts` (`payout_amount`,`ip_address`,`payout_address`,`timestamp`) VALUES ('" . $this->payout_amount . "','" . $this->db->escape_string($_SERVER["REMOTE_ADDR"]) . "','" . $this->db->escape_string($kittehcoin_address) . "',NOW())"); // insert the transaction into the payout log if ($this->config["wallet_passphrase"] != "") { $this->rpc("walletpassphrase", array($this->config["wallet_passphrase"], 4)); } // unlock wallet $this->status = !is_null($this->rpc("sendtoaddress", array($kittehcoin_address, $this->payout_amount))) ? SF_STATUS_PAYOUT_ACCEPTED : SF_STATUS_PAYOUT_ERROR; // send the MEOW if ($this->config["wallet_passphrase"] != "") { $this->rpc("walletlock"); } // lock wallet } } else { $this->status = SF_STATUS_BANNED_IP; } } else { $this->status = SF_STATUS_INVALID_KITTEH_ADDRESS; } } else { if ($this->config["use_captcha"] && $this->config["captcha"] == "simple-captcha") { $_SESSION['captcha'] = simple_php_captcha($this->config["captcha_config"]); } // set a new CAPTCHA if (isset($_POST["kittehcoin_address"])) { $this->status = SF_STATUS_CAPTCHA_INCORRECT; } } } else { $this->status = SF_STATUS_DRY_FAUCET; } } else { $this->status = SF_STATUS_MYSQL_CONNECTION_FAILED; } } else { $this->status = SF_STATUS_FAUCET_INCOMPLETE; } // missing RPC client } else { $this->status = SF_STATUS_FAUCET_INCOMPLETE; } // missing some settings }
function draw() { if (User::is_login()) { Url::redirect_url(STATIC_URL); } global $display; $this->beginForm(true, "post", false); require_once ROOT_PATH . 'includes/captcha/simple-php-captcha.php'; $_SESSION['captcha'] = simple_php_captcha(); $display->add('captcha', 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['captcha']['image_src']); $error_message = $this->getErrorMessage('dangky'); if ($error_message != '') { $display->add('user_name', trim(Url::get('user_name', ''))); } $display->add('error_message', $error_message); $display->output('Register'); $this->endForm(); }
<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true"> <div class="modal-dialog"> <button type="button" class="btn btn-default" data-dismiss="modal">X</button> <div class="modal-content"> <div class="login-head"><i class="fa fa-lock"></i> login</div> <form class="col-md-12" id="loginform" action="<?php echo base_url(); ?> users/login" method="post"> <?php include dirname(dirname(dirname(dirname(__FILE__)))) . '/captcha/simple-php-captcha.php'; //ob_start(); //session_start(); //$_SESSION = array(); $_SESSION['captcha'] = simple_php_captcha(); $captcha = array('captcha' => simple_php_captcha()); $this->session->set_userdata($captcha); $captcha_d = $this->session->userdata('captcha'); //pr($captcha_d); ?> <div class="login-left"> <div class="form-group"> <div class="form-control"> <span class="error-msg error_message" style="display: none" id="error_username">Please enter your username</span> <span class="error-msg error_message" style="display: none" id="error_login_fail"></span> <span><i class="fa fa-user"></i></span> <input type="text" id="username" name="username" class="input-lg" placeholder="Username"> </div> </div> <div class="form-group">
<?php session_start(); include "simple-php-captcha.php"; $_SESSION['captcha'] = simple_php_captcha(array('min_length' => 5, 'max_length' => 5, 'backgrounds' => array('white.png'), 'shadow_offset_x' => -1, 'shadow_offset_y' => 1)); echo $_SESSION['captcha']['image_src'];
/** * @return SimplePhpCaptcha * @throws \Exception */ public function createCaptcha() { $_SESSION[sha1(__CLASS__)] = \simple_php_captcha(); return $this; }
<div class="wrap_form"> <?php if (isset($_POST['submit1'])) { if (!empty($_POST['captchacode'])) { if (strtolower($_SESSION['captcha']['code']) == strtolower($_POST['captchacode'])) { mail($destino, $asunto, $mensaje, $cabeceras); $warning1 = '<div class="aviso2"> ' . _('Your message was sent successfully. Thanks.') . ' </div>'; } else { $warning1 = '<div class="aviso1"> ' . _('Validation errors occurred. Please confirm the fields and submit it again.') . '</div>'; } } else { $warning2 = '<div class="aviso1">' . _('Validation errors occurred. Please confirm the fields and submit it again.') . '</div>'; } } $_SESSION['captcha'] = simple_php_captcha(array('min_length' => 5, 'max_length' => 5, 'backgrounds' => array('backgrounds/white-wave_p.png'), 'min_font_size' => 21, 'max_font_size' => 21, 'color' => '#dadada', 'angle_min' => 0, 'angle_max' => 5, 'shadow' => false, 'shadow_color' => '#fff', 'shadow_offset_x' => 0, 'shadow_offset_y' => 0)); ?> <form class="all_form" method="post" action="index.php" autocomplete="off"> <div class="contacto_titulo"> <?php echo _('CONTACT FORM'); ?> </div> <div class="group_form three"> <label>Nombre:</label> <input name="nombre" type="text" placeholder='<?php echo _('Name'); ?> ' class="reset_form style_textinput"/>
<?php include "simple-php-captcha.php"; if (isset($_GET["action"])) { switch ($_GET["action"]) { case "get_captcha": $captcha = array(); $captcha = simple_php_captcha(); break; } } exit(json_encode($captcha));