I had recently developed an bio-metric attendance system for my company in Java and created an attendance management panel in PHP for every one to view their in/out times, working hours etc. However it came to light of the HR department some time later that people were misusing their working hours and going outside for smoke/chat and not thumbing out. This was of grave concern to the management and they wanted HR to thumb out staff members who did not do it themselves and have it mentioned on their attendance sheet so that they can be asked for their reason of not doing so.
I thought of writing code code in PHP and giving access to the concerned HR staff member but thought other wise as any body who got access to the PHP script could deduce what was happening and some how sabotage the whole process. So I thought of writing the code in Java and then calling that code from PHP so that even if some one is able to access the PHP script they are unable to make any changes to it.
I compiled the Java code into a JAR file and then placed it in a folder on the computer where the PHP panel was being run from. As it was a Windows 7 PC I gave IUSER permission to execute the JAR file and then wrote the following code in the PHP script.
exec('java -jar ForceOut.jar '. (int)$_POST['empid'], $response);
Perform other message printing actions here and redirect visitor to another page
The $response variable contains the return status of the executed command i.e. whether it was successful or not.
Hope the above helped some one. Please let me know how it goes.