HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/awaldron/www/archive/demo/visitor_list.php
<?php
session_start();
include("_functions.php");
dbconnect();
force_login();

$is_admin = check_pgroup($_SESSION[auth_user],5);

if (isset($_POST["submit"])) {
	quickUPDATE("INSERT INTO tbl_visitors (vis_name,vis_party,vis_company,vis_visiting,vis_eta,vis_in,username,vis_notes) VALUES ('".$_POST["vis_name"]."',".$_POST["vis_party"].",'".$_POST["vis_company"]."','".$_POST["vis_visiting"]."',".time().",".time().",'".$_POST["username"]."','".$_POST["vis_notes"]."')");
	header("Location: visitor_list.php");
}

if (isset($_POST[vis_badge_in])) {
	quickUPDATE("UPDATE tbl_visitors SET vis_badge='".$_POST[vis_badge_in]."' WHERE vis_id=".$_POST[vis_id]);
	header("Location: visitor_list.php");
}
?>

<html>
<head>
<title>Vocollect Inc. : Registered Visitors</title>
<META HTTP-EQUIV=Refresh CONTENT="90; URL=http://intranet.vocollect.int/administration/visitor_list.php"> 

<style type="text/css">

#dhtmltooltip{
position: absolute;
width: 150px;
border: 2px solid black;
padding: 2px;
background-color: lightyellow;
visibility: hidden;
z-index: 100;
/*Remove below line to remove shadow. Below line should always appear last within this CSS*/
filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
}

td { padding-left:4px; }

