Jump to content
katmai

Useri Online

Recommended Posts

Posted

Scriptul urmator..este cel mai simplu script de useri online....as minti daca as pune ca este 100% facut de mine...dar in mare parte da.


<?php
$remote = $_SERVER["REMOTE_ADDR"];
$file = "users/online.txt";
$timeoutseconds = 30;
$timestamp = time();
$timeout = ($timestamp-$timeoutseconds);
$fp = fopen("$file", "a+");
$write = $remote."||".$timestamp."\n";
fwrite($fp, $write);
fclose($fp);
$online_array = array();
$file_array = file($file);
foreach($file_array as $newdata){
list($ip, $time) = explode("||", $newdata);
if($time >= $timeout){
array_push($online_array, $ip);
}
}
$online_array = array_unique($online_array);
$online = count($online_array);
if($online == "1"){
echo "$online";
}else{
echo "$online";
}
?>

1.Creezi un folder users.

2.dupa aia mai un fisier online.txt ii dai la online.txt chmod 777

3.scriptul il incluzi intr-o pagina foarte simplu <? include("online.php"); ?>

Unde online.php este numele cum a fost salvat scriptul,dumneavoastra modificati cu numele ales de dumneavoastra.ENJOY! :idea:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...