Просмотр файла go.php

Размер файла: 1.96Kb
<?php
@session_start();
require_once $_SERVER['DOCUMENT_ROOT']."/includes/start.php";

if(isset($_GET['exit'])){
if(isset($_SESSION['auth']) and $_SESSION['auth']==1){

unset($_SESSION['login']);
unset($_SESSION['auth']);
unset($_SESSION['password']);

$text = '<font color=#000><u>'.$login.'</u></font> <font color=#FF0000>прощается с нами и уходит.</font>';
mysql_query( "Insert into msg set id=0, rm='1', from_id='1', for_id='', text='".$text."', type='welMSG', time='".date("H:i:s")."'" );


///3KZO прощается с нами и уходит.

header ("Location: /?"); exit;

}else{

header ("Location: /?"); exit;

}}


if(isset($_GET['enter'])){
if(!isset($_SESSION['auth']) and $_SESSION['auth']!==1){

$login=$_POST['login']; $password=$_POST['password'];

$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE login='$login' and password='$password'"));
if(empty($user)){
echo $_up;

echo '
<dt><b>Авторизация</b></dt>
<dt>Ошибочные данные!</dt>
» <a href="/">На главную</a></dt>';

echo $_down;
}else{

$_SESSION['login']=$login;
$_SESSION['password']=$password;
$_SESSION['auth']=1;

$text = '<font color=#000><u>'.$login.'</u></font> <font color=#FF0000>входит в чат. Поприветствуем!</font>';
mysql_query( "Insert into msg set id=0, rm='1', from_id='1', for_id='', text='".$text."', type='welMSG', time='".date("H:i:s")."'" );

$usr = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE login='$login' and password='$password'"));

$op_enter='<b><u>Вход:</u></b><br>Ваш последний вход: <b><u>'.date("d.m в H:i").'</u></b>!';
mysql_query("INSERT INTO `op` (`id`,`for_id`,`text`,`date`)VALUES ('','$usr[id]','$op_enter','".date("d.m в H:i")."')");



///3KZO входит в чат. Поприветствуем!

header ("Location: enter.php?"); exit;

}}else{

header ("Location: enter.php?"); exit;

}}
?>