the best way to accomplish what you are looking to do is use the below code and be sure to lable the file "login.php";
<?php
ob_start();
session_start();
if (isset($_SESSION['logged'])) {
header("Location: index.php");
} else {
echo "<br><br>";
echo "<p align='center'><font class='main'>Login here echo "<form method='post' action='login.php'>";
echo "<input type='hidden' name='action' value='1'>";
echo "<table border='0' align='center' cellspacing='0' cellpadding='4'>";
echo " <tr>";
echo " <td align='right'><font class='main'><b>Username: </b></font></td>";
echo " <td><input type='text' name='username' size='40'></td>";
echo " </tr>";
echo " <tr>";
echo " <td align='right'><font class='main'><b>Password: </b></font></td>";
echo " <td><input type='password' name='passwd' size='40'></td>";
echo " </tr>";
echo "</table>";
echo "<p align='center'><input type='submit' value='Login'></p>";
echo "<p align='center'><a href='#'>Forgot My Password/Username</a></p>";
echo "</form>";
if ($_POST['action'] == 1) {
$safe['username'] = mysql_real_escape_string(strtolower($_POST['username']));
$safe['passwd'] = mysql_real_escape_string($_POST['passwd']);
$query_user = "SELECT 1 FROM table_name WHERE username = '{$safe['username']}' AND password = '{$safe['passwd']}'";
$result_user = mysql_query($query_user) or die("Query Failed: ".mysql_error());
if(mysql_num_rows($result_user)) {
$_SESSION['username'] = $safe['username'];
$_SESSION['logged'] = 1;
header("Location: index.php");
} else {
echo "<p align='center'><font class='error'>You are not an authorized to access these pages.<br>";
echo "If you have recieved this message in error, please contact the <a href='#'>Webmaster</a> for assistance.</font></p>";
}
}
}
if ($_REQUEST['logout']) {
unset($_SESSION['username']);
session_unregister('username');
unset($_SESSION['logged']);
session_unregister('logged');
header("Location: login.php");
}
?>
Then place the following lines of code within each of the CMS programs
<?php
ob_start();
session_start();
if (isset($_SESSION['username'] {
use CMS code here>>
} else {
echo "You are not an authorized member"
}
?>
By using the above posted code it allows your users to only have to login once and be able to swith between the 2 CMS programs without having to login each time. I hope I was able to help out or at least point you into the correct direction.