<?php
header('Content-Type: text/html; charset=utf-8');
// Скрипт проверки
# Соединямся с БД
require_once "connect_to_mysql.php";
$color = "red";
if (isset($_COOKIE['id']) and isset($_COOKIE['hash']))
{
$query = mysql_query("SELECT *,INET_NTOA(user_ip) AS user_ip FROM users WHERE user_id = '".intval($_COOKIE['id'])."' LIMIT 1");
$userdata = mysql_fetch_assoc($query);
if(($userdata['user_hash'] !== $_COOKIE['hash']) or ($userdata['user_id'] !== $_COOKIE['id'])
or (($userdata['user_ip'] !== $_SERVER['REMOTE_ADDR']) and ($userdata['user_ip'] !== "0")))
{
setcookie("id", "", time() - 3600*24*30*12, "/");
setcookie("hash", "", time() - 3600*24*30*12, "/");
print "Сбой в системе";
}
else
{
print "<span style='color: #27cd27'>Привет, ".$userdata['user_login'].". Добро пожаловать!</span>";
}
}
else
{
print "Включите куки";
}
$userdata = $_POST['user_login'];
echo $userdata['user_login']
?>
<html>
<body>
<BODY BGCOLOR="black">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0"
width="1280" height="1024" id="fullscreen" align="middle">
<param name="allowFullScreen" value="true" />
<param name="movie" value="chats.swf" />
<param name="bgcolor" value="#000000" />
<embed src="chats.swf" allowFullScreen="true" bgcolor="#000000" width="1280" height="1024"
name="fullscreen" align="middle" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
Как закрыть куки по нажатию кнопки?) Разлогиниться короч. Или как лучше переделать под сессию