function show_qr($size = 128) { global $post; $permalink = get_permalink($post->ID); $qr = new qrcode(); $qr->link($permalink); echo '<a href="', $permalink, '" class="qr-anchor"><img src="', $qr->get_link(intval($size)), '" class="qr-img" title="', $post->post_title, '"/></a>'; }
public function doset() { $url = trim($this->input['define']['DOWNLOAD_URL']); is_file(CACHE_DIR . 'client_link.txt') && @unlink(CACHE_DIR . 'client_link.txt'); if ($url) { //生成二维码 include_once ROOT_PATH . 'lib/class/qrcode.class.php'; $qrcode_server = new qrcode(); $data = array('content' => $url); $qrcode = $qrcode_server->create($data, -1); $img_url = is_array($qrcode) ? hg_fetchimgurl($qrcode) : ''; file_put_contents(CACHE_DIR . 'client_link.txt', $img_url); } parent::doset(); }
public function get_qrcode($data = array()) { include_once ROOT_PATH . 'lib/class/qrcode.class.php'; $qrcode_server = new qrcode(); return $qrcode_server->create($data, -1); }
public function qrcode($text) { include_once ROOT . DS . 'includes' . DS . 'libraries' . DS . 'qrcode.php'; $qr = new qrcode(); $qr->setText($text); $image = $qr->getImage(500); $root = $this->folder(); $file = 'qrcode-' . strtotime("now") . '.png'; $this->WriteFile(ROOT . DS . $root . $file, $image); return str_replace('\\', '/', $root . DS . $file); }
<?php if (isset($_POST['type'])) { //here we got all data from submitted form //we include class file include "qrcode.php"; //create an instance $qr = new qrcode(); //then we check what type of information user wanted to create qr code //to know what are possible types and what information needs to inserted, check the example file switch ($_POST['type']) { case "url": //then we use submitted information here, word inside $_POST[] brackets must match value of name attribute in the input field //<p>http://<input type='text' name='url' $qr->link($_POST['url']); break; case "txt": $qr->text($_POST['txt']); break; case "sms": $qr->sms($_POST['sms_phone'], $_POST["sms_text"]); break; case "bookmark": $qr->bookmark($_POST['mms_phone'], $_POST["mms_text"]); break; case "tel": $qr->phone_number($_POST['tel']); break; case "contactinfo": $qr->contact_info($_POST["contact_name"], $_POST["contact_address"], $_POST["contact_phone"], $_POST["contact_email"]); break;
img,body,html{border:0;} h1,h2,h3,h4,h5,h6{font-size:150%;} </style> </head> <body> <div style="background: #1359AE; height: 50px"> </div> <center><h2>WiFi clear-guest password QRCode</h2></center> <center> <?php include "qrcode.php"; $qr = new qrcode(); //bookmark $title = "antdz"; $url = "https://webauth-redirect.oracle.com/login.html?"; $password = trim(shell_exec('cat pass')); $param = "username=guest&password="******"&buttonClicked=4"; $url = $url . $param; $qr->bookmark($title, $url); //.......URL echo "<img src='" . $qr->get_link() . "'>"; //here is the way to output image //header("Content-type:image/png"); //echo $qr->get_image(); //and here is the way to force image download //$file = $qr->get_image(); //$qr->download_image($file)
<?php /** * Created by PhpStorm. * User: lasithniro * Date: 1/10/16 * Time: 12:59 AM */ include "qrcode.php"; $qr = new qrcode(); $transID = "easyID_002"; $studentName = "Lasith"; $paymentType = "Repeat exam fee"; $paymentStatus = "Completed"; $amount = '100.00'; $index = '13000829'; $str = "Transaction ID = {$transID} \n Student Index Number = {$index} \n Payment type = {$paymentType} \n Amount = {$amount} \n Payment Status = {$paymentStatus} \n "; $qr->text($str); echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>";
<?php /** * Created by PhpStorm. * User: lasithniro * Date: 1/8/16 * Time: 10:04 PM */ require_once 'core/init.php'; require_once 'fpdf/fpdf.php'; //include("qr/qrcode.php"); require_once 'qr/qrcode.php'; $qr = new qrcode(); ?> <!DOCTYPE html> <html lang="en"> <head> <title>Receipt</title> </head> </html> <?php /* * get session data */ $transID = $_SESSION['traID']; $studentName = $_SESSION['sName']; $paymentType = $_SESSION['pType']; $paymentStatus = $_SESSION['stts']; $amount = $_SESSION['amnt']; $index = $_SESSION['index'];
public function update_win_info() { $id = $this->input['sendno']; if (!$id) { $this->errorOutput('请刷新后,再试!'); } $user_id = $this->user['user_id']; if (!$user_id) { $this->errorOutput('请先登陆!'); } $sql = "SELECT id,prize_id,lottery_id FROM " . DB_PREFIX . "win_info WHERE sendno = '{$id}' AND confirm = 0"; $res = $this->db->query_first($sql); $wininfo_id = $res['id']; if (!$res || !$res['lottery_id']) { $this->errorOutput('网络超时,请刷新后,再试哦!'); } $data = array(); $sql = "SELECT score_limit,need_score,exchange_switch FROM " . DB_PREFIX . "lottery WHERE id = " . $res['lottery_id']; $data = $this->db->query_first($sql); if (empty($data)) { $this->errorOutput('活动异常,请稍后再试!'); } if ($data['score_limit'] && $data['need_score']) { include_once ROOT_PATH . 'lib/class/members.class.php'; $mem_obj = new members(); //同步会员积分 $credit_type = $mem_obj->get_trans_credits_type(); if (!empty($credit_type)) { $res1 = ''; $ac = 'sub_' . $credit_type['db_field']; $res1 = $mem_obj->{$ac}($user_id, $data['need_score'], $data['id'], APP_UNIQUEID, MOD_UNIQUEID, 'update_win_info', '抽奖扣除'); if (!$res1) { $this->errorOutput('您的积分不够啦,快去赚取积分吧!'); } } } $address = $this->input['address']; $phone_num = $this->input['phone_num']; $ip = hg_getip(); $up_data = array('device_token' => $this->input['device_token'], 'member_name' => $this->user['user_name'], 'member_id' => $user_id, 'confirm' => 1, 'status' => 1, 'ip' => $ip); if ($res['prize_id']) { $sql = "SELECT id,type,prize,seller_id,name FROM " . DB_PREFIX . "prize WHERE id = {$res['prize_id']}"; $prize_res = $this->db->query_first($sql); if (!$prize_res['id']) { $this->errorOutput('请刷新后,再试~'); } //锁止开关 if (!$this->settings['lock_stock']) { $sql = "UPDATE " . DB_PREFIX . "prize SET prize_win = prize_win + 1 WHERE id = " . $res['prize_id'] . " AND prize_win < prize_num"; $this->db->query($sql); //更新失败提示报错 if (!$this->db->affected_rows()) { $this->errorOutput('请刷新后,再试~'); } } //兑换码 $up_data['exchange_code'] = generateExchangeCode(); if ($this->settings['App_qrcode']) { include_once ROOT_PATH . 'lib/class/qrcode.class.php'; $qrcode_server = new qrcode(); $exchange_url = $this->settings['exchange_url'] . '?send_no=' . $id; $data_qrcode = array('content' => $exchange_url); $qrcode = $qrcode_server->create($data_qrcode, -1); $up_data['exchange_qrcode'] = is_array($qrcode) ? hg_fetchimgurl($qrcode) : ''; } $sync_fail_tag = false; if ($prize_res['type'] == 1) { $up_data['prize_type'] = 1; include_once ROOT_PATH . 'lib/class/members.class.php'; $mem_obj = new members(); //同步会员积分 $credit_type = $mem_obj->get_trans_credits_type(); if (!$credit_type['db_field']) { $ac = 'add_' . $credit_type['db_field']; $res1 = $mem_obj->{$ac}($user_id, intval($prize_res['prize']), $res['lottery_id'], APP_UNIQUEID, MOD_UNIQUEID, 'update_win_info', '抽奖加积分'); if (!$res1) { $sync_fail_tag = true; } else { $up_data['provide_status'] = 1; } } else { $sync_fail_tag = true; } } else { if ($prize_res['type'] == 0) { $up_data['prize_type'] = 2; } } if ($prize_res['seller_id']) { $up_data['seller_id'] = $prize_res['seller_id']; } //冗余奖品名称 if ($prize_res['prize']) { $up_data['prize_name'] = $prize_res['prize']; } elseif ($prize_res['name']) { $up_data['prize_name'] = $prize_res['name']; } } if ($address) { $up_data['address'] = $address; } if ($phone_num) { $up_data['phone_num'] = $phone_num; } $sql = "UPDATE " . DB_PREFIX . "win_info SET "; foreach ($up_data as $k => $v) { $sql .= " {$k} = '{$v}',"; } $sql = trim($sql, ','); $sql .= " WHERE sendno = '" . $id . "'"; $this->db->query($sql); $affect = $this->db->affected_rows(); if (!$affect) { $this->errorOutput('网络超时,请稍后再试~'); } //锁止开关 if ($this->settings['lock_stock']) { //删除库存锁止记录 $sql = "DELETE FROM " . DB_PREFIX . "stock_lock WHERE send_no = '" . $id . "'"; $this->db->query($sql); } //如果奖品是积分,同步会员积分 if ($prize_res['type'] == 1 && intval($prize_res['prize']) && $sync_fail_tag) { //同步失败,记录失败记录 $sync_fail = array('user_id' => $user_id, 'credits' => $prize_res['prize'], 'lottery_id' => $res['lottery_id'], 'wininfo_id' => $wininfo_id, 'create_time' => TIMENOW, 'update_time' => TIMENOW); $sql = " INSERT INTO " . DB_PREFIX . "sync_fail SET "; foreach ($sync_fail as $k => $v) { $sql .= " {$k} = '{$v}',"; } $sql = trim($sql, ','); $this->db->query($sql); $this->errorOutput('网络繁忙,积分暂未同步,请稍后到会员中心查看!'); } if ($this->input['tv_interact']) { return true; } else { $this->addItem('success'); $this->output(); } }
/************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com * Fee free to distribute and modify code, but keep reference to its creator * * This class generate QR [Quick Response] codes with proper metadata for mobile phones * using google chart api http://chart.apis.google.com * Here are sources with free QR code reading software for mobile phones: * http://reader.kaywa.com/ * http://www.quickmark.com.tw/En/basic/download.asp * http://code.google.com/p/zxing/ * * For more information, examples and online documentation visit: * http://webcodingeasy.com/PHP-classes/QR-code-generator-class **************************************************************/ include "qrcode.php"; $qr = new qrcode(); //link $qr->link("http://code-snippets.co.cc"); echo "<p>Link</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>"; //bookmark $qr->bookmark("WebcodingEasy.com", "http://webcodingeasy.com"); echo "<p>Bookmark</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>"; //text $qr->text("Any UTF8 characters like �ēū"); echo "<p>UTF8 text</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>"; //sms //First parameter - phone number //Second parameter - sms text
private function insertIntoOrder() { $orderparams['bill_header_content'] = $this->bill_header_content; $orderparams['order_id'] = generateOrderCode(); $orderparams['fid'] = 0; $orderparams['froder_id'] = ''; $orderparams['user_id'] = $this->user['user_id']; $orderparams['pay_credits'] = $this->GoodsValues['credits_value']; $orderparams['user_name'] = $this->user['user_name']; $orderparams['title'] = stripslashes($this->input['title']); $orderparams['brief'] = stripslashes($this->input['brief']); $orderparams['goods_value'] = $this->GoodsValues['goods_value']; $orderparams['order_value'] = $this->GoodsValues['total_value']; $orderparams['order_quantity'] = $this->GoodsValues['order_quantity']; $orderparams['delivery_fee'] = $this->GoodsValues['delivery_fee']; $orderparams['create_time'] = TIMENOW; $orderparams['title'] = $this->order_title; $orderparams['brief'] = $this->order_brief; $orderparams['order_client_type'] = ''; $orderparams['order_client_ip'] = hg_getip(); $orderparams['submit_time'] = TIMENOW; $orderparams['update_time'] = TIMENOW; $orderparams['goods_out_time'] = TIMENOW; $orderparams['pay_start_time'] = TIMENOW; $orderparams['pay_end_time'] = TIMENOW; $orderparams['goods_wait_time'] = TIMENOW; $orderparams['completed_time'] = TIMENOW; $orderparams['paymethod'] = $this->Paymethod; $orderparams['appid'] = $this->user['appid']; $orderparams['appname'] = trim($this->user['display_name']); $orderparams['ip'] = hg_getip(); foreach ($this->GoodsInfos as $bundle_id => $datas) { foreach ($datas as $k => $v) { if ($v['index_img']) { $orderparams['indexpic'] = urlencode(json_encode($v['index_img'])); //$orderparams['indexpic'] = serialize($v['index_img']); break; } } } // //商品为自取商品时,生成兑换码 // if(!$this->input['pick_up_way']) // { // $orderparams['exchange_code'] = generateExchangeCode(); // // include_once(ROOT_PATH . 'lib/class/qrcode.class.php'); // $qrcode_server = new qrcode(); // // $data = array('content'=>$orderparams['exchange_code']); // $qrcode = $qrcode_server->create($data,-1); // // $orderparams['exchange_qrcode'] = is_array($qrcode) ? hg_fetchimgurl($qrcode) : ''; // } $orderparams['telphone'] = $this->getphone(); $orderparams['id'] = $this->obj->insert($this->tbname, $orderparams); $orderparams['indexpic'] = json_decode(urldecode($orderparams['indexpic']), 1); //$orderparams['indexpic'] = serialize($v['index_img']); if ($orderparams['id']) { /****** 商品为自取商品时,生成兑换码 ******/ if (!$this->input['pick_up_way']) { $exchange_code = $this->input['verify_url'] ? $this->input['verify_url'] . '?id=' . $orderparams['id'] : generateExchangeCode(); include_once ROOT_PATH . 'lib/class/qrcode.class.php'; $qrcode_server = new qrcode(); $data = array('content' => $exchange_code); $qrcode = $qrcode_server->create($data, 1); $exchange_qrcode = is_array($qrcode) ? hg_fetchimgurl($qrcode) : ''; $rows = $this->obj->update($this->tbname, array('exchange_code' => $exchange_code, 'exchange_qrcode' => $exchange_qrcode), ' WHERE id=' . $orderparams['id']); if ($rows) { $orderparams['exchange_code'] = $this->input['verify_url'] ? '' : $exchange_code; $orderparams['exchange_qrcode'] = $exchange_qrcode; } } /****** 商品为自取商品时,生成兑换码 ******/ $this->Orderinfo = $orderparams; return $orderparams; } return false; }
<?php /************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com * Fee free to distribute and modify code, but keep reference to its creator * * This class generate QR [Quick Response] codes with proper metadata for mobile phones * using google chart api http://chart.apis.google.com * Here are sources with free QR code reading software for mobile phones: * http://reader.kaywa.com/ * http://www.quickmark.com.tw/En/basic/download.asp * http://code.google.com/p/zxing/ * * For more information, examples and online documentation visit: * http://webcodingeasy.com/PHP-classes/QR-code-generator-class **************************************************************/ include "qrcode.php"; $qr = new qrcode(); //link $qr->link("10-09-20"); echo "<p>Link</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>";
public function generarHtmlCertificado($imprimir, $codigoGenerado, $tituloCurso, $duracionEdicion, $fechaEdicion, $nombreFacilitador) { //Instanciando Librería para hacer el codigo QR. $GBD = new baseDatosGestor(); $miFondo = 'background: url("recursos/certificados/' . $this->_fondo . '") no-repeat'; $valorLogoExtra = $this->dameLogoExtra(); $qr = '<div id="qr"></div>'; if ($valorLogoExtra != 'ninguno') { $miLogoExtra = '<div class="logo"><img src="recursos/certificados/' . $this->_logoExtra . '"></img></div>'; } else { $miLogoExtra = ''; } $firmasExtras = $this->dameFirmasExtras(); if (empty($firmasExtras)) { $numeroDeFrimas = 1; } else { $numeroDeFrimas = count(explode('(#=P=#)', $firmasExtras)) + 1; } $tamanoTdFirma = 1000 / $numeroDeFrimas; $tamanoTdFirma = floor($tamanoTdFirma); $colFirmantes = explode('(#=P=#)', $firmasExtras); $tdFirmantes = ''; $tdFirmantesCargos = ''; $firmaFacilitador = $this->dameFirmaFacilitador(); list($calificativoFacilitador, $cargoFacilitador) = explode('(#=D=#)', $firmaFacilitador); $tdFirmantes .= '<td class="firmante">' . $calificativoFacilitador . ' ' . $nombreFacilitador . '</td>'; $tdFirmantesCargos .= '<td class="firmante">' . $cargoFacilitador . '</td>'; foreach ($colFirmantes as $firma) { list($calificativo, $nombre, $cargo) = explode('(#=D=#)', $firma); $tdFirmantes .= '<td class="firmante">' . $calificativo . ' ' . $nombre . '</td>'; $tdFirmantesCargos .= '<td class="firmante">' . $cargo . '</td>'; } foreach ($imprimir as $persona) { $nombre = $persona['nombre']; $documento = $persona['documento']; $tipo = $persona['tipo']; $idPersona = $persona['id']; if ($tipo == 'facilitador') { $datoTipo = 'COMO FACILITADOR'; } else { if ($tipo == 'participacion') { $datoTipo = 'POR SU PARTICIPACIÓN'; } elseif ($tipo > 59) { $datoTipo = 'POR APROBACIÓN'; } elseif ($tipo < 60 and $tipo > 0) { $datoTipo = 'POR PARTICIPACIÓN'; } elseif ($tipo == 0) { //NADA } else { exit("ERROR: NINGUN TIPO DE CERTIFICADO COINCIDE"); } } if ($tipo != 0 or $tipo == 'facilitador' or $tipo == 'participacion') { //link $explode = $GBD->dameURL(); $enlace = explode("?", $explode); $linkk = $enlace[0] . "verificacionCod.php?id=" . $codigoGenerado . "-" . $idPersona; qrcode::link($linkk); $link = qrcode::get_link(); $cuerpoRepetitivo .= '<div class="cuerpoCompleto"> <table class="cabesera"> <tr> <td class="lado" align="center"> <div class="logo"> <img src="recursos/logoUPTA.jpeg"></img> </div> </td> <td class="centro"> <p style="font-size: 20px; margin: 0px;" > REPÚBLICA BOLIVARIANA DE VENEZUELA<br/> MINISTERIO DEL PODER POPULAR PARA LA EDUCACIÓN UNIVERSITARIA<br/> UNIVERSIDAD POLITÉCNICA TERRITORIAL DEL ESTADO ARAGUA "FEDERICO BRITO FIGUEROA" <br/> </td> <td class="lado" align="center"> ' . $miLogoExtra . '</td> </tr> <tr> <td class="lado"> </td> <td class="centro" style="font-size: 22px;"> <br/><br/> <div class="tituloCurso"> OTORGA EL PRESENTE CERTIFICADO<br/> ' . $datoTipo . ' A: <br/><br/> <p style="font-size: 36px; margin: 0px;" >' . $nombre . ' </p> <p style="font-size: 32px; margin: 0px;" >' . $documento . '</p><br/> <p style="font-size: 32px; margin: 0px;">' . $tituloCurso . '</p> </div><br/> <p style="font-size: 20px; margin: 0px;">Venezuela - Estado Aragua<br/> DURACIÓN: ' . $duracionEdicion . '<br/> ' . $fechaEdicion . '</p> </td> <td class="lado"> </td> </tr> </table> <table class="firmas" style="font-size: 22px;"> <tr> ' . $tdFirmantes . ' </tr> <tr> ' . $tdFirmantesCargos . ' </tr> </table> <div class="codigoQR"> <img src=' . $link . ' border="0"/> </div> <table class="codigoGenerado"><tr><td><p style="font-size: 20px; margin: 0px;">Código Verificación: ' . $codigoGenerado . '-' . $idPersona . '</p></td></tr></table> </div>'; } } $htmlPDF = ' <html> <head> <script type="text/javascript" src="media/js/jquery/qrcode.js"></script> <style type="text/css"> body * { overflow: hidden; font-family: kartika; font-weight: bold; } @page { margin: 0px; } body { margin: 0px; ' . $miFondo . ' } div.cuerpoCompleto { margin: 0px; width: 1000px; height: 700px; } table { width: 1000px; padding: 50px; } div.tituloCurso { font-size: 16; } table.cabesera { position:absolute; left:0px; top:0px; } table.firmas { position:absolute; left:0px; top:600px; } div.logo { width: 150px; height: 120px; } table td.lado { padding-top:30px; width: 150px; height: 120px; } table td.centro { width: 700px; height: 100px; text-align: center; } table td.firmante { width: ' . $tamanoTdFirma . 'px; text-align: center; vertical-align: text-top; } table.codigoGenerado { position: absolute; top: 700px; left: 0px; width: 1100px; } div.codigoQR img{ position: absolute; top: 680px; float: right; right: 40%; } table.codigoGenerado td { text-align: center; } </style> </head> <body onload="update_qrcode()"> ' . $html1 . $cuerpoRepetitivo . ' </body> </html>'; return $htmlPDF; }