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's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

Solve database connection problem: a practical case of using minii/db library Solve database connection problem: a practical case of using minii/db library Apr 18, 2025 am 07:09 AM

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

How to install mysql in centos7 How to install mysql in centos7 Apr 14, 2025 pm 08:30 PM

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

Centos install mysql Centos install mysql Apr 14, 2025 pm 08:09 PM

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

See all articles