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

Размер файла: 1.8Kb
<?php 
include "init/config.php";
//include "init/functions.php";
session_start();
$item = isset($_GET['item']) ? $_GET['item'] : (isset($_GET['item']) ? $_GET['item'] : "");
switch($item){
case 'enter':
	$id = mysql_escape_string(htmlspecialchars(trim($_REQUEST['id'])));
	$password = mysql_escape_string(htmlspecialchars(trim($_REQUEST['password'])));
	$error = '';
	$sql = mysql_query("SELECT * FROM `cat_users` WHERE `id` = '".$id."' AND `password` = '".$password."';");
	if(mysql_num_rows($sql) > 0){
	$ent = mysql_fetch_assoc($sql);
	if(($ent['password'] == $password) AND ($ent['id'] == $id)){ 
	SetCookie("id",$id,time()+3600);
	SetCookie("password",$password,time()+3600);
	header("Location: http://".$_SERVER['SERVER_NAME']."/mpanel");
	}
	}else{
	header("Location: http://".$_SERVER['SERVER_NAME']."/mpanel/?error");
	}
	

	
break;

case 'aenter':
	if(isset($_POST['alogin']) AND isset($_POST['apasswd'])){
		if(($_POST['alogin'] == ALOGIN) AND ($_POST['apasswd'] == APASSWORD)){	
			$_SESSION['alogin'] = $_POST['alogin'];
			$_SESSION['apasswd'] = $_POST['apasswd'];
			header("Location: http://".$_SERVER['SERVER_NAME']."/adminpanel/index.php?");
			}else{
			header("Location: http://".$_SERVER['SERVER_NAME']."/adminpanel/index.php?item=error");
			}
		}else{
		header("Location: http://".$_SERVER['SERVER_NAME']."/adminpanel/index.php");
	}
break;
case 'exit':
	SetCookie("email","");
	SetCookie("password","");
	if(isset($_SESSION['apasswd']) AND isset($_SESSION['alogin'])){
	unset($_SESSION['apasswd']);
	unset($_SESSION['alogin']);
	}
	header("Location: http://".$_SERVER['SERVER_NAME']."/");
break;

default:
header("Location: http://".$_SERVER['SERVER_NAME']."/");
}


/**********************/
/*Нарушение авторских прав, приследуется темной за углом*/
/*(с) govnokod by DeeP      http://lovap.ru             */


?>