I just want to ask for solution, first..is it bad having two sites with same purpose?
So this is the problem, I have two folder that contain the same site structure. I have two team, 1st it's for local researcher and the 2nd it's for international researcher. And I only got one domain, so they not confusing accessing their admin panel. The differences is only by folder name, such as domain_name/folder1 and /folder2. But the things that make me worried is if there are some user trying to change the name folder, for example researcher 1 is giving access to /folder1 but if he change his folder into /folder2 then he can log-in without his/her username and password.
I tried destroy with cookies, but the menu on admin panel cannot be accessed, it turn back on admin panel login. Here's my destroy cookies code:
if (isset( $_COOKIE[session_name()] ) )
setcookie( session_name(), “”, time()-3600, “/” );
$_SESSION = array();
session_destroy();
I tried this also:
session_start();
session_destroy();
header('location:index.php');
But nothing worked, same problem. Any suggestion?
Thank you...
I am considering that you are using same database for both folder users...if yes...then just add one column in database like "registered_user" containing values either local-researcher or international-researcher now in folder1(local researcher) you can add php code to check... e.g.
$user = mysql_fetch_array(mysql_query("select * from users where id=".$_SESSION['user_id']));
if ($user['registered_user'] != "local-researcher"){
header (location:index.php);
exit; // Added by Martin, ALWAYS exit (or die) the PHP script once you use
// a header location redirection.
}else{
?>
//Your local researcher page contents...
.
.
.
<?}?>
same vice versa for folder2....