[ PHPXref.com ] [ Generated: Sun Jul 20 19:57:02 2008 ] [ PHP Timeclock 1.02 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> header.php (source)

   1  <?php 
   2  
   3  include  'functions.php';
   4  
   5  ob_start();
   6  echo "<html>\n";
   7  
   8  // grab the connecting ip address. //
   9  
  10  $connecting_ip = get_ipaddress();
  11  
  12  if (empty($connecting_ip)) {
  13      return FALSE;
  14  }
  15  
  16  // determine if connecting ip address is allowed to connect to PHP Timeclock //
  17  
  18  if ($restrict_ips == "yes") {
  19      for ($x=0; $x<count($allowed_networks); $x++) {
  20          $is_allowed = ip_range($allowed_networks[$x], $connecting_ip);
  21          if (!empty($is_allowed)) {
  22              $allowed = TRUE;
  23          }
  24      }
  25      if (!isset($allowed)) {
  26          echo "You are not authorized to view this page."; exit;
  27      }
  28  }
  29  
  30  // connect to db anc check for correct db version //
  31  
  32  @ $db = mysql_pconnect($db_hostname, $db_username, $db_password);
  33  if (!$db) {echo "Error: Could not connect to the database. Please try again later."; exit;}
  34  mysql_select_db($db_name);
  35  
  36  $table = "dbversion";
  37  $result = mysql_query("SHOW TABLES LIKE ".$db_prefix."'".$table."'");
  38  @$rows = mysql_num_rows($result);
  39  
  40  if ($rows == "1") {
  41      $dbexists = "1";
  42  } else {
  43      $dbexists = "0";
  44  }
  45  
  46  $db_version_result = mysql_query("select * from ".$db_prefix."dbversion");
  47  while (@$row = mysql_fetch_array($db_version_result)) {
  48      @$my_dbversion = "".$row["dbversion"]."";
  49  }
  50  
  51  // include css and timezone offset//
  52  
  53  if (($use_client_tz == "yes") && ($use_server_tz == "yes")) {
  54      $use_client_tz = '$use_client_tz';
  55      $use_server_tz = '$use_server_tz';
  56      echo "Please reconfigure your config.inc.php file, you cannot have both $use_client_tz AND $use_server_tz set to 'yes'"; exit;
  57  }
  58  
  59  echo "<head>\n";
  60  if ($use_client_tz == "yes") {
  61      if (!isset($_COOKIE['tzoffset'])) {
  62          include  'tzoffset.php';
  63          echo "<meta http-equiv='refresh' content='0;URL=timeclock.php'>\n";
  64      }
  65  }
  66  
  67  echo "<link rel='stylesheet' type='text/css' media='screen' href='css/default.css' />\n";
  68  echo "<link rel='stylesheet' type='text/css' media='print' href='css/print.css' />\n";
  69  
  70  // set refresh rate for each page //  
  71  
  72  if ($refresh == "none") {
  73      echo "</head>\n";
  74  } else {
  75      echo "<meta http-equiv='refresh' content=\"$refresh;URL=timeclock.php\">\n";
  76      echo "<script language=\"javascript\" src=\"scripts/pnguin_timeclock.js\"></script>\n";
  77      echo "</head>\n";
  78  }
  79  
  80  if ($use_client_tz == "yes") {
  81      if (isset($_COOKIE['tzoffset'])) {
  82          $tzo = $_COOKIE['tzoffset'];
  83          settype($tzo, "integer");
  84          $tzo = $tzo * 60;
  85      }
  86  } 
  87  elseif ($use_server_tz == "yes") {
  88      $tzo = date('Z');
  89  } else {
  90      $tzo = "1";
  91  }
  92  ?>
  93  <body>


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