CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 [RESOLVED] need way to disable logins for maintenance

Print topic Send  topic

Author Message
kirchaj

Posts: 215
Posted: 04/20/2010, 12:48 PM

Been scratching my head over this one and decided to ask for some input.

I need a way to administratively disable logins, for example, system maintenance, moving servers, etc. I would like to be able to turn off the login forms and provide a message to the users explaining the situation and when logins will be re-enabled.

Has anyone else done this? any ideas on how to implement?

I do have two login forms, one for students and one for faculty, so if I could develop something for both, that would be great.

Thanks for your help.

TK
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 04/20/2010, 6:24 PM

kirchaj
You can have one login screen that caters to all users. You can set your code so that when a user logs in (based on their access level:student or faculty) they are directed to the correct screen. You can also set code in your header to always check on system availability which can be set by a system administrator. If during the system check it finds that the system should be closed then the user will automatically be redirected out of the system with a system message. This is one way that you can do it. There are definitely others as well. Hopefully this helps you.
View profile  Send private message
kirchaj

Posts: 215
Posted: 04/21/2010, 6:18 AM

mamboBROWN,

Thanks for the info and I think that definitely could work with a little re-working of the system.

Can you elaborate specifically about the code in the header that can check for system availability set by the administrator? I am curious how you would set that up.

Thanks again.
TK
View profile  Send private message
andy


Posts: 183
Posted: 04/21/2010, 8:09 AM

You can always temporarily replace your login page with a "Sorry down for maintenance" holding page.

Yeah ok. Not so elegant, I guess... :-P
_________________
Andy

RAD tools for rich UI controls:
http://www.koolphptools.com
View profile  Send private message
Waspman

Posts: 948
Posted: 04/21/2010, 8:11 AM

No need to login to find out it's offline.

On the login page load the system status into a grid with a hidden field. Save the value to a session.

Put the login form in a panel and show dependent on the session value. And set the value of a label with a message etc.
;-)
_________________
http://www.waspmedia.co.uk
View profile  Send private message
ckroon

Posts: 869
Posted: 04/21/2010, 8:29 AM

I use the super elegant method of renaming the index page to 'index1', then rename an Under Construction page to 'Index'.

Works like a charm
:)

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
datadoit
Posted: 04/21/2010, 8:49 AM

Your login record form is a CCS component. This gives you the ability
to show/hide it via the Show/Hide Component action, or via direct code:

$Container->Visible = false;

Directly beneath the login record form, place a label (which is also CCS
component), and give it a default value of something like "System
maintenance being performed. Please try again later."

In your database, you should already have something like a system_config
type of table. Add a field for system_active (TINYINT, 1). If it's a
1, then the system is active, if not then it's inactive.

In your login form's BeforeShow, add an action of Show/Hide Component,
choose Hide and Expression, and for the expression use:

!CCDLookUp("system_active", "system_config", "",
$Page->Connections["YourConnectionName"])

For your label, use the opposite:

CCDLookUp ...

Untested, but this should work.
kirchaj

Posts: 215
Posted: 04/21/2010, 11:38 AM

Thanks for all of your input. All of the solutions would have worked. I came up with a hybrid of all the solutions that seems to work great.

In the Before Show event of the login form I put the following code

$db = new clsDBportfolio();
$login_disabled = (CCDlookup("login_enabled","system_config","",$db));
if ($login_disabled == 0) {
$Login->Visible = False;
}
else {
$Login->Visible = True;
}

I created a grid with a label linked to a date in the database to display when the system would be accessible and used similar code to that above to display or hide the grid.

I can change the field in the database and it immediately turns off logins and shows the grid. :)

Thanks again for all of your help.

TK
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.