File: 1.14.1a/server/web/index.php (View as HTML)

  1: <?php
  2: /* -------------------------------------------------------------
  3: This file is part of FreeNATS
  4: 
  5: FreeNATS is (C) Copyright 2008-2011 PurplePixie Systems
  6: 
  7: FreeNATS is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeNATS is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeNATS.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freenats
 21: -------------------------------------------------------------- */
 22: ob_start();
 23: require("include.php");
 24: $NATS->Start();
 25: $session=$NATS_Session->Check($NATS->DB);
 26: if ($session)
 27: 	{
 28: 	header("Location: main.php");
 29: 	exit();
 30: 	}
 31: 	
 32: if ( ($NATS->Cfg->Get("site.auth","")=="http") &&
 33: 	( (!isset($_REQUEST['auth'])) || ($_REQUEST['auth']!="basic") ) )
 34: {
 35: 	header("Location: login.php");
 36: 	exit();
 37: }
 38: 	
 39: 	
 40: Screen_Header($NATS->Lang->Item("welcome"),3);
 41: ob_end_flush();
 42: ?>
 43: <br><center>
 44: <?php
 45: //if (isset($_REQUEST['login_msg'])) echo "<b style=\"color: red; font-size: 14pt;\">".$_REQUEST['login_msg']."</b><br><br>";
 46: $mesg=array(
 47: 	0 => "msg.logout",
 48: 	1 => "msg.session",
 49: 	2 => "msg.loginfailed" );
 50: if (isset($_REQUEST['msg'])) $msg=$_REQUEST['msg'];
 51: else if (isset($_REQUEST['login_msg'])) // legacy support
 52: 	{
 53: 	if ($_REQUEST['login_msg']=="Invalid Or Expired Session") $msg=1;
 54: 	}
 55: 
 56: if (isset($msg) && isset($mesg[$msg]))
 57: 	{
 58: 	echo "<b style=\"color: red; font-size: 14pt;\">".$NATS->Lang->Item($mesg[$msg])."</b><br><br>";
 59: 	}
 60: else echo "<b style=\"font-size: 14pt;\">".$NATS->Lang->Item("welcome")."</b><br><br>";
 61: 
 62: $t="<b class=\"subtitle\">Login...</b>";
 63: 	Start_Round($NATS->Lang->Item("auth"),300);
 64: ?><center><br>
 65: <table border=0 width=200>
 66: <form action=login.php method=post>
 67: <?php
 68: if (isset($_REQUEST['url'])) echo "<input type=hidden name=\"url\" value=\"".$_REQUEST['url']."\">";
 69: ?>
 70: <tr><td align=right>
 71: <b><?php echo $NATS->Lang->Item("username"); ?>: </b></td><td><input type=text name=naun size=20 maxlength=32 style="width: 160px;"></td></tr>
 72: <tr><td align=right><b><?php echo $NATS->Lang->Item("password"); ?>: </b></td><td><input type=password name=napw size=21 style="width: 160px;" maxlenth=64></td></tr>
 73: <tr><td align=right><b><?php echo $NATS->Lang->Item("language"); ?>: </b></td>
 74: <td><select name=nala style="width: 160px;">
 75: <option value="">System Default</option>
 76: <?php
 77: $langs=$NATS->Lang->GetLanguages();
 78: foreach($langs as $code => $lang)
 79:  {
 80:  echo "<option value=\"".$code."\">".$lang." (".$code.")</option>\n";
 81:  }
 82: ?>
 83: </select></td></tr>
 84: </table><br>
 85: <?php
 86: echo "<input type=submit value=\"".$NATS->Lang->Item("login")."\" style=\"font-size: 11pt;\">\n";
 87: ?>
 88: <!-- <br><input type=checkbox name=gotomonitor value=1> Go straight to live monitor</input> -->
 89: </form>
 90: </center><br>
 91: 
 92: <?php
 93: End_Round();
 94: ?>
 95: <br><br>
 96: </center>
 97: <?php
 98: Screen_Footer();
 99: ?>
100: