<!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>Tocotex CMS log in</title>
<link rel="shortcut icon" type="image/x-icon" href="main_images/favicon.ico">
<?php
$e= $_GET['e'];

$ip_address = $_SERVER['REMOTE_ADDR'];

include ("login_include/dbset.php");

$con = mysqli_connect("localhost",$dbu,$dbp);
if (!$con)
  {
  die('Could not connect to database: ' . mysqli_error());
  }
   
mysqli_select_db($con, $dbs);


date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time());
$ip_address = $_SERVER['REMOTE_ADDR'];

$table_name = "test_tracking_log";
$track_check_query = "INSERT INTO $table_name (entry_date, user, company, page, location) VALUES ('".$entry_date."' ,'---', 'Main', 'main.php', '".$ip_address."' )";
$track_check_query = $con->query($track_check_query);
?>

<script>
function nospaces(t){
if(t.value.match(/\s/g)){
t.value=t.value.replace(/\s/g,'');
}
}
</script>

<style>
label.label_std{
	margin-left:5px;
    line-height:20px;
	padding-top:6px;
    color:#46599D;
    text-shadow:1px 1px 1px #fff;
    font:bold 14px Arial;
}

input.imagebutton{
	background-color:#E1E1E1;
	width:auto;
	min-width:100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#425599;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	
	border-radius: 5px;
	
	-webkit-box-shadow:0px 0px 0px #CCC;
	box-shadow:0px 0px 0px #CCC;
	
}

input.imagebutton:hover{
	background-color:#E4E4E4;
	width:auto;
	min-width:100px;
	height: 24px;
	border:solid;
	border-width:2px;
	border-color:#425599;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	
	
	border-radius: 5px;
	
	-webkit-box-shadow:5px 5px 5px #666;
	box-shadow:5px 5px 5px #666;
	
}
</style>

</head>

<body  onload="
	<?php if (($e=='') OR ($e==0)) { ?> document.getElementById('warning_1').style.display = 'none'; document.getElementById('warning_3').style.display = 'none'; <?php } ?>; 
	<?php if ($e==1) { ?> document.getElementById('warning_1').style.display = 'block'; <?php } else { ?> document.getElementById('warning_1').style.display = 'none'; <?php } ?>
    <?php if ($e==3) { ?> document.getElementById('warning_3').style.display = 'block'; <?php } else { ?> document.getElementById('warning_3').style.display = 'none'; <?php } ?>
    " >
<br />
<br />
<br />
<?php 
//if ($ip_address=='127.0.0.1') { ?>

<table width="752" height="514" border="0" background="main_images/tocotex_main_menu.jpg" align="center">
  <tr>
    <td colspan="2" align="center"><img src="main_images/tocotex_logo_main.fw.png" width="260" height="61" /></td>
  </tr>
  <tr>
    <td width="356" height="222" align="center">IP Address: <?php echo $ip_address ?></td>
    <td width="380">
    <div>
    <form action="mainmenu.php?log=0&e=0" method="post">
    <br />
    <label class="label_std" style="color:#FFF">
    Enter user name and password to log in.<br /></label>
<br />
<label class="label_std" style="color:#FFF">User name:&nbsp;&nbsp;</label><input name="user_name_text" type="text" onkeyup="nospaces(this)"/><br />
<br />

<label class="label_std" style="color:#FFF">Password:&nbsp;&nbsp;&nbsp;</label><input name="password_text" type="password" onkeyup="nospaces(this)"/><br />
<br />
<input name="log" type="hidden" value="0" />
<input name="ip_address" type="hidden" value="<?php echo $ip_address ?>" />
<input name="login_button" type="submit" value="Log in" class="imagebutton" />
    </label>
    </form>
    </div><br />


    <div class="warning_frame" name="warning_1" id="warning_1" style="background-color:#CED3E8;">
        <table width="383" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="37"><img src="main_images/exclamation-mark_small.png" width="24" height="24" /></td>
            <td width="346"><label class="label_std" style="font-size:12px;">You entered the wrong user name and/or password<br />
                Note: both user name and password are case sensitive.</label></td>
          </tr>
        </table>
      </div>
      <!--<div class="warning_frame" id="warning_2">
        <table width="215" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="40"><img src="images/icon-error.png" width="30" height="30"></td>
            <td width="175"><label class="label_std">Your log-in is correct, but there is no home page set for you. Contact the system administrator.</label></td>
          </tr>
        </table>
      </div>-->
   <div class="warning_frame" name="warning_3" id="warning_3" style="background-color:#CED3E8;">
        <table width="383" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="37"><img src="main_images/exclamation-mark_small.png" width="24" height="24" /></td>
            <td width="346"><label class="label_std" style="font-size:12px;">You cannot log in from your present location</label></td>
          </tr>
        </table>
   </div>   
      
      
      </td>
  </tr>
  <tr>
    <td height="155" colspan="2" align="left" valign="middle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="main_images/tlhomeso_logo_white.png" width="90" height="40" />&nbsp;&nbsp;<img src="main_images/radstone_logo_white.png" width="90" height="33" />&nbsp;&nbsp;<img src="main_images/radstone_rmc_logo_white.png" width="90" height="33" />&nbsp;&nbsp;<img src="main_images/logo_vertex.png" width="112" height="50" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<img src="main_images/Pecus_logo.png" width="112" height="50" /></td>
  </tr>
</table>

  

</body>
</html>