Jun092016
密码保护:php SQLite数据库核心类
<?php
if (! defined ( 'APPINC' ))
exit ( "Request Error!" );
/**
* 数据库类
* 说明:系统底层SQLite数据库核心类
*/
/**
*
* Db_SQLite
*
*/
class Db_SQLite
{
function __construct($file)
{
try
{
$this->connection=new PDO('sqlite:'.$file);
}
catch(PDOException $e)
{
try
{
$this->connection=new PDO...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php 给出姓名判断出性别的类(中文姓名识别率90%)
<?php
/**
* Gender Guesser
*
* This class can guess the gender of chinese names.
*
* Blog Entries: http://blog.wudilabs.org/tag/genderguesser/
* PHP Classes: http://www.phpclasses.org/browse/package/2701.html
*
* PHP versions 5
*
* LICENSE: This program is free software; you can redistribute it
* and/or modify it under the terms of th...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php加密解密类
<?php
class Encrypt {
public $key ='';
public $exptime = 5;
public function __construct($key = "", $exptime = 0) {
$this->key = $key;
$this->exptime = $exptime;
}
private function dechex2($int) { // 十进制转为二位16进制
if ($int < 0 or $int > 255) {
return "NN";
} else {
$ref = dechex ( $int );
$ref = strlen ( ...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php 文件缓存类
<?php
class Cache {
/**
* 读缓存
* @access public
* @param string $prefix 前缀
* @param string $key 键
* @param string $is_memcache 是否为memcache缓存
* @return string
*/
public function GetCache($prefix, $key)
{
$key = md5 ( $key );
$key = substr ( $key, 0, 2 ) . '/' . substr ( $key, 2, 2 )...阅读全文
要查看留言请输入您的密码。
Jun092016
Jun092016
密码保护:php 加密解密具有时效性的字符串
if (! function_exists ( 'EnExpiryPwd') ){
function EncodePass($tex,$key,$type="encode",$expiry=0){
$chrArr=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php文件下载函数
if (! function_exists ( 'DownFile') ){
function DownFile($file,$filename){
$file=realpath($file); //文件名
if(file_exists($file)){
Header("Content-type: text/html;charset=utf-8");
Header( "Content-type: application/octet-stream ");
Header( "Accept-Ranges: bytes ");
Header( "Accept-Length: " .filesize($file));
if(preg_match("...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php 版js escape 加密、解密过程
/**
* js escape 加密
* @param $string the sting want to be escaped
* @param $in_encoding
* @param $out_encoding
*/
if (! function_exists ( 'escape') ){
function escape($string, $in_encoding = 'UTF-8',$out_encoding = 'UCS-2') {
$return = '';
if (function_exists('mb_get_info')) {
for($x = 0; $x < ...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php随机生成8位密码
//随机生成8位密码
if (! function_exists ( 'GeneratePassword') ){
function GeneratePassword( $length = 8 ,$CharMix=false) {
$password = '';
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for ( $i = 0; $i < 2; $i++ )
{
$password .= $chars[ mt_rand(0, strlen($chars) - 1) ];
}
$chars = '01...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php 判断是不是ajax 提交
if (! function_exists ( 'isAjax' )) {
function isAjax() {
if (isset ( $_SERVER ['HTTP_X_REQUESTED_WITH'] )) {
if ('xmlhttprequest' == strtolower ( $_SERVER ['HTTP_X_REQUESTED_WITH'] ))
return true;
}
// else if (! empty ( $_POST ['ajax'] ) || ! empty ( $_GET ['ajax'] )) {
// return true;
//}
return false;
}
}
阅读全文
要查看留言请输入您的密码。