a.linkname { color:#000000; font-weight:normal; text-decoration:none; }
a.linkname:link, a.linkname:active, a.linkname:visited { color:#000000; font-weight:normal; text-decoration:none; }
a.linkname:hover { color:#000000; font-weight:normal; text-decoration:underline; }

a.linkout { color:#777777; font-weight:normal; text-decoration:none; }
a.linkout:link, a.linkout:active, a.linkout:visited { color:#777777; font-weight:normal; text-decoration:none; }
a.linkout:hover { color:#777777; font-weight:normal; text-decoration:underline; }

</style>

</head>
<link rel="stylesheet" type="text/css" href="../default.css">
<body onLoad="document.quickguest.vis_name.focus();">

<div id="dhtmltooltip"></div>

<script type="text/javascript">

/***********************************************
* Cool DHTML tooltip script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=20 //Customize x offset of tooltip
var offsetypoint=-5 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

</script>

<?php

if (isset($_GET["in"])) quickUPDATE("UPDATE tbl_visitors SET vis_in=".time()." WHERE vis_id=".$_GET["in"]);
else if (isset($_GET["out"])) quickUPDATE("UPDATE tbl_visitors SET vis_out=".time()." WHERE vis_id=".$_GET["out"]);

if (isset($_GET["d"])) {
	$y = substr($_GET["d"],0,4);
	$m = substr($_GET["d"],4,2);
	$d = substr($_GET["d"],6,2);
} else {
	$y = date("Y");
	$m = date("m");
	$d = date("d");
}
$min = mktime(0,0,0,$m,$d,$y);
$max = mktime(23,59,59,$m,$d,$y);
$next = substr(date_unixtots($min+86400),0,8);
$prev = substr(date_unixtots($min-86400),0,8);

$title = "<div id=\"red\" style=\"font:bold 24px Verdana;margin-bottom:8px;\">".CMP_NAME_INF."&nbsp;Visitors&nbsp;List</div>\n";
$title .=  "<div class=\"subhead\"><a href=\"visitor_list.php?d=".$prev."\"><img src=\"/gui/b_left.gif\" border=0></a>&nbsp;&nbsp;&nbsp;&nbsp;".date("F j, Y",$min)."&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"visitor_list.php?d=".$next."\"><img src=\"/gui/b_right.gif\" border=0></a></div>\n";

echo "<br><center>".$title;

echo "<P><table bgcolor=#C0C0C0 width=98% border=0 cellspacing=1 cellpadding=2 style=\"font:12px Arial;color:#000000\">\n";
echo "<tr style=\"font:bold 12px Arial;color:#FFFFFF;background:#".dbVAR("color_tbar")."\">";
echo "<td align=\"center\">#</td><td>Visitor's Name</td><td>Company</td><td align=\"center\">Party</td><td>ETA</td><td>Check-In</td><td>Check-Out</td><td>Visiting</td><td>Registered By</td><td>Status</td></tr>\n";

	$sql = "SELECT * FROM tbl_visitors WHERE vis_eta > '".$min."' AND vis_eta < '".$max."' ORDER BY vis_active DESC, vis_out ASC, vis_in DESC, vis_eta ASC";
	$res = mysql_query($sql);	
	if (mysql_num_rows($res) > 0) {
		$pre_status = "";
		for ($i=0; $i < mysql_num_rows($res); $i++) {
			$r = mysql_fetch_array($res);
			
			if ($r["vis_active"] == 0) { $sid=1; $status = "Deleted"; }
			else if (($r["vis_in"] == 0) && ($r["vis_out"] == 0)) { $sid=2; $status = "Yet to Arrive"; }
			else if (($r["vis_in"] != 0) && ($r["vis_out"] == 0)) { $sid=3; $status = "On Campus"; }
			else if (($r["vis_in"] != 0) && ($r["vis_out"] != 0)) { $sid=4; $status = "Complete"; }
			else if (($r["vis_eta"] < time()) && ($r["vis_in"] == 0) && (time() < $max)) { $sid=5; $status = "Late"; }
			else if (($r["vis_eta"] < time()) && ($r["vis_in"] == 0) && (time() > $max)) { $sid=5; $status = "Did Not Show"; }
			else { $sid=6; $status = "Undefined"; }
			
			if (($status != $pre_status) && !zero($pre_status)) {
				echo "<tr><td colspan=11><img src=\"/gui/clear.gif\" width=1 height=1></td></tr>\n";
			}
			
			$note = "&nbsp;&nbsp;&nbsp;<a href=\"#\" onMouseover=\"ddrivetip('".str_replace("\r\n"," ",addslashes($r["vis_notes"]))."','#FFE9A7', 300)\"; onMouseout=\"hideddrivetip()\"><img src=\"/gui/vis_note.gif\" border=0></a>\n";
			if ($r["vis_active"]==0) {
				$style = " style=\"text-decoration:line-through;color:777777\"";
				$class = "linkout";
			} else if ($r["vis_out"]!=0 && $r["vis_out"]!=0) {
				$style = " style=\"color:777777\"";
				$class = "linkout";
			} else {
				$style = "";
				$class = "linkname";
			}
			
			echo "<tr bgcolor=\"#".($i%2==0?"FFFFFF":"EEEEEE")."\"".$style.">";
			echo "<td align=\"center\">".($i+1)."</td>\n";
			//echo "<form action=\"".self()."\" method=\"post\"><input type=\"hidden\" name=\"vis_id\" value=\"".$r[vis_id]."\"><td align=\"center\"><input type=\"text\" name=\"vis_badge_in\" value=\"".(!zero($r[vis_badge])?$r[vis_badge]:"")."\" maxlength=10 style=\"border:0px;background:transparent;text-align:center;margin:0px;padding:0px;font:12px Arial;width:24px;\"></td></form>\n";
			echo "<td><b>".(zero($r["vis_name"])?$r["vis_company"]:$r["vis_name"])."</b>".(($status != "Deleted") && !zero($r[vis_notes])?$note:"")."</td>\n";
			echo "<td>".$r["vis_company"]."</td>\n";
			echo "<td align=\"center\">".($r["vis_party"]+1)."</td>\n";
			echo "<td>".date("h:i a",$r["vis_eta"])."</td>\n";
			echo "<td>".($r["vis_active"]==0?"Check-In":($r["vis_in"]==0?"<a href=\"".$_SERVER["PHP_SELF"]."?".(isset($_GET["d"])?"d=".$_GET["d"]."&":"")."in=".$r["vis_id"]."\">Check-In</a>":date("h:i a",$r["vis_in"])))."</td>\n";
			echo "<td>".($r["vis_active"]==0?"Check-Out":($r["vis_out"]!=0?date("h:i a",$r["vis_out"]):($r["vis_in"]!=0?"<a href=\"".$_SERVER["PHP_SELF"]."?".(isset($_GET["d"])?"d=".$_GET["d"]."&":"")."out=".$r["vis_id"]."\">Check-Out</a>":"")))."</td>\n";
			echo "<td><a href=\"/profile.php?u=".$r["vis_visiting"]."\" class=\"".$class."\" target=\"user\">".get_user($r["vis_visiting"],"fullname")."</a> &nbsp; ( ".get_user($r["vis_visiting"],"ext")." )</td>\n";
			echo "<td><a href=\"/profile.php?u=".$r["username"]."\" class=\"".$class."\" target=\"user\">".get_user($r["username"],"fullname")."</a> &nbsp; ( ".get_user($r["username"],"ext")." )</td>\n";
			
			echo "<td><span";
			if ($sid==5) echo " style=\"color:#CC0000;\"";
			else if ($sid==4) echo " style=\"color:#009900;\"";
			else if ($sid==3) echo " style=\"color:#".dbVAR("color_tbar").";font-weight:bold;\"";
			echo ">".ucwords($status)."</span></td>\n";
			
			echo "</tr>\n";
			//if (($status != "Deleted") && ($r["vis_notes"] != null)) echo "<tr bgcolor=\"#".($i%2==0?"FFFFFF":"EEEEEE")."\"><td colspan=10>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<b>Comments:</b> ".$r["vis_notes"]."</td></tr>\n";
			
			$pre_status = $status;
		}
	} else echo "<tr><td colspan=7><b>** There are no visitors scheduled on this date.</b></td></tr>\n";	

echo "</table>\n";

if ( $is_admin && ((time() < $max) && (time() > $min)) ) {
	
	$empsql = "SELECT username, fname, lname FROM tbl_employees WHERE is_employee=1 ORDER BY lname ASC";
	$empresult = mysql_query($empsql);
	echo "<br><br><form name=\"quickguest\" action=\"".self()."\" method=\"post\">\n";
		echo "<div id=\"heading\" style=\"width:480px\">On-The-Fly Visitor Registration:</div>\n";
		echo "<div id=\"box\" style=\"width:480px\">\n";
		echo "<input type=\"hidden\" name=\"username\" value=\"".$_SESSION["auth_user"]."\">\n";
		echo "<center><table border=0 cellspacing=0 cellpadding=5>\n";
		echo "<tr><td>Guest's Name:</td><td><input type=\"text\" name=\"vis_name\" style=\"width:250px\"".($edit?" value=\"".$v["vis_name"]."\"":"")."></td></tr>\n";
		echo "<tr><td colspan=2># Additional Guests in Party: <input type=\"text\" name=\"vis_party\" style=\"width:30px\"".($edit?" value=\"".$v["vis_party"]."\"":" value=\"0\"")."></td></tr>\n";
		echo "<tr><td>Company:</td><td><input type=\"text\" name=\"vis_company\" style=\"width:250px\"".($edit?" value=\"".$v["vis_company"]."\"":"")."></td></tr>\n";
		echo "<tr><td>Is Visiting:</td><td>";
			echo "<SELECT name=\"vis_visiting\">\n";
			echo "<option value=\"".$_SESSION["auth_user"]."\">-- Please Select ---</option>\n";
			for ($j=0; $j < mysql_num_rows($empresult); $j++) {
				$user = mysql_fetch_array($empresult);
				echo "<option value=\"".$user["username"]."\"".($edit?($user["username"]==$v["vis_visiting"]?" SELECTED":""):($user["username"]==$_SESSION["auth_user"]?" SELECTED":"")).">".$user[lname].", ".$user[fname]."</option>\n";
			}
			echo "</SELECT>\n";
		echo "</td></tr>\n";
		echo "<tr><td valign=\"top\">Comments:</td><td><textarea name=\"vis_notes\" style=\"width:250px;height:50px;\" maxlength=255>".($edit?$v["vis_notes"]:"")."</textarea></td></tr>\n";
		echo "<tr><td>Registered By:</td><td><input type=\"text\" name=\"vis_employee_dummy\" style=\"width:250px\" value=\"".get_user($_SESSION["auth_user"],"fullname")." (x".get_user($_SESSION["auth_user"],"ext").")\" DISABLED></td></tr>\n";
		echo "<tr><td colspan=2 align=\"center\"><input type=\"submit\" class=\"btn\" value=\" ".($edit?"Update Visitor":"Submit Visitor")." \" name=\"submit\"></td></tr>\n";
		echo "</table></center>\n";
	echo "</form>\n";
	
}

echo "</center>\n";



?>