[ PHPXref.com ] [ Generated: Sun Jul 20 17:52:21 2008 ] [ Focus/SIS 1.0 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> index.php (source)

   1  <?
   2  /**
   3  * @file index.php 2006-04-17 andrew $
   4  * @package Focus/SIS
   5  * @copyright Copyright (C) 2006 Andrew Schmadeke. All rights reserved.
   6  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
   7  * Focus/SIS is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.txt for copyright notices and details.
  12  */
  13  
  14  error_reporting(1);
  15  require_once ('Warehouse.php');
  16  if($_REQUEST['modfunc']=='logout')
  17  {
  18      if($_SESSION)
  19      {
  20          session_destroy();
  21          header("Location: $_SERVER[PHP_SELF]?modfunc=logout".(($_REQUEST['reason'])?'&reason='.$_REQUEST['reason']:''));
  22      }
  23  }
  24  
  25  if($_REQUEST['USERNAME'] && $_REQUEST['PASSWORD'])
  26  {
  27      $login_RET = DBGet(DBQuery("SELECT USERNAME,PROFILE FROM STAFF WHERE SYEAR='".$DefaultSyear."' AND UPPER(USERNAME)='".strtoupper($_REQUEST['USERNAME'])."' AND UPPER(PASSWORD)='".strtoupper($_REQUEST['PASSWORD'])."'"));
  28      $student_RET = DBGet(DBQuery("SELECT USERNAME,STUDENT_ID FROM STUDENTS WHERE UPPER(USERNAME)='".strtoupper($_REQUEST['USERNAME'])."' AND UPPER(PASSWORD)='".strtoupper($_REQUEST['PASSWORD'])."'"));
  29      if(strtoupper($login_RET[1]['USERNAME'])==strtoupper($_REQUEST['USERNAME']) && $login_RET[1]['PROFILE']!='none')
  30      {
  31          $_SESSION['USERNAME'] = $login_RET[1]['USERNAME'];
  32          if(Config('LOGIN')=='No')
  33          {
  34              if(!$_REQUEST['submit'])
  35              {
  36                  Warehouse('header');
  37                  echo "<FORM action=index.php?USERNAME=$_REQUEST[USERNAME]&PASSWORD=$_REQUEST[PASSWORD] method=POST>";
  38                  PopTable('header','Confirm Successful Installation');
  39                  echo '<CENTER>';
  40                  echo '<h4>You have successfully installed Focus/SIS Student Information System.<BR>Since this is your first login, Focus/SIS would like to tell our servers that you have successfully installed the software. Is this OK?</h4>You will not see this message again.<BR>';
  41                  echo '<BR><INPUT type=submit name=submit value=OK><INPUT type=submit name=submit value=Cancel>';
  42                  echo '</CENTER>';
  43                  PopTable('footer');
  44                  echo '</FORM>';
  45                  Warehouse('footer_plain');
  46                  exit;
  47              }
  48              elseif($_REQUEST['submit']=='OK')
  49              {
  50                  DBQuery("UPDATE CONFIG SET LOGIN='Yes'");
  51                  @mail('focus@focus-sis.org','NEW Focus/SIS INSTALL',"INSERT INTO FOCUS_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME) values('$_SERVER[SERVER_NAME]','$_SERVER[SERVER_ADDR]','".date('Y-m-d')."','1.0','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]')");
  52              }
  53              elseif($_REQUEST['submit']=='Cancel')
  54                  DBQuery("UPDATE CONFIG SET LOGIN='Y'");
  55          }
  56      }
  57      elseif($login_RET[1]['PROFILE']=='none')
  58          $error[] = "Your account has not yet been activated.  When your account has been verified by school administration, you will be notified by email.";
  59      elseif(strtoupper($student_RET[1]['USERNAME'])==strtoupper($_REQUEST['USERNAME']))
  60          $_SESSION['STUDENT_ID'] = $student_RET[1]['STUDENT_ID'];
  61      else
  62          $error[] = "You used the Wrong Username or Password.<BR> <CENTER>Please Try Logging In Again.</CENTER>";
  63  }
  64  
  65  if($_REQUEST['modfunc']=='create_account')
  66  {
  67      Warehouse('header');
  68      $_FOCUS['allow_edit'] = true;
  69      if($_REQUEST['staff']['USERNAME'])
  70          $_REQUEST['modfunc'] = 'update';
  71      else
  72          $_REQUEST['staff_id'] = 'new';
  73      include ('modules/Users/User.php');
  74      
  75      if(!$_REQUEST['staff']['USERNAME'])
  76          Warehouse('footer_plain');
  77      else
  78      {
  79          $note[] = 'Your account has been created.  You will be notified by email when it is verified by school administration and you can log in.';
  80          session_destroy();
  81      }
  82  }
  83  
  84  if(!$_SESSION['USERNAME'] && !$_SESSION['STUDENT_ID'] && $_REQUEST['modfunc']!='create_account')
  85  {
  86      Warehouse('header');
  87      echo "<BODY leftmargin=2 marginwidth=2 background=assets/bg.gif onLoad='document.loginform.USERNAME.focus()'>";
  88      echo "<br /><br />";
  89      PopTable("header","Focus/SIS Login", "width=55%", "5");
  90      echo '<CENTER>';
  91      if($_REQUEST['reason'])
  92          $note[] = 'You must have javascript enabled to use Focus/SIS.';
  93      echo ErrorMessage($error,'Error');
  94      echo ErrorMessage($note,'Note');
  95      echo '</CENTER>';
  96      echo "<table border=0>
  97      <tr>
  98      <td  align=right>".DrawPNG('themes/'.Preferences('THEME').'/logo.png','border=0 width=160')."</td>
  99      <td align=center><form name=loginform method='post' action='index.php'>
 100      <h4>".Config('TITLE')." </h4>
 101      <table border='0' cellspacing='0' cellpadding='2'>
 102      <tr>
 103          <td align='right'><b>Username</b></td>
 104          <td align='left'><input type='text' name='USERNAME' size='25' maxlength='25' /></td>
 105      </tr>
 106      <tr>
 107          <td align='right'><b>Password</b></td>
 108          <td align='left'><input type='password' name='PASSWORD' size='25' maxlength='25' /></td>
 109      </tr>
 110      </table>
 111      <p>
 112      <INPUT type=submit value='Login'></p>";
 113      if($ShowCreateAccount)
 114          echo "<center><font size=-1>[ <A HREF=index.php?modfunc=create_account>Create Account</A> ]</font></center>";
 115      echo "</form>
 116      </td></tr>
 117      ";
 118      
 119      // System disclaimer.
 120      echo "
 121      <tr><td colspan=2>
 122      <font size=-3>
 123      This is a restricted network. Use of this network, its equipment, and resources
 124      is monitored at all times and requires explicit permission from the network
 125      administrator and ".Config('TITLE').". If you do not have this
 126      permission in writing, you are violating the regulations of this network
 127      and can and will be prosecuted to the full extent of the law. By continuing
 128      into this system, you are acknowledging that you are aware of and agree
 129      to these terms.
 130      </font>
 131      <br /><br />
 132      </td></tr>
 133      </table>";
 134      echo "<center><small><A HREF=http://www.focus-sis.org>Focus/SIS</A> version 1.0 <BR>&copy; 2004-".date('Y')." All rights reserved.</small></center>";
 135      PopTable("footer");
 136      echo "<br />";
 137      Warehouse("footer");
 138  }
 139  elseif($_REQUEST['modfunc']!='create_account')
 140  {
 141      echo "
 142          <HTML>
 143              <HEAD><TITLE>".Config('TITLE')."</TITLE></HEAD>";
 144      echo "<noscript><META http-equiv=REFRESH content='0;url=index.php?modfunc=logout&reason=javascript' /></noscript>";
 145      echo "<frameset id=mainframeset rows='*,30' border=0 framespacing=0>
 146                  <frameset cols='180,*' border=0>
 147                      <frame name='side' src='Side.php' frameborder='0' />
 148                      <frame name='body' src='Modules.php' frameborder='0' style='border: inset #C9C9C9 2px' />
 149                  </frameset>
 150                  <frame name='help' src='Bottom.php' />
 151              </frameset>
 152          </HTML>";
 153  }
 154  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]