Hi, Guest! Soat:23:08
Home | Kirish | A`zo bo`lish
Php da saytga murojaatlar soni
Saytga murojaatlar soni

PhpMyAdmin da online baza yaratib olamiz

jadvalval ko`rinishi qo'yidagicha (rasm 1 da).

1-rasm

Index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Saytga murojaat</title>
</head>

<body>

<?php

function online () {
$ip=getenv("HTTP_X_FORWARDED_FOR");
if (empty($ip) || $ip=='unknown') { $ip=getenv("REMOTE_ADDR"); }


$select = mysql_query ("SELECT ip FROM online WHERE ip='$ip'") or die ("Can't select duble");
$tmp = mysql_fetch_row ($select);
if ($ip == $tmp[0]) {
mysql_query ("UPDATE online SET time=NOW() WHERE ip='$ip'") or die ("Can't update");
}

else

{
mysql_query ("INSERT INTO online (ip,time) VALUES ('$ip',NOW())") or die ("Can't insert");
}

$select = mysql_query ("SELECT COUNT(*) FROM online") or die ("Can't select result");
$tmp = mysql_fetch_row ($select);
$result = $tmp[0];

return $result;
}

echo "<p> Saytga murojaat jami: ".online()."</p>";



?>

</body>
</html>
Comments (0)
Home|FM|
Hozir saytdagilar: 0 / 1

JAVAUZ.NET 2014-2017 © Designed by BEST_MIX