Re: [chris] Using CMSBuilding Login
Alternatively, you could do the following if you want to hide the CMS login page and give them a more customized login page.
This helps if you want to use CMSB as a user management tool, but not really give them access to the CMSB back end.
1. Create an account with no access to CMSB (None)
2. Create a login page (login.php)
<form method="post" action="http://www.yourdomain.com/cmsAdmin/admin.php">
<input type="hidden" name="action" value="loginSubmit" />
<input type="hidden" name="redirectUrl" value="http://www.yourdomain.com/test/page.php" />
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Login</td>
</tr>
<tr>
<td align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Username</td>
<td>Password</td>
<td></td>
</tr>
<tr>
<td><input type="text" name="username" id="username" value="" size="12" tabindex="1"/> </td>
<td><input type="password" name="password" value="" size="12" tabindex="2"/> </td>
<td><input type="submit" name="login" value="Login" tabindex="4" /> </td>
</tr>
</table>
<script type="text/javascript">
document.getElementById('username').focus();
</script>
</td>
</tr>
</table>
</form>
3. Protect the pages you want to protect using the CMSB Sessions
<?php if (!defined('START_SESSION')) { define('START_SESSION', true); }
require_once "/home/pathto/public_html/cmsAdmin/lib/viewer_functions.php";
if (!@$_SESSION['username']) { header("Location: http://www.yourdomain.com/test/login.php"); exit; }
4. Change the values in red to match your site variables
This is pretty basic in mock up and there can be a lot more styling.
In addition, if you want to create a logout function separate from CMSB (so they are not redirected to the CMSB login screen) create a file called logout.php and link to it:
<?
session_start();
session_destroy();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Logout</title>
</head>
<body>
<script type="text/javascript">
<!--
window.location = "http://www.yourdomain.com/test/login.php"
//-->
</script>
</body>
</html>
Let me know if I missed something. I tested this only briefly.
Kenny