summaryrefslogtreecommitdiffstats
path: root/notFinishedCode/web/mutexFunctions.php
diff options
context:
space:
mode:
authorRefik Hadzialic2011-09-05 16:14:02 +0200
committerRefik Hadzialic2011-09-05 16:14:02 +0200
commit649f16bf8c065b031d2aab82ea006fd8c211d30d (patch)
treea6e9d3120b141d1cc7db40603011e265e72539ca /notFinishedCode/web/mutexFunctions.php
parentReading the posted variables from web site! (diff)
downloadgsm-selftest-649f16bf8c065b031d2aab82ea006fd8c211d30d.tar.gz
gsm-selftest-649f16bf8c065b031d2aab82ea006fd8c211d30d.tar.xz
gsm-selftest-649f16bf8c065b031d2aab82ea006fd8c211d30d.zip
Added checkbox changes with CSS and javascript, submitting and saving to the DB works fine!
Diffstat (limited to 'notFinishedCode/web/mutexFunctions.php')
-rw-r--r--notFinishedCode/web/mutexFunctions.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/notFinishedCode/web/mutexFunctions.php b/notFinishedCode/web/mutexFunctions.php
new file mode 100644
index 0000000..af45610
--- /dev/null
+++ b/notFinishedCode/web/mutexFunctions.php
@@ -0,0 +1,36 @@
+<?
+//Mutex functions
+function Lock($lockName,$seconds)
+{
+ $sql = "SELECT GET_LOCK('$lockName', $seconds);";
+ $res = mysql_query($sql);
+ if (!$res)
+ {
+ die('Could not query:' . mysql_error());
+ }
+ return mysql_result($res,0);
+}
+
+function IsLocked($lockName)
+{
+ $sql = "SELECT IS_FREE_LOCK('$lockName');";
+ $res = mysql_query($sql);
+ if (!$res)
+ {
+ die('Could not query:' . mysql_error());
+ }
+ return mysql_result($res,0);
+}
+
+function ReleaseLock($lockName)
+{
+ $sql = "SELECT RELEASE_LOCK('$lockName');";
+ $res = mysql_query($sql);
+ if (!$res)
+ {
+ die('Could not query:' . mysql_error());
+ }
+ return mysql_result($res,0);
+}
+//End of mutex functions
+?>