session_start(); require "function.php"; function MemSearch($name, $id=0){ $mem_arr = file(MEMBER); foreach($mem_arr as $info){ list($uname,$uh,$uti,$uid) = explode("\t", $info); if(($id != 0)&&($name == $uname)&&($id == $uid)) return 1; if(($id == 0)&&($name == $uname)) return 1; } return 0; } function NameVerify($name,$id){ if(isset($name)) $name = trim($name); if((!isset($name)) || (strlen($name)==0)) error("名前を入力してくださいね"); if((!MemSearch($name, $id)) && MemSearch($name)) error("その名前はすでに使われていますよ"); } function Login($name,$email,$ncolor,$retime){ $addr = getenv("REMOTE_ADDR"); $host = @gethostbyaddr($addr); $id = session_id(); $cookie_data = implode("\t",array($name,$email,$retime,$ncolor)); Setcookie("chat_cook", $cookie_data, time()+14*24*3600); if(HOST==2){ $in_host = " [".$host."]"; }elseif(HOST==1){ $in_host = ""; } NameVerify($name,$id); $in_date = DatePrint(time()); $msg = JOINA."".$name."".JOINB.$in_host.$in_date.HR; WriteLog($msg); } function LogOut($name,$ncolor){ $name = CleanStr($name); $out_date = DatePrint(time()); $msg = EXITA."".$name."".EXITB.$out_date.HR; WriteLog($msg); ShowHeader(); echo '