ホームページ  >  記事  >  バックエンド開発  >  PHP_PHP チュートリアルに実装されたオンライン人事関数ライブラリ

PHP_PHP チュートリアルに実装されたオンライン人事関数ライブラリ

WBOY
WBOYオリジナル
2016-07-21 15:52:38851ブラウズ


//ユーザーを追加します
function AddUser($username){
global $db;
$Ip=getenv('HTTP_X_FORWARDED_FOR');
if ( ($Ip1 != "") ) && ($Ip1 != "unknown")) $Ip=$Ip1;
$current_time=date("Y-m-d H:i:s");
$SQL="user='$username' のクラスからユーザーを選択"; "
$res=mysql_query($SQL,$db); "
$row=@mysql_num_rows($res); "
if($row==0) { " ) value('$username','$ Ip','$current_time')";
mysql_query($SQL,$db);
}
}
//オンライン ユーザー リストを更新します
function UpdateMember(){
global $ db;
$SQL="から削除class_online where UNIX_TIMESTAMP()-UNIX_TIMESTAMP(lasttime)>180"; // 3 分間非アクティブ状態が続いたら終了
//echo $SQL; } 新 // オンライン ステータスを更新
Function Updateonline ($ username) {
global $ db;
$ Current_time = Date ("y-m-d h: s"); et lasttime = '$ Current_time ' where user='$username'";
$res=mysql_query($SQL,$db);
}
//ユーザーを削除
function OutOneUser($user){
global $db;
$SQL="user='$user'" からの削除
mysql_query($SQL,$db);
//Checkオンラインかどうか
function CheckUser($user){
global $db;
$SQL=" select user from class_online where user='$user'";
$res=mysql_query($SQL,$db); row=mysql_num_rows($res);
if($row>0) return true;
else return false;
//オンラインリストを取得します
function ReadOnlineName(){
global $db; mysql_fetch_array($res)){
$result[]=$row[user]
}
return $result;
//**************** * *オンラインスタッフ機能ライブラリ******************終了



http://www.bkjia.com/PHPjc/318893.html

www.bkjia.com

tru​​e

http://www.bkjia.com/PHPjc/318893.html

技術記事

// ユーザーを追加 functionAddUser($username){ $Ip=getenv('REMOTE_ADDR') $Ip1=getenv('HTTP_X_FORWARDED_FOR');不明"))$Ip=$Ip1; $current_time=date("や...

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。