Jun092016
密码保护:php 分页类2
<?php
class SubPages
{
private $each_disNums;
//每页显示的条目数
private $nums;
//总条目数
private $current_page;
//当前被选中的页
private $sub_pages;
//每次显示的页数
private $pageNums;
//总页数
private $page_array = array();
//用来构造分页的数组
private $subPage_link;
//每个分页的链接...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php 文件上传类
<?php
/*
图片上传类;
版本:2016-06-09 beta;
本类支持多文件上传,图片生成略缩图,加水印,按日期生成目录的基本功能
调用例子:
控制器代码:
<?php
if ($_GET['action'] == 'save') {
$up = new upload(); //创建
$up->set_dir(dirname(__FILE__).'/upload/','{y}/{m}'); //保存路径,支持{y}{m}{d}这几个选项
$up->set_thumb(100,80...阅读全文
要查看留言请输入您的密码。
Jun092016
密码保护:php 数据效验类
<?php
/**
* 验证类
*/
class Validator {
/*
* 函数名称:isNumber
* 简要描述:检查输入的是否为数字
* 输入:string
* 输出:boolean
*/
public static function isNumber($val) {
if (preg_match ( "/^[0-9]+$/", $val ))
return TRUE;
return FALSE;
}
/*
* 函数名称:isPhone
* 简要描述:检查输入的...阅读全文
要查看留言请输入您的密码。
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
密码保护:php 防盗链
//防盗链
if (! function_exists ( 'ValidateHost') ){
function ValidateHost(){
if(!isset($_SERVER['HTTP_REFERER']) || (strpos($_SERVER['HTTP_REFERER'],"http://{$_SERVER['HTTP_HOST']}")===false))
{
exit("防盗链已启动!");
}
}
}
阅读全文
要查看留言请输入您的密码。
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("...阅读全文
要查看留言请输入您的密码。