Exemplo n.º 1
0
 public function login($username = null, $password = null, $captcha = null)
 {
     if (IS_POST) {
         if (!check_captcha($captcha)) {
             $this->error('验证码输入错误!');
         }
         $user = D('User')->login($username, $password);
         if ($user['id']) {
             $this->success('登录成功!', U('Index/index'));
         } else {
             $this->error('用户名或密码错误');
         }
     } else {
         if (is_login()) {
             $this->redirect('Index/index');
         } else {
             /* 读取数据库中的配置 */
             // $config  =   S('DB_CONFIG_DATA');
             // if(!$config){
             //     $config  =   D('Config')->lists();
             //     S('DB_CONFIG_DATA',$config);
             // }
             // C($config); //添加配置
             $this->display();
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
  *
  * @return tempcode  The snippet
  */
 function run()
 {
     $val = get_param('name');
     require_code('captcha');
     if (check_captcha($val)) {
         return new ocp_tempcode();
     }
     return make_string_tempcode(str_replace(array('‘', '’', '“', '”'), array('"', '"', '"', '"'), html_entity_decode(do_lang('INVALID_SECURITY_CODE_ENTERED'), ENT_QUOTES)));
 }
Exemplo n.º 3
0
 if (empty($email)) {
     $errors['email'] = _T("site_contact_err_email_blank");
 } elseif (!check_email_address($email)) {
     $errors['email'] = _T("site_contact_err_email_invalid");
 }
 // check for the email comment
 if (empty($comment)) {
     $errors['comment'] = _T("site_contact_err_comment_blank");
 }
 // Set the captcha Error Messages (check_captcha())
 define('ERROR_MESSAGE_CAPTCHA', _T("site_contact_err_captcha_blank"));
 define('ERROR_MESSAGE_CAPTCHA_INVALID', _T("site_contact_err_captcha_invalid"));
 define('ERROR_MESSAGE_CAPTCHA_COOKIE', _T("site_contact_err_captcha_cookie"));
 // check for captcha errors
 require CFLIBPATH . 'captcha.class.php';
 check_captcha($_POST['captcha'], false);
 if (isset($error_captcha)) {
     $errors['captcha'] = $error_captcha;
 }
 // if no errors send email
 if (!is_errors()) {
     if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
         $ent = "\r\n";
     } elseif (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) {
         $ent = "\r";
     } else {
         $ent = "\n";
     }
     $comment = ' Name: ' . $name . $ent . ' E-mail: ' . $email . $ent . ' Comment: ' . $ent . $comment;
     $boundary = '----=_NextPart_' . md5(rand());
     $headers = 'From: ' . $name . '<' . $email . '>' . $ent;
Exemplo n.º 4
0
 function register()
 {
     $this->data['cap_img'] = make_captcha();
     $this->data['title'] = "Register User";
     if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin()) {
         //redirect('user/auth', 'refresh');
     }
     if ($this->ion_auth->logged_in()) {
         redirect('user/profile', 'refresh');
     }
     //validate form input
     $this->form_validation->set_rules('username', $this->lang->line('create_user_validation_name_label'), 'required|xss_clean');
     $this->form_validation->set_rules('first_name', "Nama Lengkap", 'required|xss_clean');
     $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email');
     $this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'required|xss_clean');
     $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
     $this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required');
     $this->form_validation->set_rules('tempat_lahir', 'Tempat Lahir', 'required|xss_clean');
     $this->form_validation->set_rules('tanggal_lahir', 'Tanggal Lahir', 'required|xss_clean');
     $this->form_validation->set_rules('tanda_pengenal', 'Tanda pengenal', 'required|xss_clean');
     $this->form_validation->set_rules('pekerjaan_select', 'Pekerjaan Select', 'xss_clean');
     $this->form_validation->set_rules('pekerjaan', 'Pekerjaan', 'xss_clean');
     $this->form_validation->set_rules('kabupaten_kota', $this->lang->line('create_user_validation_lname_label'), 'xss_clean');
     $this->form_validation->set_rules('propinsi', $this->lang->line('create_user_validation_lname_label'), 'xss_clean');
     $this->form_validation->set_rules('kode_pos', $this->lang->line('create_user_validation_lname_label'), 'xss_clean');
     // pre(check_captcha());
     if (check_captcha() && $this->form_validation->run() == true) {
         // echo "in";exit;
         $username = strtolower($this->input->post('username'));
         $email = strtolower($this->input->post('email'));
         $password = $this->input->post('password');
         /*$cfolder = $this->config->item('dir_members');
         		if (!is_dir($cfolder)) mkdir($cfolder);
         		
         		$folder = $this->config->item('dir_members');
         		$data["process"]=true;
         		if ($_POST['image_name']) {
         			$fix_name = $_POST['username'].substr($_POST['image_name'],strrpos($_POST['image_name'],"."));
         			$tmp_name = $this->config->item('dir_tmp_members').$_POST['image_name'];
         			$new_name = $folder.$fix_name;
         			if (file_exists($tmp_name)) {
         				if (copy($tmp_name,$new_name)) {
         					$file_name=$fix_name;
         					unlink($tmp_name);
         				}
         			}
         		}*/
         if ($_POST['image_name']) {
             $file_name = $this->__file_upload($_POST['image_name'], $_POST['username']);
         }
         $additional_data = array('first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'), 'company' => $this->input->post('company'), 'phone' => $this->input->post('phone'), 'handphone' => $this->input->post('handphone'), 'nama' => $this->input->post('first_name'), 'pekerjaan' => $this->input->post('pekerjaan'), 'tanda_pengenal' => $this->input->post('tanda_pengenal'), 'nomor_pengenal' => $this->input->post('username'), 'jenis_kelamin' => $this->input->post('jenis_kelamin'), 'tempat_lahir' => $this->input->post('tempat_lahir'), 'tanggal_lahir' => $this->input->post('tanggal_lahir'), 'alamat' => $this->input->post('alamat'), 'kabupaten_kota' => $this->input->post('kabupaten_kota'), 'propinsi' => $this->input->post('propinsi'), 'kode_pos' => $this->input->post('kode_pos'), 'image' => $file_name);
     }
     if (check_captcha() && $this->form_validation->run() == true && $this->ion_auth->register($username, $password, $email, $additional_data)) {
         // echo "inaaa";exit;
         //check to see if we are creating the user
         //redirect them back to the admin page
         $this->session->set_flashdata('message', $this->ion_auth->messages());
         set_message("success", "Proses Pendaftaran Berhasil. Kode Aktifasi telah dikirim ke email anda (" . $email . ")");
         redirect("user/login", 'refresh');
     } else {
         //display the create user form
         //set the flash data error message if there is one
         $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'));
         $this->data['username'] = array('name' => 'username', 'id' => 'username', 'type' => 'text', 'value' => $this->form_validation->set_value('username'));
         $this->data['first_name'] = array('name' => 'first_name', 'id' => 'first_name', 'type' => 'text', 'value' => $this->form_validation->set_value('first_name'));
         $this->data['last_name'] = array('name' => 'last_name', 'id' => 'last_name', 'type' => 'text', 'value' => $this->form_validation->set_value('last_name'));
         $this->data['email'] = array('name' => 'email', 'id' => 'email', 'type' => 'text', 'value' => $this->form_validation->set_value('email'));
         $this->data['company'] = array('name' => 'company', 'id' => 'company', 'type' => 'text', 'value' => $this->form_validation->set_value('company'));
         $this->data['phone'] = array('name' => 'phone', 'id' => 'phone', 'type' => 'text', 'value' => $this->form_validation->set_value('phone'));
         $this->data['handphone'] = array('name' => 'handphone', 'id' => 'handphone', 'type' => 'text', 'value' => $this->form_validation->set_value('handphone'));
         $this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password', 'value' => '');
         $this->data['password_confirm'] = array('name' => 'password_confirm', 'id' => 'password_confirm', 'type' => 'password', 'value' => '');
         //ADDITIONAL DATA
         $this->data['tanda_pengenal'] = array('name' => 'tanda_pengenal', 'id' => 'tanda_pengenal', 'type' => 'text', 'value' => $this->form_validation->set_value('tanda_pengenal'));
         $this->data['tempat_lahir'] = array('name' => 'tempat_lahir', 'id' => 'tempat_lahir', 'type' => 'text', 'value' => $this->form_validation->set_value('tempat_lahir'));
         $this->data['tanggal_lahir'] = array('name' => 'tanggal_lahir', 'id' => 'tanggal_lahir', 'type' => 'text', 'value' => $this->form_validation->set_value('tanggal_lahir'));
         $this->data['kode_pos'] = array('name' => 'kode_pos', 'id' => 'kode_pos', 'type' => 'text', 'value' => $this->form_validation->set_value('kode_pos'));
         $this->data['kabupaten_kota'] = array('name' => 'kabupaten_kota', 'id' => 'kabupaten_kota', 'type' => 'text', 'value' => $this->form_validation->set_value('kabupaten_kota'));
         $this->data['propinsi'] = array('name' => 'propinsi', 'id' => 'propinsi', 'type' => 'text', 'value' => $this->form_validation->set_value('propinsi'));
         $this->data['pekerjaan_select'] = array('name' => 'pekerjaan_select', 'id' => 'pekerjaan', 'type' => 'text', 'value' => $this->form_validation->set_value('pekerjaan_select'));
         $this->data['pekerjaan'] = array('name' => 'pekerjaan', 'id' => 'pekerjaan_text2', 'type' => 'text', 'value' => $this->form_validation->set_value('pekerjaan'));
         $this->data['m_tanda_pengenal'] = $this->get_lookup_tanda_pengenal();
         $this->data['m_propinsi'] = $this->get_lookup_propinsi();
         $this->data['m_pekerjaan'] = $this->get_lookup_pekerjaan();
         $this->_render_page('user/auth/create_user', $this->data, true);
     }
 }
