Login Page

By KCMedia - October 27, 2010

Hi

I have brought the membership add on and what i need to know is this.

I have 1 page that needs to be secure for the members area only but i want to put the login on every page on the website.

if you look here www.afft.com.au/newsite/index.php on the right hand side below the test box this is where i want to put the login box on every page.

can someone point me in the right direction please as to how i will do this.

Also i dont want people to be able to add users via the signup page as i wont have one so how do i go about adding users to the membership area.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Login Page

By gkornbluth - October 27, 2010 - edited: October 27, 2010

Hi Craig,

That should be pretty easy.

Here's how I do it

At the top of the viewers, insert this code:
<?php require_once "cmsAdmin/lib/viewer_functions.php"; ?>
<?php include_once "/hsphere/local/home/gkornblu/thecmsbcookbook.com/spambot-email-protector.php" ?>
<?php if (!@$GLOBALS['WEBSITE_MEMBERSHIP_PLUGIN']) { die("You must activate the Website Membership plugin before you can access this page."); } ?>
<?php

// error checking
$errorsAndAlerts = alert();
if (@$CURRENT_USER) {
$errorsAndAlerts = "You are already logged in!<br><a class='special' href='{$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL']}'>CLICK HERE TO CONTINUE WEB SITE</a> or <a class='special' href='?action=logoff'>LOG OUT</a>.";
}

?>
And where you want to display the login form, use this code: <!-- USER LOGIN FORM -->
<?php if (@$errorsAndAlerts): ?>
<div class="heading-text"><br/>
<?php echo $errorsAndAlerts; ?><br/>
</div>
<?php endif ?>

<?php if (!@$CURRENT_USER): ?>
<form action="?" method="post">
<input type="hidden" name="action" value="login" />

<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="body-text-bold">Username</td>
<td><input type="text" name="username" value="<?php echo htmlspecialchars(@$_REQUEST['username']); ?>" size="20" /></td>
</tr>
<tr>
<td class="body-text-bold">Password</td>
<td><input type="password" name="password" value="<?php echo htmlspecialchars(@$_REQUEST['password']); ?>" size="20" /></td>
</tr>

<tr>
<td colspan="2" align="center">
<br/><input type="submit" name="submit" value="Login" />


</td>
</tr>
<tr>
<td colspan="2" align="left">

<br />
<br /> <a class="special" href="<?php echo $GLOBALS['WEBSITE_LOGIN_REMINDER_URL'] ?>">FORGOT YOUR PASSWORD? CLICK HERE</a>
</td>
</tr>
</table>
</form>
<?php endif ?>
<!-- /USER LOGIN FORM -->


Don't forget to set up paths to your reminder page and others in the head of the plugin.

Then, adjust the size and placement of the fields as required.

_____________________________________________

If you want to add users manually you can create new records in the User Accounts section the same way you'd set up any user.

If you add specific access fields you can specify levels of access via "if" statements in your viewers.

There's lot's more information on how to customize the plugin in my CMSB Cookbook http://www.thecmsbcookbook.com

Hope that helps,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Login Page

By KCMedia - October 27, 2010

Hi Jerry

thanks for that i think i worked it all out but now i am having some strange layout issues can someone point me in the right direction the login and password boxes and login button are all other the place.

attached are the ccs and page code.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

index_027.php 24K

style_003.css 10K

layout.css 3K

Re: [kcmedia] Login Page

By Chris - October 27, 2010

Hi Craig,

Can you post a link to your site showing the problem?
All the best,
Chris

Re: [chris] Login Page

By KCMedia - October 27, 2010

Hi Chris


it is www.afft.com.au/newsite
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Login Page

By Chris - October 28, 2010

Hi kcmedia,

You have a CSS rule which is pushing your username text field wide:

input { width: 270px; }

Does that help?
All the best,
Chris