Jump to content

Recommended Posts

Posted

Hiyo!

 

For the past week or so I’ve been working on a method of tracking students logins and logouts, the day before yesterday the mySQL server survived the full day with about 1000 entries made in the day. So now I need to start work on a web GUI for this system.

Basically I’ve started this thread because I feel that you will be able to help me add more features to this system, and eventually help me test it by having it running in your school. I don’t expect this to happen for awhile as currently the system is bespoke to this school’s setup. However, because I’m hoping to use this as my final year project for university I will require a fairly large test base.

 

Currently the system stores the following data:

Logs Username, Computer name, Login time, logout time, reason (Timeout, or proper logout), and logon server.

 

 

A few ideas I've had for the web GUI so far are:

  • Total Number of users currently logged in
  • Total Number of users logged in throughout the current day
  • 'Quick Search' - This will enable admin to search by username or computer name
  • List ICT rooms in the school and show how many users are currently using these rooms
  • Being able to 'flag' known trouble causing users and flag them up on login
  • Pretty managerial type graphs to show room/computer usage
     

 

In the future I’m hoping to be able to overlay some of this information over a map of the school.

 

 

I’d like to hear from you any other features you feel would be useful in a system like this.

 

Thank you for taking the time to read this :D

Posted

It is sometimes useful to know when a particular user last logged in. Handy if they say "I tried to print the coursework at lunchtime, but the printer didn't work"...

 

Another report which would be useful would be to see if/how often every PC in the IT Suite and/or Library is in use, so you could see if you need more resources in those areas to cover peak times of day.

Posted
It would be nice to see how long each person used the computer for too, without needing to work it out yourself using the login and logout time.
Posted
Maybe if it could flag up machines that are on, but not used during the day. That way resources could be moved to better locations.

 

 

I like the idea of that. It may also indicate that there's a fault with that machine.

I'm planning on adding something like this for wireless points later on when it gets to the putting of information onto a map.

 

 

Thanks for all your suggestions, keep them coming :D

Posted

Will this just log student users or all users? (....method of tracking students logins and logouts). It would be useful if it could track all users including admin.

 

Thanks

Posted
Don't you find that Access starts to complain after a while and you have to create a new database for the script to store information in?
Posted

I feel my thread has been hijacked a wee bit... trust someone from Rochdale.. :p

 

My script uses two exe, one for login and one for logout, you can put these in who evers OU you wish!!

 

Everything is stored in an mySQL database and has been running for a few days now, think its at about 5,000 records and querys are still at around 0.001 seconds.

 

 

The web GUI is what i'm currently focusing on now, thank you for your suggestions I'm adding these into my plan as i go along :D

Posted

A way round that would be to run at machine startup. Then log that startup time as the 'unclean' logoff time.

 

That's how PAM on linux deals with it anyway (check out the 'last' command).

Posted

I wrote a system thats something along this line, including something that let me just browse computer rooms for users e.t.c. and tie it straight into various tools like VNC. Here's a screenie.

 

The map is very handy!

ultimatepower.jpg

Posted (edited)
I wrote a system thats something along this line, including something that let me just browse computer rooms for users e.t.c. and tie it straight into various tools like VNC. Here's a screenie.

 

The map is very handy!

 

Now that looks very handy, would you be willing share the system with us?

Edited by SYNACK
Posted

Wouldn't be particularly easy to share, I built it specifically for this school and would require sending over mysql table structures, executables and a series of modified PHP pages (so they're not heavily tied into our intranet any more, this would take a lot of time to fix up).

 

If I only had the time...

 

