Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //function to get the date
- function last_login()
- {
- $date = gmdate("Y-m-d");
- return $date;
- }
- //function that sets the session variable
- function sess_vars($base_dir, $server, $dbusername, $dbpassword, $db_name, $table_name, $user, $pass)
- {
- //make connection to dbase
- $connection = @mysql_connect($server, $dbusername, $dbpassword)
- or die(mysql_error());
- $db = @mysql_select_db($db_name,$connection)
- or die(mysql_error());
- $sql = "SELECT * FROM $table_name WHERE username = '$user' and password = password('$pass')";
- $result = @mysql_query($sql, $connection) or die(mysql_error());
- //get the number of rows in the result set
- $num = mysql_num_rows($result);
- //set session variables if there is a match
- if ($num != 0)
- {
- while ($sql = mysql_fetch_object($result))
- {
- $_SESSION[first_name] = $sql -> firstname;
- $_SESSION[last_name] = $sql -> lastname;
- $_SESSION[user_name] = $sql -> username;
- $_SESSION[password] = $sql -> password;
- $_SESSION[group1] = $sql -> group1;
- $_SESSION[group2] = $sql -> group2;
- $_SESSION[group3] = $sql -> group3;
- $_SESSION[pchange] = $sql -> pchange;
- $_SESSION[email] = $sql -> email;
- $_SESSION[redirect] = $sql -> redirect;
- $_SESSION[verified] = $sql -> verified;
- $_SESSION[last_login] = $sql -> last_login;
- }
- }else{
- $_SESSION[redirect] = "$base_dir/errorlogin.html";
- }
- }
- //functions that will determine if access is allowed
- function allow_access($group)
- {
- if ($_SESSION[group1] == "$group" || $_SESSION[group2] == "$group" || $_SESSION[group3] == "$group" ||
- $_SESSION[group1] == "Administrators" || $_SESSION[group2] == "Administrators" || $_SESSION[group3] == "Administrators" ||
- $_SESSION[user_name] == "$group")
- {
- $allowed = "yes";
- }else{
- $allowed = "no";
- }
- return $allowed;
- }
- //function to check the length of the requested password
- function password_check($min_pass, $max_pass, $pass)
- {
- $valid = "yes";
- if ($min_pass > strlen($pass) || $max_pass < strlen($pass))
- {
- $valid = "no";
- }
- return $valid;
- }
- ////////////////////////////////////////
- /////////MY FUNCTIONS//////////////////
- //////////////////////////////////////
- /////////FORMAT//////////////////////
- function adminheader($title = '')
- { // print an HTML header
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><?php echo $title; ?></title>
- <link href="css/style.css" rel="stylesheet" type="text/css">
- <link href="css/blueberry.css" rel="stylesheet" type="text/css">
- <script src="js/styler.js" type="text/javascript">
- </script>
- </head>
- <body>
- <div id="head-container">
- <div id="header">
- <img src="images/connecticut%20transportation.jpg" />
- <!-- end head-container --></div>
- <!-- end .header --></div>
- <div id="content-container">
- <div class="wrap">
- <div id="nav">
- <div class="menu">
- <ul>
- <li><a class="left_nosub" href="cttsadmin_menu.php">Home</a></li>
- <li><a class="center_hassub" href="">Employees</a>
- <ul>
- <li><a href="list_aides.php">List Aides</a></li>
- <li><a href="list_drivers.php">List Drivers</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Clients</a>
- <ul>
- <li><a href="list_clients.php">List Clients</a></li>
- <li><a href="list_schedule.php">List Schedule</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Schools</a>
- <ul>
- <li><a href="list_schools.php">List Schools</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Cars</a>
- <ul>
- <li><a href="list_cars.php">List Cars</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Routes</a>
- <ul>
- <li><a href="">Schedule a Route</a></li>
- <li><a href="">Veiw Routes</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">My Account</a>
- <ul>
- <li><a href="email_change_form.php">Change Your Email</a></li>
- <li><a href="phone_change_form.php">Change Your Phone Number</a></li>
- <li><a href="pass_change_form.php">Change Your Password</a></li>
- <li><a href="mail_all.php">Email ALL Employees</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="adminpage.php">User Panel</a>
- <ul>
- </ul>
- </li>
- <li><a class="right_nosub" href="logout.php">Log Out</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- <!-- end .myMenu --></div>
- <!-- end .nav --></div>
- <!-- end .wrap --></div>
- <?php
- }
- function adminheader_date($title = '')
- { // print an HTML header
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><?php echo $title; ?></title>
- <link href="css/dark-hive/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css" />
- <link href="css/style.css" rel="stylesheet" type="text/css">
- <link href="css/blueberry.css" rel="stylesheet" type="text/css">
- <script src="js/styler.js" type="text/javascript">
- </script>
- <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>
- <script type="text/javascript">
- $(function(){
- // Datepicker
- $('#start_date').datepicker({
- inline: true,
- dateFormat: "yy-mm-dd"
- });
- // Datepicker
- $('#end_date').datepicker({
- inline: true,
- dateFormat: "yy-mm-dd"
- });
- //hover states on the static widgets
- $('#dialog_link, ul#icons li').hover(
- function() { $(this).addClass('ui-state-hover'); },
- function() { $(this).removeClass('ui-state-hover'); }
- );
- });
- </script>
- <style>
- div.ui-datepicker{
- font-size:12px;
- }
- </style>
- </head>
- <body>
- <div id="head-container">
- <div id="header">
- <img src="images/connecticut%20transportation.jpg" />
- <!-- end head-container --></div>
- <!-- end .header --></div>
- <div id="content-container">
- <div class="wrap">
- <div id="nav">
- <div class="menu">
- <ul>
- <li><a class="left_nosub" href="cttsadmin_menu.php">Home</a></li>
- <li><a class="center_hassub" href="">Employees</a>
- <ul>
- <li><a href="list_aides.php">List Aides</a></li>
- <li><a href="list_drivers.php">List Drivers</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Clients</a>
- <ul>
- <li><a href="list_clients.php">List Clients</a></li>
- <li><a href="list_schedule.php">List Schedule</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Schools</a>
- <ul>
- <li><a href="list_schools.php">List Schools</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Cars</a>
- <ul>
- <li><a href="list_cars.php">List Cars</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">Routes</a>
- <ul>
- <li><a href="">Schedule a Route</a></li>
- <li><a href="">Veiw Routes</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">My Account</a>
- <ul>
- <li><a href="email_change_form.php">Change Your Email</a></li>
- <li><a href="phone_change_form.php">Change Your Phone Number</a></li>
- <li><a href="pass_change_form.php">Change Your Password</a></li>
- <li><a href="mail_all.php">Email ALL Employees</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="adminpage.php">User Panel</a>
- <ul>
- </ul>
- </li>
- <li><a class="right_nosub" href="logout.php">Log Out</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- <!-- end .myMenu --></div>
- <!-- end .nav --></div>
- <!-- end .wrap --></div>
- <?php
- }
- function dispatchheader($title = '')
- { // print an HTML header
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title></title>
- <link href="css/style.css" rel="stylesheet" type="text/css">
- <link href="css/blueberry.css" rel="stylesheet" type="text/css">
- <script src="js/styler.js" type="text/javascript">
- </script>
- </head>
- <body>
- <div id="head-container">
- <div id="header">
- <img src="images/connecticut%20transportation.jpg" />
- <!-- end head-container --></div>
- <!-- end .header --></div>
- <div id="content-container">
- <div class="wrap">
- <div id="nav">
- <div class="menu">
- <ul>
- <li><a class="left_nosub" href="cttsadmin_menu.php">Home</a></li>
- <li><a class="center_hassub" href="">Routes</a>
- <ul>
- <li><a href="">View All Routes</a></li>
- <li><a href="">Assign Routes</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">My Account</a>
- <ul>
- <li><a href="email_change_form.php">Change Your Email</a></li>
- <li><a href="phone_change_form.php">Change Your Phone Number</a></li>
- <li><a href="pass_change_form.php">Change Your Password</a></li>
- <li><a href="mail_all.php">Email ALL Employees</a></li>
- </ul>
- </li>
- <li><a class="right_nosub" href="logout.php">Log Out</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- <!-- end .myMenu --></div>
- <!-- end .nav --></div>
- <!-- end .wrap --></div>
- <?php
- }
- function driversheader($title = '')
- { // print an HTML header
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title></title>
- <link href="css/style.css" rel="stylesheet" type="text/css">
- <link href="css/blueberry.css" rel="stylesheet" type="text/css">
- <script src="js/styler.js" type="text/javascript">
- </script>
- </head>
- <body>
- <div id="head-container">
- <div id="header">
- <img src="images/connecticut%20transportation.jpg" />
- <!-- end head-container --></div>
- <!-- end .header --></div>
- <div id="content-container">
- <div class="wrap">
- <div id="nav">
- <div class="menu">
- <ul>
- <li><a class="left_nosub" href="drivers_menu.php">Home</a></li>
- <li><a class="center_hassub" href="">Routes</a>
- <ul>
- <li><a href="">View All Routes</a></li>
- <li><a href="">View Your Route</a></li>
- </ul>
- </li>
- <li><a class="center_hassub" href="">My Account</a>
- <ul>
- <li><a href="email_change_form.php">Change Your Email</a></li>
- <li><a href="phone_change_form.php">Change Your Phone Number</a></li>
- <li><a href="pass_change_form.php">Change Your Password</a></li>
- </ul>
- </li>
- <li><a class="right_nosub" href="logout.php">Log Out</a>
- </li>
- </ul>
- </div>
- </div>
- <!-- end .myMenu --></div>
- <!-- end .nav --></div>
- <!-- end .wrap --></div>
- <?php
- }
- ///////////DATA FUNTIONS//////////////
- //function to get userid and name for dropdowns in forms
- function drivers()
- {
- $result = mysql_query("SELECT * FROM `authorize` WHERE group1='drivers'
- OR group2='drivers' OR group3='drivers' ORDER BY lastname");
- $arr = array();
- while($r = mysql_fetch_array($result)){
- $arr[] = $r;
- }
- return $arr;
- }
- //function to get aides that are active
- function aides_active(){
- $result = mysql_query("Select * FROM `aides` WHERE aides_active = '1' ORDER BY aides_ln");
- $arr = array();
- while($r = mysql_fetch_array($result)){
- $arr[] = $r;
- }
- return $arr;
- }
- //function to get cars that are active
- function cars(){
- $result = mysql_query("Select * FROM `cars` WHERE car_active = '1' ORDER BY id_cars");
- $arr = array();
- while($r = mysql_fetch_array($result)){
- $arr[] = $r;
- }
- return $arr;
- }
- //function to get schoolid and name for dropdowns in forms
- function schools(){
- $result = mysql_query("Select * FROM `schools` ORDER BY sch_name");
- $arr = array();
- while($r = mysql_fetch_array($result)){
- $arr[] = $r;
- }
- return $arr;
- }
- //function to get aides that are active
- function clients(){
- $result = mysql_query("Select * FROM `clients` WHERE cl_active = '1' ORDER BY cl_ln");
- $arr = array();
- while($r = mysql_fetch_array($result)){
- $arr[] = $r;
- }
- return $arr;
- }
- //function to get userid and name for dropdowns in forms
- function auth_names()
- {
- $result = mysql_query("Select id_auth, firstname, lastname FROM `authorize` ORDERBY lastname");
- $arr = array();
- while($r = mysql_fetch_array($result)){
- $arr[] = $r;
- }
- return $arr;
- }
- //funtion to delete record
- $query = "delete from aides where id_ades = '$id_aides'"
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement