View file catalogdeep/input.php

File size: 1.63Kb
<?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':
	$login = mysql_escape_string(htmlspecialchars(trim($_REQUEST['login'])));
	$password = mysql_escape_string(htmlspecialchars(trim($_REQUEST['password'])));
	$error = '';
	$sql = mysql_query("SELECT * FROM `cat_users` WHERE `login` = '".$login."';");
	$ent = mysql_fetch_assoc($sql);
	if(($ent['password'] == $password) AND ($ent['login'] == $login)){ 
	SetCookie("login",$email,time()+3600);
	SetCookie("password",$password,time()+3600);
	header("Location: http://".$_SERVER['SERVER_NAME']."/mpanel.php");
	}else{
	header("Location: http://".$_SERVER['SERVER_NAME']."/mpanel.php?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']."/");
}

















?>