Sorry guys :(

Posted

Im interested in it.

 

Couldnt you post what you have and let the rest of us Edugeekers pull it to pieces. I looks like it could be a good group project.

Posted (edited)

Friez, Your system is very close to what I'm hoping to achieve at the end of this. Looks very neat indeed :D#

 

What happens if someone just turns the power off rather than log off?

 

On login my script checks to see if that users is already marked as logged in. If they are it marks it as a 'Timeout' showing that it was an unclean logout. The script also checks to see if the current computer that someone is logging into is marked as someone being logged in. If it is it does the same as with the username.

Edited by richard.thomas
Posted

I was in the process of dev'ing something before and I think we shall make this a project. I hope to get the initial project area created this weekend and I will post what I have done. I got a base in and we use it here but I did not get it fully sanitized for general use.

Hopefully we can all work to make this a very useful tool :D

Posted
Logging 'failed' logins (bad passwords, too many concurrent logins, time/workstation restrictions) would be helpful too.
Posted

If you wish to rip apart, here's the mapping bit, not going much into the whole database pushing and pulling malarky though (uses exe files).

 

The map display itself is simple:

 

Main Page:

echo "T1
";
$comproom = "T1";
$roomtemplate = "http://";
$postroomtemplate = ":5800\" target=\"_new\"";
include "compmap.php";

 

compmap.php (this generates CSS hotspot clickable areas for the map):

<br />
img.image{ display: none; }<br />
<br />
<?php<br />
	if($comproom == "T1")<br />
		include "map_t1.php";<br />
	else if($comproom == "T2")<br />
		include "map_t2.php";<br />
	else if($comproom == "T3")<br />
		include "map_t3.php";	<br />
	else if($comproom == "T4")<br />
		include "map_t4.php";<br />
	else if($comproom == "WRLR")<br />
		include "map_wrlr.php";<br />
	else if($comproom == "L5")<br />
		include "map_l5.php";<br />
	else if($comproom == "T5")<br />
		include "map_t5.php";									<br />
	else<br />
		return;<br />
		<br />
	<br />
	$compXpos = array();<br />
	$compYpos = array();<br />
	<br />
	$x=0;<br />
	$y=35;	<br />
	for($i=0; $i<$sideA; $i++)<br />
	{<br />
		array_push($compXpos,$x);<br />
		array_push($compYpos,$y);		<br />
		$y += 35;		<br />
	}<br />
				<br />
	$x=35;<br />
	$y=0;<br />
	for($i=0; $i<$sideB; $i++)<br />
	{<br />
		array_push($compXpos,$x);<br />
		array_push($compYpos,$y);			<br />
		$x+=35;			<br />
	}	<br />
	<br />
	$x=(35*($spacew+$sideB+1));<br />
	$y=35;	<br />
	for($i=0; $i<$sideC; $i++)<br />
	{<br />
		array_push($compXpos,$x);<br />
		array_push($compYpos,$y);			<br />
		$y += 35;		<br />
	}<br />
	<br />
	for($i=0;$i<count($extrasX);$i++)<br />
	{<br />
		$x = $extrasX[$i];<br />
		$y = $extrasY[$i];<br />
		array_push($compXpos,$x);<br />
		array_push($compYpos,$y);				<br />
	}	<br />
	<br />
	$uid = md5(uniqid(rand(), true));<br />
?><br />
<br />
dl#overallMap<?php echo $comproom; ?>{<br />
	margin: 0;<br />
	padding: 0;<br />
	background: transparent url(<?php echo "computermap.php?room=" . $comproom . "&uid=" . $uid; ?>) top left no-repeat;<br />
	height: <?php echo $maxheight; ?>px;<br />
	width: <?php echo $maxwidth; ?>px;<br />
	position: relative;<br />
}<br />
<br />
dt{ margin: 0; padding: 0; position: absolute; font-size: 85%; display: none; }<br />
dd{ margin: 0; padding: 0; position: absolute;  font-size: 85%; }<br />
<br />
<?php<br />
<br />
for($i=0;$i<count($compnames);$i++)<br />
{<br />
	<br />
	echo "dd#tg" . $compnames[$i] . "{ top: " . $compYpos[$i] . "px; left: " . $compXpos[$i] . "px; }\n";<br />
	echo "dd#tg" . $compnames[$i] . " a{ position: absolute; width: 35px; height: 35px; text-decoration: none; }\n";<br />
	echo "dd#tg" . $compnames[$i] . " a span{ display: none; }\n";<br />
	echo "dd#tg" . $compnames[$i] . " a:hover{ position: absolute; background: transparent url(computermap.php?room=" . $comproom . "&uid=" . $uid . ") -" . $compXpos[$i] . "px -" . ($compYpos[$i]+$maxheight) . "px no-repeat; }\n";<br />
<br />
	echo "dd#tg" . $compnames[$i] . " a:hover span{\n";<br />
	?><br />
	display: block;<br />
	text-indent: 0;<br />
	vertical-align: top;<br />
	color: #000;<br />
	background-color: #F4F4F4;<br />
	font-weight: bold;<br />
	position: absolute;<br />
	border: 1px solid #BCBCBC;<br />
	bottom: 150%;<br />
	margin: 0;<br />
	padding: 5px;<br />
	width: 150px;	<br />
	}	<br />
<?php	<br />
}	<br />
<br />
	?><br />
<br />



<?php height= width= class="image" alt="Room Map" />

</pre><dl id="overallMap<?php echo $comproom; ?>">
$numrooms = count($compnames);

if(!isset($link))
{
include "dblogin.php"; // login to the database	
}

