View file darkworld/files/who.php

File size: 1.96Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);

$log = htmlspecialchars(stripslashes($log));
$pas = htmlspecialchars(stripslashes($pas));
/////////////////////////////////////////////////////
$text = @file("data/reg/$log.dat"); 
if ($text!=""){
$udata = explode(":||:",$text[0]);
$login=trim($udata[0]);
$password=trim($udata[1]);}
////////////////////////////////////////////////////////
if (md5($pas)==$password && $log==$login && $log!=="" && md5($pas)!=="") {

$who_lastusers="20"; // не советую много писать
$ip=$_SERVER['REMOTE_ADDR'];

$u1=getenv('HTTP_USER_AGENT');
$brow=strtok($u1,'/');

$ip=htmlspecialchars(stripslashes($ip));
$brow=htmlspecialchars(stripslashes($brow));



$log=$_GET['log'];

$log=str_replace("\\","",$log);
$log=str_replace("/","",$log);
$log=str_replace("|","",$log);
$log=str_replace("$","",$log);
$log=str_replace("&","",$log);
$log=str_replace("<","",$log);
$log=str_replace(">","",$log);

if(!empty($log)){ 

$lines=file("data/who.dat");
$count=count($lines);
for ($b=0; $b<$count; $b++) { list($sinbase)=explode("|",$lines[$b]); if ( $log == "$sinbase") { $del=$b;

$fp=fopen("data/who.dat","w");
flock ($fp,LOCK_EX);
unset($lines[$del]);
fputs($fp, implode("",$lines));
flock ($fp,LOCK_UN);
fclose($fp);} }
$time=time(); 

$self = $_SERVER['SCRIPT_NAME'];
$log2=$_GET['log'];

$log2=str_replace("\\","",$log2);
$log2=str_replace("/","",$log2);
$log2=str_replace("$","",$log2);
$log2=str_replace("&","",$log2);
$log2=str_replace("<","",$log2);
$log2=str_replace(">","",$log2);
$log2=str_replace("|","",$log2);

$ttt="$log2|$self|$time";

$fp = @fopen("data/who.dat","a+");
flock ($fp,LOCK_EX);
@fputs($fp,"$ttt\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
@fclose($fp);

$file=file("data/who.dat"); $i = count($file);
if ($i>=$who_lastusers) {
$fp=fopen("data/who.dat","w");
flock ($fp,LOCK_EX);
unset($file[0]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);}}else{exit ;}


}

?>