summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2018-06-25 21:02:25 +0000
committerIan C <ianc@noddybox.co.uk>2018-06-25 21:02:25 +0000
commit52d3b59d43d1c4894a38d47b9606c0f1cff95156 (patch)
tree55e923759a23288b4bda2c5f24541659c48c0508
parent22e2906e30fde29271b1a0f1db08023551b9d8ec (diff)
Added group parameter to PHP pages and started on Load functionality.
-rw-r--r--www/add.php7
-rw-r--r--www/css/main.css3
-rw-r--r--www/edit.php3
-rw-r--r--www/get.php3
-rw-r--r--www/index.html8
-rw-r--r--www/scripts/main.js38
6 files changed, 56 insertions, 6 deletions
diff --git a/www/add.php b/www/add.php
index fe21344..7b9d99f 100644
--- a/www/add.php
+++ b/www/add.php
@@ -28,13 +28,16 @@ try
$db = ConnectDB();
$description = $_REQUEST["description"];
+ $group = $_REQUEST["group"];
$username = $_REQUEST["username"];
$password = $_REQUEST["password"];
$cmd = $db->prepare("INSERT INTO pm_store " .
- "(description, username, password) values " .
- "(:description, :username, :password)");
+ "(description, groupname, username, password) ".
+ "values " .
+ "(:description, :group, :username, :password)");
$cmd->bindParam(":description", $description);
+ $cmd->bindParam(":group", $group);
$cmd->bindParam(":username", $username);
$cmd->bindParam(":password", $password);
$cmd->execute();
diff --git a/www/css/main.css b/www/css/main.css
index abc572b..558da6c 100644
--- a/www/css/main.css
+++ b/www/css/main.css
@@ -4,11 +4,10 @@ body
font-size: large;
}
-span.smalltext
+.smalltext
{
font-size: small;
}
-
/* vim: sw=4 ts=4
*/
diff --git a/www/edit.php b/www/edit.php
index 9e78e88..7bcd604 100644
--- a/www/edit.php
+++ b/www/edit.php
@@ -29,15 +29,18 @@ try
$id = $_REQUEST["id"];
$description = $_REQUEST["description"];
+ $group = $_REQUEST["group"];
$username = $_REQUEST["username"];
$password = $_REQUEST["password"];
$cmd = $db->prepare("UPDATE pm_store " .
"set description=:description, " .
+ "groupname=:group, " .
"username=:username, " .
"password=:password where id = :id");
$cmd->bindParam(":id", $id);
$cmd->bindParam(":description", $description);
+ $cmd->bindParam(":group", $group);
$cmd->bindParam(":username", $username);
$cmd->bindParam(":password", $password);
$cmd->execute();
diff --git a/www/get.php b/www/get.php
index 268bf5b..d42e57e 100644
--- a/www/get.php
+++ b/www/get.php
@@ -29,11 +29,12 @@ try
$index = 0;
- foreach ($db->query("SELECT * FROM pm_store") as $row)
+ foreach ($db->query("SELECT * FROM pm_store ORDER BY id") as $row)
{
$data = array();
$data["id"] = $row["id"];
$data["description"] = $row["description"];
+ $data["group"] = $row["groupname"];
$data["username"] = $row["username"];
$data["password"] = $row["password"];
diff --git a/www/index.html b/www/index.html
index ad0c0ed..512ac8f 100644
--- a/www/index.html
+++ b/www/index.html
@@ -13,7 +13,13 @@
Passphrase: <input type="password" id="PassPhrase">
&nbsp;
&nbsp;
-<input type="button" id="LoadButton" value="Load" onclick="DoLoad">
+<input type="button" id="LoadButton" value="Load" onclick="DoLoad()">
+<br>
+Group:
+<select id="Group">
+</select>
+&nbsp;&nbsp;
+<input type="text" id="NewGroup" maxlength="512">
<hr>
diff --git a/www/scripts/main.js b/www/scripts/main.js
index e3c1f7b..d8f03ca 100644
--- a/www/scripts/main.js
+++ b/www/scripts/main.js
@@ -1,4 +1,6 @@
+var globalDb;
+
function AESEncrypt(source, phrase)
{
var encryptedAES = CryptoJS.AES.encrypt(source, phrase);
@@ -13,4 +15,40 @@ function AESDecrypt(source, phrase)
return decryptedBytes.toString(CryptoJS.enc.Latin1);
}
+function WebRequest(url, func, args)
+{
+ var f;
+
+ for(f = 0; f < args.length; f += 2)
+ {
+ if (f == 0)
+ {
+ url += "?";
+ }
+ else
+ {
+ url += "#";
+ }
+
+ url += args[f] + "=";
+ url += encodeURIComponent(args[f+1]);
+ }
+
+ var req = new XMLHttpRequest();
+
+ req.addEventListener("load", func);
+ req.open("GET", url);
+ req.send();
+}
+
+function DoLoadAsync()
+{
+ globalDb = JSON.parse(this.responseText);
+}
+
+function DoLoad()
+{
+ WebRequest("get.php", DoLoadAsync, []);
+}
+
// vim: sw=4 ts=4