for($i=0;$i<$numrooms;$i++)
{
$query3 = 'SELECT * FROM netadmin_loggedinusers WHERE Machine = \'' . $compnames[$i] . '\'';
$result3 = mysql_query($query3);
$line3 = mysql_fetch_array($result3, MYSQL_ASSOC);	

$uloggedname = "";
if($line3['Machine'] != "")
{
	if($line3['InTime'] == $line3['OutTime']) // currently logged in
	{
		$uloggedname = $line3['User'];		
	}
}

echo "" . $compnames[$i] . "
" . $uloggedname . "";	
}

?>

</d

Posted

computermap.php (This generates the actual map image via PHP):




if(isset($_GET['room']))
{
if($_GET['room'] == "T1")
	include "map_t1.php";
else if($_GET['room'] == "T2")
	include "map_t2.php";
else if($_GET['room'] == "T3")
	include "map_t3.php";	
else if($_GET['room'] == "T4")
	include "map_t4.php";
else if($_GET['room'] == "WRLR")
	include "map_wrlr.php";		
else if($_GET['room'] == "L5")
	include "map_l5.php";	
else if($_GET['room'] == "T5")
	include "map_t5.php";								
else
	return;

$killlink = false;		
if(!isset($link)) // no SQL link
{
include "dblogin.php"; // login to the database	
	$killlink = true;		
}		
			
$im = imagecreatetruecolor($maxwidth, $maxheight*2);

$whi = imagecolorallocate($im, 255, 255,255);
imagefill($im, 0, 0, $whi);

$color = imagecolorallocate($im, 0, 0, 0);

$x=0;
$y=35;

$c=0;


for($i=0; $i<$sideA; $i++)
{
	$size = 32;
	$comp = array(
		$x,$y,
		$x+$size,$y,
		$x+$size,$y+$size,
		$x,$y+$size
		);
	
	$comp2 = array(
		$x,$y+$maxheight,
		$x+$size,$y+$maxheight,
		$x+$size,$y+$size+$maxheight,
		$x,$y+$size+$maxheight
		);			
			
		
	$query = 'SELECT * FROM	netadmin_loggedinusers WHERE Machine = \'' . $compnames[$c] . '\'';
	$result = mysql_query($query);
	$line = mysql_fetch_array($result, MYSQL_ASSOC);
	
	$color = imagecolorallocate($im, 0, 0, 0);
	$col2 = imagecolorallocate($im, 0, 0, 192);
	if($line['Machine'] != "")
	{
		if($line['InTime'] == $line['OutTime']) // currently logged in
		{
			$color = imagecolorallocate($im, 198, 72, 72);
			$col2 = imagecolorallocate($im, 128, 128, 255);					
		}	
	}	
	mysql_free_result($result);		
	
	imagefilledpolygon($im, $comp, 4, $color);		
	imagestring($im, 1, $x, $y,  $compnames[$c], $whi);	

	imagefilledpolygon($im, $comp2, 4, $col2);		
	imagestring($im, 1, $x, $y+$maxheight,  $compnames[$c], $whi);	
			
	$y += 35;
	$c++;
}

$x=35;
$y=0;
for($i=0; $i<$sideB; $i++)
{
	$size = 32;
	$comp = array(
		$x,$y,
		$x+$size,$y,
		$x+$size,$y+$size,
		$x,$y+$size
		);
	$comp2 = array(
		$x,$y+$maxheight,
		$x+$size,$y+$maxheight,
		$x+$size,$y+$size+$maxheight,
		$x,$y+$size+$maxheight
		);				
		
	$query = 'SELECT * FROM	netadmin_loggedinusers WHERE Machine = \'' . $compnames[$c] . '\'';
	$result = mysql_query($query);
	$line = mysql_fetch_array($result, MYSQL_ASSOC);
	
	$color = imagecolorallocate($im, 0, 0, 0);
	$col2 = imagecolorallocate($im, 0, 0, 192);
	if($line['Machine'] != "")
	{
		if($line['InTime'] == $line['OutTime']) // currently logged in
		{
			$color = imagecolorallocate($im, 198, 72, 72);
			$col2 = imagecolorallocate($im, 128, 128, 255);					
		}	
	}		
	mysql_free_result($result);				
		
	imagefilledpolygon($im, $comp, 4, $color);	
	imagestring($im, 1, $x, $y,  $compnames[$c], $whi);	
	
	imagefilledpolygon($im, $comp2, 4, $col2);		
	imagestring($im, 1, $x, $y+$maxheight,  $compnames[$c], $whi);				
	
	$x+=35;	
	$c++;
}
	
$x=(35*($spacew+$sideB+1));
$y=35;

for($i=0; $i<$sideC; $i++)
{
	$size = 32;
	$comp = array(
		$x,$y,
		$x+$size,$y,
		$x+$size,$y+$size,
		$x,$y+$size
		);
	$comp2 = array(
		$x,$y+$maxheight,
		$x+$size,$y+$maxheight,
		$x+$size,$y+$size+$maxheight,
		$x,$y+$size+$maxheight
		);				
		
	$query = 'SELECT * FROM	netadmin_loggedinusers WHERE Machine = \'' . $compnames[$c] . '\'';
	$result = mysql_query($query);
	$line = mysql_fetch_array($result, MYSQL_ASSOC);
	
	$color = imagecolorallocate($im, 0, 0, 0);
	$col2 = imagecolorallocate($im, 0, 0, 192);
	if($line['Machine'] != "")
	{
		if($line['InTime'] == $line['OutTime']) // currently logged in
		{
			$color = imagecolorallocate($im, 198, 72, 72);
			$col2 = imagecolorallocate($im, 128, 128, 255);					
		}	
	}	
	mysql_free_result($result);				
		
	imagefilledpolygon($im, $comp, 4, $color);
	imagestring($im, 1, $x, $y,  $compnames[$c], $whi);		
	
	imagefilledpolygon($im, $comp2, 4, $col2);		
	imagestring($im, 1, $x, $y+$maxheight,  $compnames[$c], $whi);			

	
				
	$y += 35;
	$c++;
}


for($i=0;$i	{
	$x = $extrasX[$i];
	$y = $extrasY[$i];
	$size = 32;
	$comp = array(
		$x,$y,
		$x+$size,$y,
		$x+$size,$y+$size,
		$x,$y+$size
		);
	$comp2 = array(
		$x,$y+$maxheight,
		$x+$size,$y+$maxheight,
		$x+$size,$y+$size+$maxheight,
		$x,$y+$size+$maxheight
		);				
		
	$query = 'SELECT * FROM	netadmin_loggedinusers WHERE Machine = \'' . $compnames[$c] . '\'';
	$result = mysql_query($query);
	$line = mysql_fetch_array($result, MYSQL_ASSOC);
	
	$color = imagecolorallocate($im, 0, 0, 0);
	$col2 = imagecolorallocate($im, 0, 0, 192);
	if($line['Machine'] != "")
	{
		if($line['InTime'] == $line['OutTime']) // currently logged in
		{
			$color = imagecolorallocate($im, 198, 72, 72);
			$col2 = imagecolorallocate($im, 128, 128, 255);					
		}	
	}	
	mysql_free_result($result);				
		
	imagefilledpolygon($im, $comp, 4, $color);	
	imagestring($im, 1, $x, $y,  $compnames[$c], $whi);		
	
	imagefilledpolygon($im, $comp2, 4, $col2);		
	imagestring($im, 1, $x, $y+$maxheight,  $compnames[$c], $whi);			
				
	$c++;
}
	
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);

if($killlink)
{
	mysql_close($link);	
}
}
?> 

 

 

 

