<?php

session_start();
if(!isset($_SESSION['uname'])) {
ob_start();
//check if user previously checked remember me
if(isset($_COOKIE['userid']) && isset($_COOKIE['password'])) {
//check cookie found is really a member
include "../config.php";

$checkuser=check_db($_COOKIE['userid'],$_COOKIE['password']);  
if($checkuser);
$_SESSION['uname'] = $_COOKIE['userid'];
header('Location: /members/index.php');
die();
} else {
header ("location: /access-denied.php");
}
ob_flush();
}
?>