• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP generate_code函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中generate_code函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_code函数的具体用法?PHP generate_code怎么用?PHP generate_code使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了generate_code函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: form

 public function form()
 {
     \CI::form_validation()->set_rules('to_email', 'lang:recipient_email', 'trim|required');
     \CI::form_validation()->set_rules('to_name', 'lang:recipient_name', 'trim|required');
     \CI::form_validation()->set_rules('from', 'lang:sender_name', 'trim|required');
     \CI::form_validation()->set_rules('personal_message', 'lang:personal_message', 'trim');
     \CI::form_validation()->set_rules('beginning_amount', 'lang:amount', 'trim|required|numeric');
     $data['page_title'] = lang('add_gift_card');
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('gift_card_form', $data);
     } else {
         $save['code'] = generate_code();
         // from the string helper
         $save['to_email'] = \CI::input()->post('to_email');
         $save['to_name'] = \CI::input()->post('to_name');
         $save['from'] = \CI::input()->post('from');
         $save['personal_message'] = \CI::input()->post('personal_message');
         $save['beginning_amount'] = \CI::input()->post('beginning_amount');
         \CI::GiftCards()->saveCard($save);
         if (\CI::input()->post('sendNotification')) {
             \GoCart\Emails::giftCardNotification($save);
         }
         \CI::session()->set_flashdata('message', lang('message_saved_gift_card'));
         redirect('admin/gift-cards');
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:26,代码来源:AdminGiftCards.php


示例2: user_login

function user_login($mysqli, $login, $password)
{
    // Получим данные пользователя
    $user_data = user_get_data_by_login($mysqli, $login);
    // Сравниваем пароли
    if ($user_data['password'] === md5(md5($password))) {
        // Пароли сошлись
        // Генерируем случайное число и шифруем его
        $hash = md5(generate_code(10));
        // Запрос
        $query = "UPDATE users SET hash='{$hash}' WHERE id='{$user_data['id']}'";
        // Записываем в БД новый хеш авторизации и ID
        if ($result = $mysqli->query($query)) {
            // Запись прошла успешно
            // Запишем событие в журнал
            event_add($mysqli, 15, "Пользователь принял смену.", $_POST['login']);
            // Запишем в куки id
            setcookie("id", $user_data['id'], time() + 60 * 60 * 24 * 30);
            // и хэш
            setcookie("hash", $hash, time() + 60 * 60 * 24 * 30);
            // Переадресовываем на главную
            header("Location: index.php");
            exit;
            // Сообщим об успешном входе
            return "Добро пожаловать";
        }
        return "Ошибка записи в БД";
    } else {
        return "Неправильная комбинация имени пользователя и пароля";
    }
}
开发者ID:Other-Proto,项目名称:Neptune,代码行数:31,代码来源:login.php


示例3: entry_captcha

 function entry_captcha()
 {
     //session_start();
     //生成验证码图片
     Header("Content-type: image/PNG");
     $im = imagecreate(44, 18);
     // 画一张指定宽高的图片
     $back = ImageColorAllocate($im, 245, 245, 245);
     // 定义背景颜色
     imagefill($im, 0, 0, $back);
     //把背景颜色填充到刚刚画出来的图片中
     $vcodes = "";
     //srand((double)microtime()*1000000);
     //生成4位数字
     $vcodes = generate_code(4);
     for ($i = 0; $i < 4; $i++) {
         $font = ImageColorAllocate($im, rand(100, 255), rand(0, 100), rand(100, 255));
         // 生成随机颜色
         $authnum = $vcodes[$i];
         imagestring($im, 5, 2 + $i * 10, 1, $authnum, $font);
     }
     $_SESSION['captcha'] = strtolower($vcodes);
     for ($i = 0; $i < 100; $i++) {
         $randcolor = ImageColorallocate($im, rand(0, 255), rand(0, 255), rand(0, 255));
         imagesetpixel($im, rand() % 70, rand() % 30, $randcolor);
         // 画像素点函数
     }
     ImagePNG($im);
     ImageDestroy($im);
 }
开发者ID:questionlin,项目名称:readcat,代码行数:30,代码来源:Vindex.php


示例4: deal_code_form

 function deal_code_form($id = false)
 {
     $this->load->helper('form');
     $this->load->library('form_validation');
     $data['page_title'] = 'Add Deal Code';
     //default values are empty if the deal_type is new
     $data['id'] = '';
     $data['code_no'] = '';
     if ($id) {
     }
     $this->form_validation->set_rules('code_no', 'Number of codes', 'trim|required|is_numeric');
     if ($this->form_validation->run() == FALSE) {
         $this->load->view($this->config->item('admin_folder') . '/deal_code_form', $data);
     } else {
         $code_nums = $this->input->post('code_no');
         $k = $code_nums;
         $this->load->helper('string');
         while ($k) {
             $code = generate_code(6);
             if (!$this->Dealsign_model->check_deal_code($code)) {
                 $data = array('id' => '', 'deal_code' => $code, 'is_used' => 0);
                 $this->Dealsign_model->save_deal_code($data);
                 $k--;
             }
         }
         $this->session->set_flashdata('message', '<b>' . $code_nums . '</b> codes has been generated successfully');
         //go back to the deal_city list
         redirect($this->config->item('admin_folder') . '/dealsign/deal_codes');
     }
 }
开发者ID:dealsign,项目名称:public_html,代码行数:30,代码来源:dealsign.php


示例5: process_form

function process_form()
{
    // INITIAL DATA FETCHING
    global $school_name, $email;
    // so that the show_form function can use these values later
    $school_name = htmlentities(trim($_POST['school_name']));
    $email = htmlentities($_POST['email']);
    $name_msg = validate_school_name($school_name);
    $recaptcha_msg = validate_recaptcha();
    $email_msg = validate_coach_email($email);
    if ($name_msg !== true) {
        alert($name_msg, -1);
    } else {
        if ($recaptcha_msg !== true) {
            alert($recaptcha_msg, -1);
        } else {
            if ($email_msg !== true) {
                alert($email_msg, -1);
            } else {
                // ** All information has been validated at this point **
                $access_code = generate_code(5);
                // Create database entry
                DB::insert('schools', array('name' => $school_name, 'coach_email' => $email, 'access_code' => $access_code));
                // Get user id (MySQL AUTO_INCREMENT id)
                $id = DB::insertId();
                global $LMT_EMAIL;
                $lmt_year = htmlentities(map_value('year'));
                $lmt_date = htmlentities(map_value('date'));
                // Send the email
                $url = get_site_url() . '/LMT/Registration/Signin?ID=' . $id . '&Code=' . $access_code;
                $subject = "LMT {$lmt_year} Account";
                $body = <<<HEREDOC
To: {$school_name}

Thank you for registering your school for the LMT! The contest will be 
held on [b]{$lmt_date} [/b] at Lexington High School.

You may register teams for LMT {$lmt_year} via the link below. This link will
also enable you to modify teams as long as registration is open.

[b][url]{$url} [/url][/b]

If you have any questions, please contact us at [email]{$LMT_EMAIL} [/email].
HEREDOC;
                lmt_send_email(array($email => $school_name), $subject, $body);
                // Show the post-registration message
                echo <<<HEREDOC
      <h1>Coach Registration</h1>
      
      <div class="text-centered">
        Your account was created. Please check your email inbox for a confirmation email.
      </div>
HEREDOC;
                die;
            }
        }
    }
}
开发者ID:lhsmath,项目名称:lhsmath.org,代码行数:58,代码来源:Coach.php


示例6: forms

 function forms()
 {
     $data = $this->earndb->get_last_faktur();
     print_r($data);
     //generate kode faktur baru --> generate_code_helper
     $faktur = generate_code($data);
     print_r($faktur);
     $this->load->view('earn_form_inside', array('faktur' => $faktur));
 }
开发者ID:roniwahyu,项目名称:Sistem-Informasi-Peternakan,代码行数:9,代码来源:earn.php


示例7: lostPassword

function lostPassword($username, $email)
{
    $randomPassword = generate_code(10);
    if (changePassword($username, $randomPassword, $randomPassword)) {
        if (sendLostPasswordEmail($username, $email, $randomPassword)) {
            return true;
        }
    }
    return false;
}
开发者ID:audunel,项目名称:anthropos,代码行数:10,代码来源:user.functions.inc.php


示例8: GetID

function GetID($prefix)
{
    //第一步:初始化种子
    //microtime(); 是个数组
    /*$seedstr =split(" ",microtime(),5);
    		$seed =$seedstr[0]*10000;
    		//第二步:使用种子初始化随机数发生器
    		srand($seed);
    	*/
    //第三步:生成指定范围内的随机数
    $random = rand(1000, 10000);
    $random .= generate_code();
    $filename = date("Ymd", time()) . $random . $prefix;
    return $filename;
}
开发者ID:snamper,项目名称:CI_xiaoshuhaochi,代码行数:15,代码来源:uploads.php


示例9: chec_code

function chec_code($code)
{
    $code = trim($code);
    //удаляем пробелы
    $array_mix = preg_split('//', generate_code(), -1, PREG_SPLIT_NO_EMPTY);
    $m_code = preg_split('//', $code, -1, PREG_SPLIT_NO_EMPTY);
    $result = array_intersect($array_mix, $m_code);
    if (strlen(generate_code()) != strlen($code)) {
        return FALSE;
    }
    if (sizeof($result) == sizeof($array_mix)) {
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:VovaGurovskiy,项目名称:EnergoRemote,代码行数:16,代码来源:save_user.php


示例10: form

 function form()
 {
     $this->form_validation->set_rules('to_email', 'lang:recipient_email', 'trim|required');
     $this->form_validation->set_rules('to_name', 'lang:recipient_name', 'trim|required');
     $this->form_validation->set_rules('from', 'lang:sender_name', 'trim|required');
     $this->form_validation->set_rules('personal_message', 'lang:personal_message', 'trim');
     $this->form_validation->set_rules('beginning_amount', 'lang:amount', 'trim|required|numeric');
     $data['page_title'] = lang('add_giftcard');
     if ($this->form_validation->run() == FALSE) {
         $this->load->view($this->config->item('admin_folder') . '/giftcard_form', $data);
     } else {
         $this->load->helper('utility_helper');
         $save['code'] = generate_code();
         // from the utility helper
         $save['to_email'] = $this->input->post('to_email');
         $save['to_name'] = $this->input->post('to_name');
         $save['from'] = $this->input->post('from');
         $save['personal_message'] = $this->input->post('personal_message');
         $save['beginning_amount'] = $this->input->post('beginning_amount');
         $save['activated'] = 1;
         $this->Gift_card_model->save_card($save);
         if ($this->input->post('send_notification')) {
             //get the canned message for gift cards
             $row = $this->db->where('id', '1')->get('canned_messages')->row_array();
             // set replacement values for subject & body
             $row['subject'] = str_replace('{from}', $save['from'], $row['subject']);
             $row['subject'] = str_replace('{site_name}', $this->config->item('company_name'), $row['subject']);
             $row['content'] = str_replace('{code}', $save['code'], $row['content']);
             $row['content'] = str_replace('{amount}', $save['beginning_amount'], $row['content']);
             $row['content'] = str_replace('{from}', $save['from'], $row['content']);
             $row['content'] = str_replace('{personal_message}', nl2br($save['personal_message']), $row['content']);
             $row['content'] = str_replace('{url}', $this->config->item('base_url'), $row['content']);
             $row['content'] = str_replace('{site_name}', $this->config->item('company_name'), $row['content']);
             $this->load->library('email');
             $config['mailtype'] = 'html';
             $this->email->initialize($config);
             $this->email->from($this->config->item('email'));
             $this->email->to($save['to_email']);
             $this->email->subject($row['subject']);
             $this->email->message($row['content']);
             $this->email->send();
         }
         $this->session->set_flashdata('message', lang('message_saved_giftcard'));
         redirect($this->config->item('admin_folder') . '/giftcards');
     }
 }
开发者ID:jonyhandoko,项目名称:khayana,代码行数:46,代码来源:giftcards.php


示例11: img_code

function img_code()
{
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s", 10000) . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    header("Content-Type:image/png");
    //защита от кэшировани¤...кстати сказать не очень надежна¤...
    $linenum = 2;
    //линии
    $img_arr = array("codegen.png", "codegen0.png");
    $font_arr = array();
    $font_arr[0]["fname"] = "verdana.ttf";
    //ttf шрифты, можно заменить на свои
    $font_arr[0]["size"] = 16;
    //размер
    $font_arr[1]["fname"] = "times.ttf";
    //ttf шрифты, можно заменить на свои
    $font_arr[1]["size"] = 16;
    //размер
    $n = rand(0, sizeof($font_arr) - 1);
    $img_fn = $img_arr[rand(0, sizeof($img_arr) - 1)];
    $im = imagecreatefrompng(code_dir . $img_fn);
    //создаем изображение со случайным фоном
    for ($i = 0; $i < $linenum; $i++) {
        //рисуем линии
        $color = imagecolorallocate($im, rand(0, 150), rand(0, 100), rand(0, 150));
        imageline($im, rand(0, 20), rand(1, 50), rand(150, 180), rand(1, 50), $color);
    }
    $color = imagecolorallocate($im, rand(0, 200), 0, rand(0, 200));
    imagettftext($im, $font_arr[$n]["size"], rand(-4, 4), rand(10, 45), rand(20, 35), $color, code_dir . $font_arr[$n]["fname"], generate_code());
    //накладываем код
    for ($i = 0; $i < $linenum; $i++) {
        $color = imagecolorallocate($im, rand(0, 255), rand(0, 200), rand(0, 255));
        imageline($im, rand(0, 20), rand(1, 50), rand(150, 180), rand(1, 50), $color);
    }
    ImagePNG($im);
    ImageDestroy($im);
    //ну вот и создано изображение!
}
开发者ID:VovaGurovskiy,项目名称:EnergoRemote,代码行数:41,代码来源:my_codegen.php


示例12: register

 public function register()
 {
     $this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean|is_unique[user.user_name]');
     $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean|valid_email|is_unique[user.user_email]');
     $this->form_validation->set_message('is_unique', 'The %s has been registered');
     if ($this->form_validation->run()) {
         $code = generate_code(12);
         $name = $this->input->post('name');
         $password = $this->input->post('password');
         $email = $this->input->post('email');
         $data = array('user_name' => $name, 'user_password' => enkripsi($password), 'user_email' => $email, 'user_status' => 'active', 'user_created_date' => now(), 'user_image' => 'default.jpg', 'user_registation_reff' => 'web');
         $iduser = $this->model_user->store($data);
         $row = $this->model_user->find($iduser);
         set_userdata('session_user', $row);
         set_userdata('user_level', 'member');
         $outs['msg'] = 'Registration success';
         $outs['flag'] = 1;
     } else {
         $outs['msg'] = validation_errors();
         $outs['flag'] = 0;
     }
     echo json_encode($outs);
 }
开发者ID:ridwanskaterock,项目名称:coc-ri-comunnity,代码行数:24,代码来源:User.php


示例13: add_data

 public function add_data()
 {
     // USE HTML PURIFIER
     // Build a nice little associative array for the data
     // Loop for each name to make sure multiple entries are dealt with.
     $warehouses = $this->input->post('name');
     $i = 0;
     $data = array();
     foreach ($warehouses as $warehouse) {
         $location2 = $this->input->post('location2');
         $location1 = $this->input->post('location1');
         $temp = array('name' => $warehouse, 'location1' => $location1[$i], 'location2' => $location2[$i]);
         $data[] = $temp;
         $i++;
     }
     // Validation
     $everythingGood = 1;
     // We believe in the good!
     foreach ($data as $datum) {
         $errors = $this->validate($datum);
         if ($errors === true) {
             // Check for redundancy.
             $there = $this->sharedDB_model->get('warehouse', array('id'), array('name' => $datum['name']));
             if (count($there) > 0) {
                 echo "<div class='alert alert-error fade in'>";
                 echo "<button type='button' class='close' data-dismiss='alert'>&times;</button><strong>Oh Snap! </strong>";
                 echo "The data you tried to enter already exist in the database.";
                 echo "!</div>\n";
                 die;
             }
             // Everything is good!
         } else {
             // There are errors. Set the error flag
             $everythingGood = $everythingGood * 0;
             // Show error message/s
             foreach ($errors as $error) {
                 echo "<div class='alert alert-error fade in'>";
                 echo "<button type='button' class='close' data-dismiss='alert'>&times;</button><strong>Oh Snap! </strong>";
                 echo $error;
                 echo "!</div>\n";
             }
             // Stop operation.
             break;
         }
     }
     // Check if everything is good and if it is, sanitize and filter everything.
     if ($everythingGood == 1) {
         // Filter rules
         $filterRules = array('name' => 'trim|sanitize_string', 'location1' => 'trim|sanitize_string', 'location2' => 'trim|sanitize_string');
         // Sanitize and filter data.
         $sanitizedData = array();
         foreach ($data as $datum) {
             $datum = $this->validation->sanitize($datum);
             $sanitizedData[] = $this->validation->filter($datum, $filterRules);
         }
         // Sanitization and all complete. Insert data into the database now.
         $dbGood = 1;
         foreach ($sanitizedData as $sanitizedDatum) {
             // Generate Code.
             $this->load->helper('generate_code');
             $sanitizedDatum['code'] = generate_code($this->router->class);
             if ($this->sharedDB_model->insert('warehouse', $sanitizedDatum) == 1) {
                 $dbGood = $dbGood * 1;
             } else {
                 $dbGood = $dbGood * 0;
             }
         }
         // Check if all data has been inserted into the database and show success message!
         if ($dbGood == 1) {
             echo "<div class='alert alert-success fade in'>";
             echo "<button type='button' class='close' data-dismiss='alert'>&times;</button><strong>Well Done! </strong>";
             echo "All warehouse successfully inserted into the database!";
             echo "!</div>\n";
         }
     }
 }
开发者ID:nurulimamnotes,项目名称:inventory-management,代码行数:76,代码来源:warehouse.php


示例14: add_download_package

 function add_download_package($package, $order_id)
 {
     // get customer stuff
     $customer = $this->go_cart->customer();
     if (!empty($customer['id'])) {
         $new_package['customer_id'] = $customer['id'];
     } else {
         $new_package['customer_id'] = 0;
     }
     $new_package['order_id'] = $order_id;
     $new_package['code'] = generate_code();
     // save master package record
     $this->db->insert('download_packages', $new_package);
     $package_id = $this->db->insert_id();
     // save the db data here
     $files_list = array();
     // use this to prevent inserting duplicates
     // in case a file is shared across products
     $ids = array();
     // build files records list
     foreach ($package as $product_list) {
         foreach ($product_list as $f) {
             if (!isset($ids[$f->file_id])) {
                 $file['package_id'] = $package_id;
                 $file['file_id'] = $f->file_id;
                 $file['link'] = md5($f->file_id . time() . $new_package['customer_id']);
                 // create a unique download key for each file
                 $files_list[] = $file;
             }
         }
     }
     $this->db->insert_batch('download_package_files', $files_list);
     // save the master record to include links in the order email
     $this->go_cart->save_order_downloads($new_package);
 }
开发者ID:Joncg,项目名称:eelly_cps_fx,代码行数:35,代码来源:digital_product_model.php


示例15: process_form

function process_form()
{
    // INITIAL DATA FETCHING
    global $name, $email, $cell, $yog, $mailings;
    // so that the show_form function can use these values later
    $name = htmlentities(ucwords(trim(strtolower($_POST['name']), ' \\-\'')));
    foreach (array('-', '\'') as $delimiter) {
        if (strpos($name, $delimiter) !== false) {
            $name = implode($delimiter, array_map('ucfirst', explode($delimiter, $name)));
        }
    }
    // forces characters after spaces, hyphens and apostrophes to be capitalized
    $name = preg_replace('/[\\s\']*\\-+[\\s\']*/', '-', $name);
    // removes hyphens not between two characters
    $name = preg_replace('/[\\s\\-]*\'+[\\s\\-]*/', '\'', $name);
    // removes apostrophes not between two characters
    $name = preg_replace('/\\s+/', ' ', $name);
    // removes multiple consecutive spaces
    $name = preg_replace('/\\-+/', '-', $name);
    // removes multiple consecutive hyphens
    $name = preg_replace('/\'+/', '\'', $name);
    // removes multiple consecutive apostrophes
    $email = htmlentities(strtolower($_POST['email']));
    $cell = htmlentities($_POST['cell']);
    $yog = $_POST['yog'];
    $pass = $_POST['pass1'];
    $mailings = '0';
    if ($_POST['mailings'] == 'Yes') {
        $mailings = '1';
    }
    // CHECK THAT THE NAME IS VALID
    if (($name = sanitize_username($name)) === false) {
        alert('Your name must have only letters, hyphens, apostrophes, and spaces, and be between 3 and 30 characters long', -1);
        show_form();
        return;
    }
    if (strpos($name, ' ') == false) {
        alert('Please enter both your first <span class="i">and</span> last name', -1);
        show_form();
        return;
    }
    // CHECK THAT THE EMAIL ADDRESS IS VALID
    if (!val('e', $email)) {
        alert('That\'s not a valid email address', -1);
        show_form();
        return;
    }
    // CHECK AND FORMAT CELL PHONE NUMBER
    if ($cell != '' && ($cell = format_phone_number($cell)) === false) {
        //Validate the format of the cell phone number (if it's not left blank)
        alert('That\'s not a valid cell phone number', -1);
        show_form();
        return;
    }
    // CHECK THAT THE YOG IS VALID
    $grade = intval(getGradeFromYOG($yog));
    if ($grade < 9 || $grade > 12) {
        alert('That is not a valid YOG (' . $grade . 'you have to be in high school)', -1);
        show_form();
        return;
    }
    // CHECK THAT THE PASSWORDS MATCH, MEET MINIMUM LENGTH
    if ($pass != $_POST['pass2']) {
        alert('The passwords that you entered do not match', -1);
        show_form();
        return;
    }
    if (strlen($pass) < 6) {
        alert('Please choose a password that has at least 6 characters', -1);
        show_form();
        return;
    }
    // CHECK THAT THEY ENTERED THE RECAPTCHA CORRECTLY
    // CURRENTLY BROKEN: NEED TO UPDATE RECAPTCHA
    /* 
    $recaptcha_msg = validate_recaptcha();
    if ($recaptcha_msg !== true) {
    	alert($recaptcha_msg, -1);
    	show_form();
    	return;
    }
    */
    // CHECK THAT AN ACCOUNT WITH THAT EMAIL DOES NOT ALREADY EXIST
    // this is done *after* checking the reCaptcha to prevent bots from harvesting our email
    // addresses via a brute-force attack.
    if (DBExt::queryCount('users', 'LOWER(email)=LOWER(%s)', $email) != 0) {
        alert('An account with that email address already exists', -1);
        show_form();
        return;
    }
    // CHECK THAT AN ACCOUNT WITH THE SAME NAME IN THE SAME GRADE DOES NOT EXIST
    // - with the exception that if it's permissions = 'E', they probably mistyped their email and are redoing it.
    if (DBExt::queryCount('users', 'LOWER(name)=%s AND yog=%i AND permissions!="E"', strtolower($name), $yog) != 0) {
        alert('An account in your grade with that name already exists', -1);
        show_form();
        return;
    }
    // ** All information has been validated at this point **
    $verification_code = generate_code(5);
    // for verifying ownership of the email address
//.........这里部分代码省略.........
开发者ID:lhsmath,项目名称:lhsmath.org,代码行数:101,代码来源:Register.php


示例16: vip_card_no

function vip_card_no($num = 4)
{
    return date('ymdHis') . generate_code($num);
}
开发者ID:lz1988,项目名称:lejing,代码行数:4,代码来源:~runtime.php


示例17: set_user_recovery_code

 /**
  * Задает код для восстановления пароля пользователя
  * @param - id пользователя
  * @return string
  * 
  */
 function set_user_recovery_code($user_id)
 {
     $this->load->helper('safety');
     $code = generate_code(20);
     $this->update_user(array('recovery_code' => $code), $user_id);
     return $code;
 }
开发者ID:alldevit,项目名称:GameAP,代码行数:13,代码来源:users.php


示例18: cs_html_img

             $data['if']['captcha'] = 1;
             $data['captcha']['img'] = cs_html_img('mods/captcha/generate.php?time=' . cs_time());
         }
     }
     if (empty($op_users['def_register']) or $op_users['def_register'] == '2') {
         if ($op_users['def_register'] != '2') {
             $data['if']['reg_mail'] = 1;
         } else {
             $data['if']['reg_mail'] = 0;
         }
         echo cs_subtemplate(__FILE__, $data, 'users', 'register_code');
     } else {
         echo cs_subtemplate(__FILE__, $data, 'users', 'register_mail');
     }
 } else {
     $code_id = generate_code(30);
     // 30 Zeichen lang
     $register['users_key'] = $code_id;
     $active = empty($op_users['def_register']) ? $register['users_active'] = 1 : ($register['users_active'] = 0);
     $def_timezone = empty($cs_main['def_timezone']) ? 0 : $cs_main['def_timezone'];
     $def_dstime = empty($cs_main['def_dstime']) ? 0 : $cs_main['def_dstime'];
     create_user(2, $register['nick'], $register['password'], $register['lang'], $register['email'], 'fam', $def_timezone, $def_dstime, $register['newsletter'], $active, 20, $register['users_key']);
     $ip = cs_getip();
     if (!empty($register['send_mail']) or !empty($op_users['def_register']) or $op_users['def_register'] == '2') {
         $content = $cs_lang['mail_reg_start'] . $cs_lang['mail_reg_nick'] . $register['nick'];
         $content .= $cs_lang['mail_reg_password'] . $register['password'];
         $content .= $cs_lang['mail_reg_ip'] . $ip;
         if (!empty($op_users['def_register'])) {
             $content .= "\n" . $cs_lang['mail_key'] . ': ';
             $content .= $cs_main['php_self']['website'] . str_replace('&amp;', '&', cs_url('users', 'activate', 'key=' . $register['users_key'] . '&email=' . $register['email']));
         }
开发者ID:aberrios,项目名称:WEBTHESGO,代码行数:31,代码来源:register.php


示例19: giftcard

 function giftcard()
 {
     if (!$this->gift_cards_enabled) {
         redirect('/');
     }
     // Load giftcard settings
     $gc_settings = $this->Settings_model->get_settings("gift_cards");
     $this->load->library('form_validation');
     $data['allow_custom_amount'] = (bool) $gc_settings['allow_custom_amount'];
     $data['preset_values'] = explode(",", $gc_settings['predefined_card_amounts']);
     if ($data['allow_custom_amount']) {
         $this->form_validation->set_rules('custom_amount', 'lang:custom_amount', 'numeric');
     }
     $this->form_validation->set_rules('amount', 'lang:amount', 'required');
     $this->form_validation->set_rules('preset_amount', 'lang:preset_amount', 'numeric');
     $this->form_validation->set_rules('gc_to_name', 'lang:recipient_name', 'trim|required');
     $this->form_validation->set_rules('gc_to_email', 'lang:recipient_email', 'trim|required|valid_email');
     $this->form_validation->set_rules('gc_from', 'lang:sender_email', 'trim|required');
     $this->form_validation->set_rules('message', 'lang:custom_greeting', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         $data['error'] = validation_errors();
         $data['page_title'] = lang('giftcard');
         $data['gift_cards_enabled'] = $this->gift_cards_enabled;
         $this->load->view('giftcards', $data);
     } else {
         // add to cart
         $card['price'] = set_value(set_value('amount'));
         $card['id'] = -1;
         // just a placeholder
         $card['sku'] = lang('giftcard');
         $card['base_price'] = $card['price'];
         // price gets modified by options, show the baseline still...
         $card['name'] = lang('giftcard');
         $card['code'] = generate_code();
         // from the string helper
         $card['excerpt'] = sprintf(lang('giftcard_excerpt'), set_value('gc_to_name'));
         $card['weight'] = 0;
         $card['quantity'] = 1;
         $card['shippable'] = false;
         $card['taxable'] = 0;
         $card['fixed_quantity'] = true;
         $card['is_gc'] = true;
         // !Important
         $card['track_stock'] = false;
         // !Imporortant
         $card['gc_info'] = array("to_name" => set_value('gc_to_name'), "to_email" => set_value('gc_to_email'), "from" => set_value('gc_from'), "personal_message" => set_value('message'));
         // add the card data like a product
         $this->go_cart->insert($card);
         redirect('cart/view_cart');
     }
 }
开发者ID:devarj,项目名称:design,代码行数:51,代码来源:cart.php


示例20: submitOrder

 function submitOrder($transaction = false)
 {
     foreach ($this->items as $item) {
         if ($item->type == 'gift card') {
             //touch giftcard
             \CI::GiftCards()->updateAmountUsed($item->description, $item->total_price);
             continue;
         } elseif ($item->type == 'coupon') {
             //touch coupon
             \CI::Coupons()->touchCoupon($item->description);
             continue;
         } elseif ($item->type == 'product') {
             //update inventory
             if ($item->track_stock) {
                 \CI::Products()->touchInventory($item->product_id, $item->quantity);
             }
             //if this is a giftcard purchase, generate it and send it where it needs to go.
             if ($item->is_giftcard) {
                 //process giftcard
                 $options = CI::Orders()->getItemOptions(GC::getCart()->id);
                 $giftCard = [];
                 foreach ($options[$item->id] as $option) {
                     if ($option->option_name == 'gift_card_amount') {
                         $giftCard[$option->option_name] = $option->price;
                     } else {
                         $giftCard[$option->option_name] = $option->value;
                     }
                 }
                 $giftCard['code'] = generate_code();
                 $giftCard['activated'] = 1;
                 //save the card
                 \CI::GiftCards()->saveCard($giftCard);
                 //send the gift card notification
                 \GoCart\Emails::giftCardNotification($giftCard);
             }
         }
     }
     if (!$transaction) {
         $transaction = $this->transaction();
     }
     //add transaction info to the order
     $this->cart->order_number = $transaction->order_number;
     $this->cart->transaction_id = $transaction->id;
     $this->cart->status = config_item('order_status');
     $this->cart->ordered_on = date('Y-m-d H:i:s');
     $orderNumber = $this->cart->order_number;
     $this->saveCart();
     //refresh the cart
     $this->getCart(true);
     //get the order as it would be on the order complete page
     $order = \CI::Orders()->getOrder($orderNumber);
     //send the cart email
     \GoCart\Emails::Order($order);
     //return the order number
     return $orderNumber;
 }
开发者ID:berkapavel,项目名称:GoCart3,代码行数:56,代码来源:GoCart.php



注:本文中的generate_code函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP generate_config_cache函数代码示例发布时间:2022-05-15
下一篇:
PHP generate_class_name函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap