Exemplo n.º 1
0
    $difference = time() - $timestamp;
    //echo "<br>".$difference."<br>";
    return $difference;
}
include "whoisonline_config.php";
include "dbclass.php";
$count = 0;
if ($_SESSION['entrytime'] == "") {
    $_SESSION['entrytime'] = time();
}
if (file_exists("install.php")) {
    echo "Who Is Online Security:<br>Please Remve <b>install.php</b>.";
    exit;
}
$db1 = new dbClass();
$db1->setDBVars($dbhost, $dbname, $dbuser, $dbpass);
$db1->openConnection();
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "SELECT COUNT(*) FROM `{$dbname}`.`{$dbtable}` WHERE `ip`='{$ip}';";
$rowOut = $db1->queryRowArray($sql);
$ip_exists = $rowOut[0];
if ($ip_exists > 0) {
    $sql = "SELECT COUNT(*) FROM `{$dbname}`.`{$dbtable}`";
    $rowOut = $db1->queryRowArray($sql);
    $count = $rowOut[0];
} else {
    $db1->execCommand("INSERT INTO `{$dbname}`.`{$dbtable}` (`ip`) VALUES ('{$ip}');");
    $sql = "SELECT COUNT(*) FROM `{$dbname}`.`{$dbtable}`;";
    $rowOut = $db1->queryRowArray($sql);
    $count = $rowOut[0];
}