Example Map File (map_t1.php):

$sideA = 6;
$sideB = 5;
$sideC = 0;
$extrasX = array(
210,
210,
175,
140,
105,
70,
70,
105,
140,
175,
210,
210,
175,
140,
105,
70,
122,
);
$extrasY = array(
35,
70,
105,
105,
105,
105,
140,
140,
140,
140,
175,
210,
245,
245,
245,
245,
280,
);

$maxheight = (35 * 9);
$maxwidth = (35 * ($sideB+2));

$spacew=0;

$compnames = array(
"T1-06",
"T1-05",
"T1-04",
"T1-03",
"T1-02",
"T1-01",
"T1-07",
"T1-08",
"T1-09",
"T1-10",
"T1-11",
"T1-12",
"T1-13",
"T1-14",
"T1-15",
"T1-16",
"T1-17",
"T1-18",
"T1-19",
"T1-20",
"T1-21",
"T1-22",
"T1-23",
"T1-24",
"T1-25",
"T1-26",
"T1-27",
"T1-28",
);

?>

 

Note: The order machines are put in is particularly important. Due to the way our rooms are structured we generally have two/three sides of the rooms with computers on (hence the number of pcs listed for each side) and then any extras we tack on specific coordinates for. The sides are looped through, and then the extra machines, therefore the namelist is in specific order.

 

This could be MUCH cleaner, but I lack the time :p

Good luck finding your way around this code! >_<

I hope its of some use though.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...