Aloha,
The system has been in use for a few weeks now and it turns out it’s pretty inconvenient for the staff to use.
Even I didn’t feel like logging into the site every time I wanted to change my status.
Solution (well at least before we get the magnetic switches installed):
Make a desktop app that can be set to run at start-up and remembers your username and password so that you don’t have to log in all the time.
Video of it in action:
So to use it you simply enter your username and password and then click one of the three coloured buttons to change your status.
You can also change the message displayed to the students directly from the app by entering it into the text box and then clicking the “Update” button.
It was surprisingly easy to do. I did it in Visual Studio 2013 in C#.
Below is some of the code used:
url = "http://ictcms.tut.ac.za/censored.php?message=0&&status="+state.ToString()+"&&staffNo=" + username.Text + "&&pwd=" + password.Text; HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string responseText = reader.ReadToEnd(); infoLabel.Text = responseText; string passText = password.Text; //encrypt pwd
So essentially C# can perform a WebRequest with a specified URL to which I append the variables that I need to send over to the web page.
I then get a response from the page which is streamed into the StreamReader and displayed onto a label on the form.
Thereafter I encrypt the password before storing it along with the username.
I simply store this into a file. This file is then read from when the form is loaded and its contents then populates the username and password fields.
Here is a nice tutorial on basic file handling in C#:
https://msdn.microsoft.com/en-us/library/8bh11f1k.aspx
The WebRequest used above relies of course on you having a php file that can get the data from that URL and store it into the database.
That is simply done as seen here (the GET part):
$staffNo = $_GET['staffNo']; $status = $_GET['status']; $pwd = $_GET['pwd']; $message = $_GET['message'];