Exemplo n.º 5
0
 public function login($username = '', $password = '', $captcha = '')
 {
     if (IS_POST) {
         /* 检测验证码 */
         if (!check_captcha($captcha)) {
             $this->error('验证码输入错误!');
         }
         if (!valid_email($username)) {
             $this->error('邮箱格式不正确!');
         }
         $reg_verify_code = D('User')->field('reg_verify_code')->getByEmail($username);
         if ($reg_verify_code['reg_verify_code']) {
             $regcode = explode('+', $user['reg_verify_code']);
             $this->error('您还没有验证邮箱');
             $this->redirect(U('User/reg_verify?regcode=' . $regcode[0]));
         }
         $user = D('User')->login($username, $password);
         if ($user['id']) {
             $this->success('登录成功!', U('Dashboard/list_contents?status=2'));
         } else {
             $this->error('用户名或密码错误');
         }
     } else {
         //显示登录
         if (UID) {
             $this->redirect(U('Dashboard/edit_user'));
         } else {
             $this->display();
         }
     }
 }
Exemplo n.º 6
0
    $do_calc_avg = true;
    $ok = dbquery("DELETE FROM " . DB_PRP_VOTES . "\n\t\tWHERE review_id='" . $review->id . "'\n\t\t\tAND user_id='" . $userdata['user_id'] . "'");
} elseif (isset($_POST['add_comment']) && iUSER >= $prp->settings['kommentare']) {
    $do_calc_comments = true;
    $c_text = trim(stripinput(censorwords($_POST['comm_text'])));
    if (empty($c_text)) {
        $review->fallback_review();
    }
    $c_smileys = isset($_POST['disable_smileys']) ? "0" : "1";
    if (iMEMBER) {
        $c_user = $userdata['user_id'];
        $c_name = $userdata['user_name'];
    } else {
        $c_user = "******";
        $c_name = trim(stripinput($_POST['comment_name']));
        if (!check_captcha($_POST['captcha_encode'], $_POST['user_code'])) {
            fallback($href . "&comm_user="******"&comm_text=" . urlencode($c_text) . "&comm_smileys=" . $c_smileys . '&wrong_captcha=1' . '#new_comment');
        }
    }
    $ok = dbquery("INSERT INTO " . DB_PRP_COMMENTS . "\n\t\tSET\n\t\treview_id='" . $review->id . "',\n\t\tuser_id='" . $c_user . "',\n\t\tcomment_user_name='" . $c_name . "',\n\t\tcomment_text='" . $c_text . "',\n\t\tcomment_timestamp='" . time() . "',\n\t\tcomment_ip='" . USER_IP . "',\n\t\tcomment_smileys='" . $c_smileys . "'");
    $comment_id = mysql_insert_id();
    $review->log_event(PRP_EV_NEWCOMMENT, 0);
    $href .= "#comm" . $comment_id;
} elseif (isset($_POST['delete_comments']) && iPRP_MOD) {
    $do_calc_comments = true;
    if (!isset($_POST['comment'])) {
        fallback(FUSION_SELF . "?did=" . $review->id);
    }
    $errors = 0;
    foreach ($_POST['comment'] as $id => $val) {
        if (!dbquery("DELETE FROM " . DB_PRP_COMMENTS . " WHERE comment_id='" . $id . "'" . " AND review_id='" . $review->id . "'")) {
Exemplo n.º 7
0
/**
 * Calling this assumes captcha was needed. Checks that it was done correctly.
 *
 * @param  boolean		Whether to possibly regenerate upon error.
 */
function enforce_captcha($regenerate_on_error = true)
{
    if (use_captcha()) {
        $code_entered = post_param('security_image');
        if (!check_captcha($code_entered, $regenerate_on_error)) {
            $GLOBALS['HTTP_STATUS_CODE'] = '500';
            if (!headers_sent()) {
                if (function_exists('browser_matches')) {
                    if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) {
                        header('HTTP/1.0 500 Internal server error');
                    }
                }
            }
            warn_exit(do_lang_tempcode('INVALID_SECURITY_CODE_ENTERED'));
        }
    }
}
Exemplo n.º 8
0
if (tp('check') == 1) {
    $message = "";
    $class = "";
    $output = "<div class=\"alert {$class} \"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><i class=\"icon-remove\"></i></button><strong><i class=\"icon-remove\"></i>Erreur! </strong>{$message}</div>";
    global $db;
    model::load('login', 'login');
    //check user exist
    if (!check_email(tp('email'))) {
        $message = "Cette Adresse (" . tp('email') . ") E-mail n'exist pas";
        $class = "alert-error";
        $output = "<div class=\"alert {$class} \"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><i class=\"icon-remove\"></i></button><strong><i class=\"icon-remove\"></i> Erreur! <br></strong>{$message}</div>";
        exit("3# {$output}");
    }
    // Check Captcha Code
    if (!check_captcha(tp('captcha'))) {
        $message = "Le code anti-robots est incorrect";
        $class = "alert-error";
        $output = "<div class=\"alert {$class} \"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><i class=\"icon-remove\"></i></button><strong><i class=\"icon-remove\"></i> Erreur! <br></strong>{$message}</div>";
        exit("2# {$output}");
    }
    //All is OK send email
    if (!forgot(tp('email'), tp('captcha'))) {
        $message = "Erreur Système";
        $class = "alert-error";
        $output = "<div class=\"alert {$class} \"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><i class=\"icon-remove\"></i></button><strong><i class=\"icon-remove\"></i> Erreur! <br></strong>{$message}</div>";
        exit("4# {$output}");
    } else {
        $message = "Un message de récupération est envoyé dans votre boite";
        $class = "alert-success";
        $output = "<div class=\"alert {$class} \"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><i class=\"icon-remove\"></i></button><strong><i class=\"icon-remove\"></i> OK ! </strong><br>{$message}</div>";
Exemplo n.º 9
0
// $mail new PHPMailer;
// $mail->IsSMTP();
// $mail->Host 		= "smtp.gmail.com";
// $mail->SMTPAuth 	= true;
// $mail->SMTPSecure	= "ssl";
// $mail->Port 		= 465;
// $mail->CharSet 		= 'UTF-8';
//собираем данные для отправки
$name = $_POST['name'];
$email = $_POST['email'];
$msg = $_POST['message'];
$kaptcha = $_POST['g-recaptcha-response'];
$dataBack = array();
$captcha = $_POST['g-recaptcha-response'];
$ip = $_SERVER['REMOTE_ADDR'];
if (!check_captcha($sekret_key, $captcha, $ip)) {
    $dataBack['status'] = 'error';
    $dataBack['text'] = 'Вы не верно заполнили капчу!';
} else {
    // $dataBack['status']='OK';
    // $dataBack['text'] ='Капча верна';
    if (send_message_to_email(array('name' => $name, 'email' => $email, 'message' => $msg))) {
        $dataBack['status'] = 'OK';
        $dataBack['text'] = 'Ваше письмо успешно отправлено!';
    } else {
        $dataBack['status'] = 'error';
        $dataBack['text'] = 'Что-то пошло не так, письмо не отправлено! Возможно проблемы с сервером.';
    }
}
function check_captcha($key, $catpcha, $ip)
{
Exemplo n.º 10
0
if (MReq::tp('check') == 1) {
    $message = "";
    $class = "";
    $output = "";
    global $db;
    model::load('login', 'login');
    //check user exist
    if (!check_email(MReq::tp('email'))) {
        $message = "Cette Adresse (" . MReq::tp('email') . ") E-mail n'exist pas";
        $class = "alert-error";
        $output = $message;
        exit("3# {$output}");
    }
    // Check Captcha Code
    if (!check_captcha(MReq::tp('captcha'))) {
        $message = "Le code anti-robots est incorrect";
        $class = "alert-error";
        $output = $message;
        exit("2# {$output}");
    }
    //All is OK send email
    if (!forgot(MReq::tp('email'), MReq::tp('captcha'))) {
        $message = "Erreur Système";
        $class = "alert-error";
        $output = $message;
        exit("4# {$output}");
    } else {
        $message = "Un message de récupération est envoyé dans votre boite";
        $class = "alert-success";
        $output = "<div class=\"alert {$class} \"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"><i class=\"icon-remove\"></i></button><strong><i class=\"icon-remove\"></i> OK ! </strong><br>{$message}</div>";
  form, a blog comment form, or some other page where you want to prove that the
  user is human before allowing them access.</p>
  <p>When you solve the CAPTCHA below, nothing will happen until you submit the
  form.  At that point, the CAPTCHA will be checked.</p>
  <p>Things to try:</p>
  <ol>
    <li>Solve the CAPTCHA, then Submit.</li>
    <li>Fail the CAPTCHA, then Submit.</li>
    <li>Submit without attempting the CAPTCHA.</li>
  </ol>
<?php 
    // This is how to put a ConfidentSecure Single CAPTCHA on your page
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        if (isset($_SESSION['confidentcaptcha_started'])) {
            // this is how you check the results of the captcha solution
            $valid = check_captcha($_REQUEST['confidentcaptcha_code'], $_REQUEST['confidentcaptcha_captcha_id'], $api_settings);
            if ($valid['status'] == 200) {
                $captcha_solved = $valid['body'] == 'True';
            } else {
                if ($valid['status'] == 404) {
                    $captcha_solved = false;
                } else {
                    if ($debug == true) {
                        echo "<p><i>Failed to verify CAPTCHA,, because ";
                        echo "check_captcha call failed with status code: " . $response['status'];
                        echo "<br />response body: </i><br />" . $response['body'];
                        echo "<br /><i>The form will act like the CAPTCHA succeeded.</i></p>";
                    }
                    $captcha_solved = true;
                }
            }
Exemplo n.º 12
0
<?php

require_once "data.php";
require_once "functions.php";
$inputData = array('feedback_name' => clear_data_str($_POST['feedback-name']), 'feedback_email' => clear_data_str($_POST['feedback-email']), 'feedback_message' => clear_data_str($_POST['feedback-message']), 'feedback_captcha' => $_POST['g-recaptcha-response']);
$data = array('status' => 'ok', 'title' => 'Ура!', 'message' => 'Собощение отправлено.');
foreach ($inputData as $input) {
    if (!$input) {
        $data['status'] = 'error';
        $data['title'] = 'Ошибка!';
        $data['message'] = 'Заполните все поля.';
    }
}
if (!check_captcha($secret_key, $inputData['feedback_captcha'])) {
    $data['status'] = 'error';
    $data['title'] = 'Ошибка!';
    $data['message'] = 'Подтвердите, что вы не робот.';
}
if ($data['status'] == 'ok') {
    require '../composer/vendor/phpmailer/phpmailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    $mail->isSendmail();
    $mail->setFrom('*****@*****.**', 'korchenov.ru');
    $mail->addAddress('*****@*****.**', 'Ilya Korchenov');
    $mail->Subject = $inputData['feedback_name'] . " написал(а) сообщение с сайта";
    $mail->msgHTML("<b>" . $inputData['feedback_name'] . ' просит прислать ответ на адрес: ' . $inputData['feedback_email'] . '</b>' . PHP_EOL . '<br/><br />' . $inputData['feedback_message']);
    if (!$mail->send()) {
        $data['status'] = 'error';
        $data['title'] = 'Ошибка!';
        $data['message'] = 'Возникла ошибкка при отправке. ' . $mail->ErrorInfo;
Exemplo n.º 13
0
 public function apply()
 {
     //turned off
     die;
     if (!check_captcha()) {
         $this->templatemanager->notify_next(__("You have entered wrong security code."), "error", __("Error!"));
         redirect("administration/auth/register");
         die;
     }
     $this->load->helper('email');
     //get all
     $name = trim($this->input->post("name", true));
     $email = trim($this->input->post("email", true));
     $pass = trim($this->input->post("password", true));
     $pass2 = trim($this->input->post("password2", true));
     //check if all present
     if (empty($name) || empty($email) || empty($pass) || empty($pass)) {
         $this->templatemanager->notify_next(__("Please fill all fields so you can continue."), "error", __("Error"));
         redirect("administration/auth/register");
     }
     if (strlen($name) < 5) {
         $this->templatemanager->notify_next(__("Name must be longer than 4 characters!"), "error", __("Error"));
         redirect("administration/auth/register");
     }
     //check e-mail validity
     if (!valid_email($email)) {
         $this->templatemanager->notify_next(__("Entered e-mail address was not valid."), "error", __("Error"));
         redirect("administration/auth/register");
     }
     //check if passwords are the same
     if ($pass != $pass2) {
         $this->templatemanager->notify_next(__("Passwords differ."), "error", __("Error"));
         redirect("administration/auth/register");
     }
     //check user by email
     $user = User::factory()->get_by_email($email);
     if ($user->exists()) {
         $this->templatemanager->notify_next(__("User with that e-mail address already exists."), "error", __("Error"));
         redirect("administration/auth/register");
     }
     //create user
     $newu = new User();
     $newu->name = $name;
     $newu->email = $email;
     $newu->password = $pass;
     $newu->key = random_string('unique');
     $role = Userrole::get_lowest();
     $newu->save($role);
     //set variables for template
     $vars = array('name' => $name, 'email' => $email, 'password' => $pass, 'website_title' => Setting::value('website_title', CS_PRODUCT_NAME), 'activation_link' => site_url('administration/auth/activate/' . $newu->id . '/' . $newu->key), 'site_url' => site_url());
     //get email template
     $template = file_get_contents(APPPATH . "templates/register.html");
     $template = __($template, null, 'email');
     $template .= "<br />\n<br />\n<br />\n" . __(file_get_contents(APPPATH . "templates/signature.html"), null, 'email');
     $template = parse_template($template, $vars);
     //send email
     $this->email->to("{$name} <{$email}>");
     $this->email->subject(__("%s registration", Setting::value('website_title', CS_PRODUCT_NAME), 'email'));
     $this->email->message($template);
     $this->email->set_alt_message(strip_tags($template));
     $from = Setting::value("default_email", false);
     if (empty($from)) {
         $from = "noreply@" . get_domain_name(true);
     }
     $this->email->from($from);
     $sent = $this->email->send();
     if ($sent) {
         $this->templatemanager->notify_next(__("Account created. Please check your e-mail."), "notice", __("Notice"));
     } else {
         $this->templatemanager->notify_next(__("Activation e-mail could not be sent!"), "error", __("Error"));
     }
     redirect("administration/auth/login");
 }
Exemplo n.º 14
0
$email = htmlentities(strip_tags(trim($_POST['email'])));
$mess = htmlentities(strip_tags(trim($_POST['message'])));
$captcha = $_POST['g-recaptcha-response'];
$ip = $_SERVER['REMOTE_ADDR'];
$secret_key = "6LfohBMTAAAAADCZBgxfbUfmhWvJgDZ6M1A9JKv0";
$public_key = "6LfohBMTAAAAAOXV96zJp-9kY1YB7tFXaeNhyUdD";
$data = array();
function check_captcha($key, $captcha, $ip)
{
    $url_to_send = 'https://www.google.com/recaptcha/api/siteverify?secret=' . $key . '&response=' . $captcha . '&ip=' . $ip;
    $data_request = file_get_contents($url_to_send);
    $resp_data = json_decode($data_request, true);
    if (isset($resp_data['success']) && $resp_data['success'] == 1) {
        return true;
    } else {
        return false;
    }
}
if ($name === '' && $email === '' && $mess === '') {
    $data['status'] = 'error';
    $data['text'] = "Заполните поля!";
} elseif (!check_captcha($secret_key, $captcha, $ip)) {
    $data['status'] = 'error';
    $data['text'] = "Вы все-таки робот!";
} else {
    $data['status'] = 'success';
    $data['text'] = "Запрос прошел успешно";
}
header("Content-Type: application/json");
echo json_encode($data);
exit;
Exemplo n.º 15
0
 /**
  * Function: register
  * Process registration. If registration is disabled or if the user is already logged in, it will error.
  */
 public function register()
 {
     $config = Config::current();
     if (!$config->can_register) {
         error(__("Registration Disabled"), __("I'm sorry, but this site is not allowing registration."));
     }
     if (logged_in()) {
         error(__("Error"), __("You're already logged in."));
     }
     if (!empty($_POST)) {
         if (empty($_POST['login'])) {
             Flash::warning(__("Please enter a username for your account."));
         } elseif (count(User::find(array("where" => array("login" => $_POST['login']))))) {
             Flash::warning(__("That username is already in use."));
         }
         if (empty($_POST['password1'])) {
             Flash::warning(__("Password cannot be blank."));
         } elseif ($_POST['password1'] != $_POST['password2']) {
             Flash::warning(__("Passwords do not match."));
         }
         if (empty($_POST['email'])) {
             Flash::warning(__("E-mail address cannot be blank."));
         } elseif (!preg_match("/^[_A-z0-9-]+((\\.|\\+)[_A-z0-9-]+)*@[A-z0-9-]+(\\.[A-z0-9-]+)*(\\.[A-z]{2,4})\$/", $_POST['email'])) {
             Flash::warning(__("Invalid e-mail address."));
         }
         if ($config->enable_recaptcha and !check_captcha()) {
             Flash::warning(__("Incorrect captcha code. Please try again."));
         }
         if (!Flash::exists("warning")) {
             if ($config->email_activation) {
                 $to = $_POST['email'];
                 $subject = _f($config->name . " Registration Pending");
                 $message = _f("Hello, " . fix($_POST['login']) . ".\n\nYou are receiving this message because you recently registered at " . $config->chyrp_url . "\nTo complete your registration, go to " . $config->chyrp_url . "/?action=validate&login="******"&token=" . sha1($_POST['login'] . $_POST['email']));
                 $headers = "From:" . $config->email . "\r\n" . "Reply-To:" . $config->email . "\r\n" . "X-Mailer: PHP/" . phpversion();
                 $user = User::add($_POST['login'], $_POST['password1'], $_POST['email'], "", "", 5, false);
                 $sent = email($to, $subject, $message, $headers);
                 if ($sent) {
                     Flash::notice(__("The email address you provided has been sent details to confirm registration."), "/");
                 } else {
                     Flash::notice(__("There was an error emailing the activation link to your email address."), "/");
                 }
             } else {
                 $user = User::add($_POST['login'], $_POST['password1'], $_POST['email']);
                 Trigger::current()->call("user_registered", $user);
                 $_SESSION['user_id'] = $user->id;
                 Flash::notice(__("Registration successful."), "/");
             }
         }
     }
     $this->display("forms/user/register", array(), __("Register"));
 }
Exemplo n.º 16
0
$nic_name = trim(htmlspecialchars($nic_name));
$age = trim(htmlspecialchars($age));
$email = trim(htmlspecialchars($email));
$website = trim(htmlspecialchars($website));
$school = trim(htmlspecialchars($school));
$work = trim(htmlspecialchars($work));
$hobby = trim(htmlspecialchars($hobby));
$comment = trim(htmlspecialchars($comment));
$icq = trim(htmlspecialchars($icq));
$msn = trim(htmlspecialchars($msn));
$yahoo = trim(htmlspecialchars($yahoo));
$qq = trim(htmlspecialchars($qq));
if ($login_true || $admin_user) {
} else {
    if (USE_CAPCHA) {
        check_captcha($_POST['security_code']);
    }
}
if ($first_name == "" || $last_name == "" || $nic_name == "" || $sex == "" || $age == "" || $numid == '' || $yearfin == '' || $province == "" || $email == "") {
    $showmsg = "<br><br><center><font size='3' face='MS Sans Serif'><b>" . _MEMBER_MOD_FORM_JAVA_DATA_NOT . "</b></font><br><br>\n<input type='button' value='" . _MEMBER_MOD_FORM_JAVA_RETERN . "' onclick='history.back();'></center>";
    showerror($showmsg);
    exit;
}
// »éͧ¡Ñ¹¤ÓËÂÒº¢Í§ Comment
$comment = CheckRude($comment);
// á»Å§ Çѹ/à´×͹/»Õà¡Ô´
$birthday = "{$day}/{$month}/{$year}";
$MPics = $_FILES['MPic'];
//	echo $MPics['name'];
// µÃǨÊͺ¤ÇÒÁ¡ÇéÒ§¢Í§ÃÙ»
if (empty($MPics['tmp_name'])) {
function pdp_check_captcha()
{
    if (FUSION_VERSION == 7) {
        require_once INCLUDES . 'securimage/securimage.php';
        $securimage = new Securimage();
        return isset($_POST['user_code']) && $securimage->check($_POST['user_code']);
    } else {
        return check_captcha($_POST['captcha_encode'], $_POST['user_code']);
    }
}