Table of Contents
偏旁部首为“=$zidianArr['type']?>”的汉字
=$zidianArr['zi']?>
Home Backend Development PHP Tutorial 想在PHP程序加入base64_decode,防止别人采集,相应的位置不知道加在哪里,该怎么处理

想在PHP程序加入base64_decode,防止别人采集,相应的位置不知道加在哪里,该怎么处理

Jun 13, 2016 am 10:16 AM
gt lt mysql quot

想在PHP程序加入base64_decode,防止别人采集,相应的位置不知道加在哪里
想在PHP程序加入base64_decode,防止别人采集,相应的位置不知道加在哪里


图片上半部份是 ?id=数字。 好采集。
下半部分是通过是我想要的效果,
不知应该加在哪里

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $title = '新华字典'; //查询名称,不必修改$is_cache = 1; //缓存设置 1打开 0关闭$dbhost = xxx.com'; //MYSQL服务器【需配置】$dbname = 'acz'; //数据库名称【需配置】$dbuser = 'acz'; //数据库用户名【需配置】$dbpw = 'FKXwBDu'; //数据库密码【需配置】$tbname = 'zi'; //数据表名【需配置】function getlink($query){    global $dbhost,$dbuser,$dbpw,$dbname;    $link = mysql_connect($dbhost, $dbuser, $dbpw)        or die('无法连接: ' . mysql_error());    mysql_query("set character set 'utf8'");    mysql_select_db($dbname) or die('不能连接数据库!');    mysql_query("SET NAMES UTF8");    // 执行 SQL 查询    $result = mysql_query($query) or die('查询失败: ' . mysql_error());    return $result;}$bpa = "丨亅丿乛一乙乚丶八勹匕冫卜厂刀刂儿二匚阝丷几卩冂力冖凵人亻入十厶亠匸讠廴又艹屮彳巛川辶寸大飞干工弓廾广己彐彑巾口马门宀女犭山彡尸饣士扌氵纟巳土囗兀夕小忄幺弋尢夂子贝比灬长车歹斗厄方风父戈卝户火旡见斤耂毛木肀牛牜爿片攴攵气欠犬日氏礻手殳水瓦尣王韦文毋心牙爻曰月爫支止爪白癶歺甘瓜禾钅立龙矛皿母目疒鸟皮生石矢示罒田玄穴疋业衤用玉耒艸臣虫而耳缶艮虍臼米齐肉色舌覀页先行血羊聿至舟衣竹自羽糸糹貝采镸車辰赤辵豆谷見角克里卤麦身豕辛言邑酉豸走足青靑雨齿長非阜金釒隶門靣飠鱼隹風革骨鬼韭面首韋香頁音髟鬯鬥高鬲馬黄鹵鹿麻麥鳥魚鼎黑黽黍黹鼓鼠鼻齊齒龍龠"; //部首数组if($_POST['q']){ //搜索    $q = htmlspecialchars(trim($_POST['q']));}elseif($_GET['id']){    $id = $_GET['id'];    //$id = intval(base64_decode($_GET['id']));}elseif($_GET['list']){    $lst = intval($_GET['list']);}function getR($q){ //搜索    global $bpa,$tbname;    if(preg_match("/^[A-Za-z]+$/",$q)){ //如果搜的拼音        $sql = "select id,zi from ".$tbname." where py = '".strtolower($q)."' limit 150";    }else{        $sql = "select id,zi from ".$tbname." where zi like '%".$q."%' limit 150";    }    $result = getlink($sql);    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {        $res[] = $line;    }    if(count($res)==1) header("location: ?id=".$res[0]['id']);    return $res;}function getArr($num,$t=0){ //获取缓存的数据    if($t==0){        $furl = "cache\\".floor(($num-1)/1000)."\\";    }else{        $furl = 'cache\\';    }    $filename = $furl.$num.".txt"; //缓存文件名    if(file_exists($filename)){        return unserialize(@file_get_contents($filename));    }else{        return false;    }}function cacheArr($num,$arr,$t=0){ //将数据存下来    if($t==0){        $furl = "cache\\".floor(($num-1)/1000)."\\";    }else{        $furl = 'cache\\';    }    $filename = $furl.$num.".txt"; //缓存文件名    if(!file_exists($furl)){ //创建文件夹        if(!file_exists("cache\\") && $t==0){            mkdir("cache\\", 0777);        }        mkdir($furl, 0777);    }    $t=serialize($arr);    $fp = @fopen($filename,"w");    @fwrite($fp,$t);    @fclose($fp);}function listzidian($id){ //列表    global $bpa,$tbname,$is_cache;    if($is_cache==1){        $c = getArr($id,1);        if($c!=false) return $c;    }    $pos = substr($bpa,$id*3-3,3);    if($pos==""){        $sql = "select id,zi,bihua from ".$tbname." where bushou='难检字' or bushou='' order by bushou";        $res['type'] = "难检字";    }else{        $sql = "select id,zi,bihua from ".$tbname." where bushou='".$pos."' order by bushou";        $res['type'] = $pos;    }    $result = getlink($sql);    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {        $res[] = $line;    }    if($is_cache==1){        cacheArr($id,$res,1);    }    return $res;}function zidian($id){ //某个ID    global $is_cache,$tbname;    if($is_cache==1){        $c = getArr($id);        if($c!=false) return $c;    }    $sql = "select * from ".$tbname." where id=".$id." limit 1";    $result = getlink($sql);    $line = mysql_fetch_array($result, MYSQL_ASSOC);    if(!isset($line['zi'])) return false;    $nsql = "select id,zi from ".$tbname." where id=".($id-1)." or id=".($id+1);    $nresult = getlink($nsql);    if($id==1){        $line[1] = null;        $line[2] = mysql_fetch_array($nresult, MYSQL_ASSOC);    }elseif($id==31715){        $line[1] = mysql_fetch_array($nresult, MYSQL_ASSOC);        $line[2] = null;    }else{        $line[1] = mysql_fetch_array($nresult, MYSQL_ASSOC);        $line[2] = mysql_fetch_array($nresult, MYSQL_ASSOC);    }        if($is_cache==1){        cacheArr($id,$line);    }    return $line;}if($q){ //搜索    $zidianArr = getR($q);    if(count($zidianArr)==1) header("location: ?id=".$zidianArr[0]['id']);    $cha_title = $q." 的汉字搜索结果 - ".$title;    $zidianStatus = 1;}elseif(isset($lst)){ //列表    if($lst<1) header("location: ./");    $zidianArr = listzidian($lst);    $cha_title = "偏旁部首为“".$zidianArr['type']."”的汉字 - ".$title;    $zidianStatus = 2;}elseif(isset($id)){ //某ID    $zidianArr = zidian($id);    if(!isset($zidianArr['zi'])) header("location: ./");    $cha_title = $zidianArr['zi']." - ".$title;    $zidianStatus = 3;}else{    $zidianStatus = 0;    $cha_title = $title;}?><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>=$cha_title?></title><div align="center">
<table cellspacing="0" cellpadding="0" width="778" border="0"><tr><td align="left" style="padding:10px 0"><a href="http://zidian.911cha.com/" class="ttitle">新华字典</a></td></tr></table>
<table width="778" cellpadding="2" cellspacing="0" style="border:1px solid #B2D0EA;" id="top">
<tr><td style="background:#EDF7FF;padding:0 5px;color:#014198;" height="26" valign="middle" colspan="5">
<a href="http://www.911cha.com/">实用查询</a> > <a href="./">新华字典</a>
</td></tr>
<tr><td align="center" valign="middle" height="60"><form action="index.php" method="post" name="f1">
<input name="q" id="q" type="text" size="18" delay="0" value="" style="width:300px;height:22px;font-size:16px;font-family: Geneva, Arial, Helvetica, sans-serif;" onmouseover="this.focus();"> <input type="submit" value=" 查询 "><br>查找汉字<span style="color:blue">卐</span>,直接输入<span style="color:blue">卐</span>,或其拼音<span style="color:blue">wan</span>即可</form></td></tr>
</table>
<br> if($zidianStatus==0){ ?> }elseif($zidianStatus==1){ //搜索 ?><table width="778" cellpadding="2" cellspacing="0" style="border:1px solid #B2D0EA;">
<tr><td style="background:#EDF7FF;padding:0 5px;color:#014198;" height="26" valign="middle" colspan="5">
<a href="./">新华字典</a> > “=$q?>”的汉字搜索结果</td></tr>
<tr><td style="padding:8px;font-size:14px;"> if(count($zidianArr)==0){        if(preg_match("/^[\x{4e00}-\x{9fa5}]+$/u",$q)){ //全为中文            echo '<p class="f14">你输入了一个以上汉字,请输入一个汉字后查询!</p>';            echo '<p class="f14">或者:</p>';            echo '<p class="f14">  在 <a href="http://cidian.911cha.com/" class="f14" target="_blank">汉语词典</a> 里查找“<a href="http://cidian.911cha.com/q_'.urlencode(%24q).'" class="f14" target="_blank">'.$q.'</a>”的解释</p>';            echo '<p class="f14">  在 <a href="http://chengyu.911cha.com/" class="f14" target="_blank">成语词典</a> 里查找“<a href="http://chengyu.911cha.com/q_'.urlencode(%24q).'" class="f14" target="_blank">'.$q.'</a>”的解释</p>';            echo '<p class="f14">  在 <a href="http://baike.911cha.com/" class="f14" target="_blank">百科全书</a> 里查找“<a href="http://chengyu.911cha.com/q_'.urlencode(%24q).'" class="f14" target="_blank">'.$q.'</a>”的解释</p>';        }else{            echo '<p class="pink f14">你查询的不全为汉字,请剔除掉非汉字字符后再进行查询!<a href="./" class="f14">回'.$title.'首页</a></p>';        }}else{    if(count($zidianArr)>=150) echo '<p class="f14 pink">返回结果数过多,仅列出前150个,请输入更准确的关键字进行搜索!</p>
<hr size="1" noshade>';    echo '<p style="line-height:200%">';    for($i=0;$i<count echo href="'.%24zidianArr%5B%24i%5D%5B'id'%5D.'.html" target="_blank">'.$zidianArr[$i]['zi'].' ';    }    echo '</count></p>';}?></td></tr>
</table> }elseif($zidianStatus==2){ //列表 ?><table width="778" cellpadding="2" cellspacing="0" style="border:1px solid #B2D0EA;">
<tr><td style="background:#EDF7FF;padding:0 5px;color:#014198;" height="26" valign="middle" colspan="5">
<a href="./">新华字典</a> > 偏旁部首为“=$zidianArr['type']?>”的汉字</td></tr>
<tr><td style="padding:8px;font-size:14px;">
<h1 id="偏旁部首为-zidianArr-type-gt-的汉字">偏旁部首为“=$zidianArr['type']?>”的汉字</h1>    $bb = 0;    for($i=0;$i<count if>$bb){            if($i>0) echo '';            echo '<p class="f14 b">笔画数'.$zidianArr[$i]['bihua'].':';            $bb = $zidianArr[$i]['bihua'];        }        echo '<a href="'.%24zidianArr%5B%24i%5D%5B'id'%5D.'.html" target="_blank" class="f14">'.$zidianArr[$i]['zi'].'</a> ';    }?></p></count>
</td></tr>
</table> }elseif($zidianStatus==3){ //某个ID ?><table width="778" cellpadding="2" cellspacing="0" style="border:1px solid #B2D0EA;">
<tr><td style="background:#EDF7FF;padding:0 5px;color:#014198;" height="26" valign="middle" colspan="5">
<a href="./">新华字典</a> >     $pos = strpos($bpa,$zidianArr['bushou']);    if ($pos === false){        echo '<a href="?list=268">部首: 难检字</a>  > ';    }else{        $pos=$pos/3+1;        echo '<a href="?list='.%24pos.'">部首: '.$zidianArr['bushou'].'</a>  > ';    }?>=$zidianArr['zi']?></td></tr>
<tr><td style="padding:8px;font-size:14px;word-break:break-all;">
<h1 id="zidianArr-zi-gt">=$zidianArr['zi']?></h1>    if($zidianArr['pinyin']){ echo '<p><strong><a href="http://pinyin.911cha.com/" target="_blank">拼音</a></strong> '.$zidianArr['pinyin'].'</p>'; }    if($pos === false){        echo '<p><strong>部首</strong> <a href="?list=268" class="f14">难检字</a></p>';    }else{        echo '<p><strong>部首</strong> <a href="?list='.%24pos.'" class="f14">'.$zidianArr['bushou'].'</a></p>';    }    if($zidianArr['wubi']){ echo '<p><strong><a href="http://wubi.911cha.com/" target="_blank">五笔</a></strong> '.$zidianArr['wubi'].'</p>'; }    if($zidianArr['bihua']){ echo '<p><strong><a href="http://bihua.911cha.com/" target="_blank">笔画</a></strong> '.$zidianArr['bihua'].'</p>'; }    if($zidianArr['lizi']){ echo '<p><strong>例子</strong> '.$zidianArr['lizi'].'</p>'; }    if($zidianArr['jijie']){ echo '<hr size="1" noshade>
<p><strong>基本解释</strong><br>'.$zidianArr['jijie'].'</p>'; }    if($zidianArr['xiangjie']){ echo '<hr size="1" noshade>
<p><strong>详细解释</strong><br>'.$zidianArr['xiangjie'].'</p>'; }    ?></td></tr>
</table> } ?></div><div class="clear">
                 
              
              
        
            </div>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

How to open phpmyadmin How to open phpmyadmin Apr 10, 2025 pm 10:51 PM

You can open phpMyAdmin through the following steps: 1. Log in to the website control panel; 2. Find and click the phpMyAdmin icon; 3. Enter MySQL credentials; 4. Click "Login".

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

How to use single threaded redis How to use single threaded redis Apr 10, 2025 pm 07:12 PM

Redis uses a single threaded architecture to provide high performance, simplicity, and consistency. It utilizes I/O multiplexing, event loops, non-blocking I/O, and shared memory to improve concurrency, but with limitations of concurrency limitations, single point of failure, and unsuitable for write-intensive workloads.

MySQL and SQL: Essential Skills for Developers MySQL and SQL: Essential Skills for Developers Apr 10, 2025 am 09:30 AM

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

MySQL's Place: Databases and Programming MySQL's Place: Databases and Programming Apr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

Monitor Redis Droplet with Redis Exporter Service Monitor Redis Droplet with Redis Exporter Service Apr 10, 2025 pm 01:36 PM

Effective monitoring of Redis databases is critical to maintaining optimal performance, identifying potential bottlenecks, and ensuring overall system reliability. Redis Exporter Service is a powerful utility designed to monitor Redis databases using Prometheus. This tutorial will guide you through the complete setup and configuration of Redis Exporter Service, ensuring you seamlessly build monitoring solutions. By studying this tutorial, you will achieve fully operational monitoring settings

See all articles