凉风有信,秋月无边
亏我思娇的情绪、好比度日如年

villain的文章

thinkphp调用全部内容php代码

<?php error_reporting(0); header(“content-Type: text/html; charset=utf-8”); $con = mysql_connect(‘127.0.0.1:3306′,’root’,’password’);if (!$con) {die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db(“sql_name”, $con); mysql_query(‘set names utf8’);echo “资讯<HR>”; $result = mysql_query(“SELECT * FROM thinkoao_article”);while($row = mysql_fetch_array($result)) {// echo ‘<a href=”https://www.xxx.com/home/article/zixun_news/id/’.$row[‘id’].’.html” target=”_blank”>’.$row[‘title’].'</a><BR>’;echo ‘https://www.xxx.com/home/article/zixun_news/id/’.$row[‘id’].’.html<BR>’;}echo “课程<HR>”; $result = “”; $result = mysql_query(“SELECT * FROM thinkoao_course”);while($row = mysql_fetch_array($result)) {//echo ‘<a href=”http://www.xxx.com/home/course/course/id/’.$row[‘id’].’.html” target=”_blank”>’.$row[‘course_name’].'</a><BR>’;echo ‘http://www.xxx.com/home/course/course/id/’.$row[‘id’].’.html<BR>’;} mysql_close($con);?>  

赞(0)villainvillain技术笔记 阅读(51)去评论

帝国cms实现php代码调用内容图片链接_帝国cms读取数据库所有图片地址

<?php $str=stripcslashes($navinfor['newstext']); //脱敏正文newstext数据preg_match_all('/<img.*?src="(.*?)".*?>/is',$str,$imgArr); //正则提取正文图片 $imgArr = array_unique($imgArr[1]); //图片如有复生将去重复 $imgid = 0; //给定初始序号 foreach($imgArr as $vause){ //判断有多少张图 $imgid ++; //循环输出每一张图 ?><div lang="[!--class.name--][!--newstime--][!--title--]" draggable="[!--class.name--][!--newstime--][!--title--]" ><img src="<?=$vause?>" alt="<?=$navinfor['title']?>第<?=$imgid?>张图片"></div><ins lang="[!--class.name--][!--newstime--][!--title--]"></ins><?php }; ?> 调用纯文字内容代码: <?php $str="sadfasfsdf<img src='dd'>asfsd"; $smalltext=preg_replace("/<img.*?>/si","",$navinfor[newstext]);echo $smalltext; ?>  

赞(0)villainvillain技术笔记 阅读(50)去评论

帝国cms调用自定义字段php代码

比较实用,可以调用数据库里的所有图片字段内容 <?php require('../e/class/connect.php'); //引入数据库配置文件和公共函数文件 require('../e/class/db_sql.php'); //引入数据库操作文件 require('../e/data/dbcache/class.php'); //引入栏目缓存文件 $link=db_connect(); //连接MYSQL $empire=new mysqlquery(); //声明数据库操作类 $editor=1; //声明目录层次 $sql=$empire->query("select * from {$dbtbpre}ecms_shop order by newstime limit 1000"); //查询新闻表最新10条记录 $totalquery="select count(*) as total from {$dbtbpre}ecms_shop"; $num=$empire->gettotal($totalquery); $i=1; ?> <?=$num?><br /> <?php while($r=$empire->fetch($sql)) //循环获取查询记录 { ?> <?=$r[titlepic]?>-----[id]<?=$r[id]?>---[classid]<?=$r[classid]?>---<?=$i++?><br/> <?php } ?> <?php db_close(); //关闭MYSQL链接 $empire=null; //注消操作类变量 ?>  

赞(0)villainvillain技术笔记 阅读(77)去评论

帝国cms模板中使用PHP实现随机字符的方法

做站的站长很多时候买个模板就直接用,对于模板的一些小优化这类知道的很少,下面来说说如何在模板中使用随机字符来提供模板的唯一性和原创程序。 方法1: 第一种方法是最容易理解的方法。它可以实现如下: 将所有可能的字母存储到字符串中,生成从0到字符串长度-1的随机索引,打印该索引处的字母,执行此步骤n次(其中n是所需字符串的长度)。 程序代码如下: <?php $n=10;function getName($n) {     $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';     $randomString = '';         for ($i = 0; $i < $n; $i++) {         $index = rand(0, strlen($characters) - 1);         $randomString .= $characters[$index];     }         return $randomString; }     echo getName($n);?> 说明这里面最开始的10是字符的长度,可以随意修改。 方法2: 使用uniqid()函数。PHP中的uniqid()函数是一个内置函数,用于根据当前时间(微秒)生成唯一ID。默认情况下,它返回一个13个字符长的唯一字符串。 一次生成13个不一样的字符,减少重复。根据时间来的。 程序: <?php $result = uniqid(); echo $result; ?> 一般模板中直接插入这两段代码就可以直接用了,非常的简便 。 以上就是在帝国cms模板中插入随机字符的方法和代码实例了。

赞(0)villainvillain技术笔记 阅读(48)去评论

帝国cms模板内容页用到的if判断语句

判断代码如下 <?php   if($navinfor[xb]==帅哥)   { ?><DIV class="xbox nan"> <? } else { echo "<DIV class=xbox>"; }   ?>     <?php if($navinfor['titlepic']) { ?> <a href='[!--titlepic--]' target='_blank'><img src='[!--titlepic--]' /></a> <? } else { ?>   <? } ?> 亲测有效!!

赞(0)villainvillain技术笔记 阅读(52)去评论
Navicat已经成功连接,忘记密码的解决方法-Villain博客

Navicat已经成功连接,忘记密码的解决方法

去到对应的注册表 查找Navicat的密码保存位置 去到对应的路径下面 计算机\HKEY_CURRENT_USER\Software\PremiumSoft 可以看到 打开对应的目录,寻找一下servers下要找的数据库,如我要找阿里云的密码 寻找pwd找出来,复制数据     去到 https://tool.lu/coderunner/ 复制黏贴一下php解密的代码 <?php namespace FatSmallTools; class NavicatPassword {     protected $version = 0;     protected $aesKey = 'libcckeylibcckey';     protected $aesIv = 'libcciv libcciv ';     protected $blowString = '3DC5CA39';     protected $blowKey = null;     protected $blowIv = null;     public function __construct($version = 12)     {         $this->version = $version;         $this->blowKey = sha1('3DC5CA39', true);         $this->blowIv = hex2bin('d9c7c3c8870d64bd');     }     public function encrypt($string)     {         $result = FALSE;         switch ($this->version) {             case 11:                 $result = $this->encryptEleven($string);                 break;             case 12:                 $result = $this->encryptTwelve($string);                 break;             default:                 break;         }         return $result;     }     protected function encryptEleven($string)     {         $round = intval(floor(strlen($string) / 8));         $leftLength = strlen($string) % 8;         $result = '';         $currentVector = $this->blowIv;         for ($i = 0; $i < $round; $i++) {             $temp = $this->encryptBlock($this->xorBytes(substr($string, 8 * $i, 8), $currentVector));             $currentVector = $this->xorBytes($currentVector, $temp);             $result .= $temp;         }         if ($leftLength) {             $currentVector = $this->encryptBlock($currentVector);             $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);         }         return strtoupper(bin2hex($result));     }     protected function encryptBlock($block)     {         return openssl_encrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);      }     protected function decryptBlock($block)     {         return openssl_decrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);      }     protected function xorBytes($str1, $str2)     {         $result = '';         for ($i = 0; $i < strlen($str1); $i++) {             $result .= chr(ord($str1[$i]) ^ ord($str2[$i]));         }         return $result;     }     protected function encryptTwelve($string)     {         $result = openssl_encrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);         return strtoupper(bin2hex($result));     }          public function decrypt($string)     {         $result = FALSE;         switch ($this->version) {             case 11:                 $result = $this->decryptEleven($string);                 break;             case 12:                 $result = $this->decryptTwelve($string);                 break;             default:                 break;         }         return $result;     }          protected function decryptEleven($upperString)     {         $string = hex2bin(strtolower($upperString));         $round = intval(floor(strlen($string) / 8));         $leftLength = strlen($string) % 8;         $result = '';         $currentVector = $this->blowIv;         for ($i = 0; $i < $round; $i++) {             $encryptedBlock = substr($string, 8 * $i, 8);             $temp = $this->xorBytes($this->decryptBlock($encryptedBlock), $currentVector);             $currentVector = $this->xorBytes($currentVector, $encryptedBlock);             $result .= $temp;         }         if ($leftLength) {             $currentVector = $this->encryptBlock($currentVector);             $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);         }         return $result;     }          protected function decryptTwelve($upperString)     {...

赞(0)villainvillain技术笔记 阅读(52)去评论