This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function formattime($s) { | |
if(date('Y', $s) < date('Y')) { | |
return date('Y-n-d H:i', $s); | |
} elseif(date('G', $s) > date('G')) { | |
return date('n月d日 H:i', $s); | |
} | |
$limit = time() - $s; | |
if($limit < 60) { | |
return $limit . '秒前'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dir_writeable($dir) { | |
$writeable = 0; | |
if(!is_dir($dir)) { | |
@mkdir($dir, 0777); | |
} | |
if(is_dir($dir)) { | |
if($fp = @fopen("$dir/test.txt", 'w')) { | |
@fclose($fp); | |
@unlink("$dir/test.txt"); | |
$writeable = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isemail($email) { | |
return strlen($email) > 6 && strlen($email) <= 32 && preg_match("/^([A-Za-z0-9\-_.+]+)@([A-Za-z0-9\-]+[.][A-Za-z0-9\-.]+)$/", $email); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function size_format( $bytes, $decimals = 0 ) { | |
$quant = array( | |
// ========================= Origin ==== | |
'TB' => 1099511627776, // pow( 1024, 4) | |
'GB' => 1073741824, // pow( 1024, 3) | |
'MB' => 1048576, // pow( 1024, 2) | |
'kB' => 1024, // pow( 1024, 1) | |
'B ' => 1, // pow( 1024, 0) | |
); | |
foreach ( $quant as $unit => $mag ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 生成mysql数据字典 | |
*/ | |
header("Content-type: text/html; charset=utf-8"); | |
// 配置数据库 | |
$dbserver = "localhost"; | |
$dbusername = "mysql用户名"; | |
$dbpassword = "mysql密码"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::方便调试set cur_path = %cd% | |
e: | |
cd e:\www\CGBT2 | |
git checkout gh-pages | |
php e:\www\newcgbt_release\v2.0\tools\db_dict_generator.php | |
move C:\Users\Lee\Desktop\db_dict.html e:\www\CGBT2 | |
git add db_dict.html | |
git commit -am "generate database dict, %date:~0, 10%" | |
git push origin gh-pages | |
git checkout master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
from urllib import request | |
from urllib import parse | |
from http import cookiejar | |
username = 'your_username' | |
password = 'your_password' | |
login_url = 'https://fengcheco.com/auth/identity/callback' | |
project_id = 'your_project_id' | |
iteration_id = 'your_iteration_id' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require './source/class/class_core.php'; | |
$discuz = & discuz_core::instance(); | |
$discuz->init(); | |
$credit = & credit::instance(); | |
$sql = 'select uid from ' . DB::table('common_member'); | |
$users = DB::fetch_all($sql); | |
//重新计算用户积分 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* IP 地理位置查询类 | |
* | |
* @author joyphper | |
* @version 1.0 | |
* @copyright 2010 joyphper.net | |
*/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_G['mnid'] = 'mn_N'.substr(md5('your_link'), 0, 4); | |
//地址在discuz后台主导航里面找 |
OlderNewer