Location: PHPKode > projects > phpLabMan > attendance/attendanceaction.php
<?php require_once('config.php'); 

// *******************
// Check for ID 
// If none, send back to start
// *******************

if (empty($_REQUEST['StudentID'])) {
?>

<html>
<head>
<meta http-equiv="refresh" content="0;URL=index.php?launch=<? echo time() ?>">
</head>
<body>
No student ID.
</body>
</html>

<? } else {
	
	// *******************
	//  PART 1 - Record Attendence
	// *******************
	
	?>
	
	<html>
<head>
<meta http-equiv="refresh" content="1;URL=index.php?launch=<? echo time() ?>">
</head>
<body>

	<?
	
	$StudentID = $_REQUEST['StudentID'];
	
	// Bradley Specific
	if(strlen($StudentID) > 7){
	$StudentID = substr($StudentID, 10, 6);
	//echo "reset ID = " . $StudentID;
	}
	

	mysql_select_db($database_attendance, $attendance);
	$query_Recordset1 = "SELECT * FROM students WHERE StudentID = $StudentID";
	$Recordset1 = mysql_query($query_Recordset1, $attendance) or die(mysql_error());
	$row_Recordset1 = mysql_fetch_assoc($Recordset1);
	$totalRows_Recordset1 = mysql_num_rows($Recordset1);
	
	$ImageTime = date('Y-m-d G:i:s');
	$NewImage = $StudentID . ' '. date("Y-m-d G,i,s") .'.jpg';
	$NewImagePath = '/library/webserver/documents/attendance/images/' . $NewImage;
	
	copy('/library/webserver/documents/attendance/camimages/webcam.jpg', $NewImagePath);


	mysql_select_db($database_attendance, $attendance);
	$query_Recordset2 = "INSERT INTO swipes (StudentID, Time, Image) VALUES ($StudentID, \"$ImageTime\", \"$NewImage\")";
    //echo $query_Recordset2;
	$Recordset2 = mysql_query($query_Recordset2, $attendance) or die(mysql_error());
	


	
	if($row_Recordset1['FirstName']!=""){
	  	echo " " . $row_Recordset1['FirstName'] . " " . $row_Recordset1['LastName'] . ", Your ";
	} 
	
	echo "Attendance Has Been Recorded";
	?><p><img src="images/<? echo $NewImage ?>">
	
	<?
	mysql_free_result($Recordset1);
	//mysql_free_result($Recordset2);
}



 ?>
Return current item: phpLabMan