--- loncom/cgi/takeonline.pl 2003/09/11 20:54:11 1.2
+++ loncom/cgi/takeonline.pl 2008/12/25 01:56:03 1.4
@@ -1,7 +1,8 @@
#!/usr/bin/perl
+$|=1;
# Take machine online
#
-# $Id: takeonline.pl,v 1.2 2003/09/11 20:54:11 www Exp $
+# $Id: takeonline.pl,v 1.4 2008/12/25 01:56:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -26,8 +27,35 @@
# http://www.lon-capa.org/
#
-print "Content-type: text/html\n\n".
- "
Take Online
";
-system('cp /home/httpd/html/origindex.html /home/httpd/html/index.html');
-system('rm /home/httpd/html/lon-status/reroute.txt');
-print "";
+use strict;
+use lib '/home/httpd/lib/perl/';
+use Apache::lonlocal;
+use LONCAPA::loncgi;
+use LONCAPA::lonauthcgi;
+
+print "Content-type: text/html\n\n";
+
+&main();
+
+sub main {
+ if (!&LONCAPA::lonauthcgi::check_ipbased_access('takeonline')) {
+ if (!&LONCAPA::loncgi::check_cookie_and_load_env()) {
+ &Apache::lonlocal::get_language_handle();
+ print &LONCAPA::loncgi::missing_cookie_msg();
+ return;
+ }
+
+ if (!&LONCAPA::lonauthcgi::can_view('takeonline')) {
+ &Apache::lonlocal::get_language_handle();
+ print &LONCAPA::lonauthcgi::unauthorized_msg('takeonline');
+ return;
+ }
+ }
+
+ &Apache::lonlocal::get_language_handle();
+
+ print ''.&Apache::lonlocal::mt('Take Online').'
';
+ system('cp /home/httpd/html/origindex.html /home/httpd/html/index.html');
+ system('rm /home/httpd/html/lon-status/reroute.txt');
+ print '';
+}