<?php
require "../../inc/config.php";
if ($_POST[username] == $s40[user] and base64_encode($_POST[password].$s40[passkey]) == $s40[pass]){
	if($_POST[remember]){
		setcookie("sfu", $_POST[username], time()+60*60*24*30, "/");
		setcookie("sfp", base64_encode($_POST[password]), time()+60*60*24*30, "/");
	}
	session_name("s".$s40[passkey]);
	session_start();
	session_register("s".$s40[passkey]);
	setcookie("register", base64_encode($s40[passkey]), time()+60*60*24, "/");
	$_SESSION["$s40[passkey]"] = session_id();
	header("location: ../main.php");
	exit;
}else{
	header ("location: ../index.php?n=500");
}
?>