From 4c553504b2e6c0e57b80999e7efd517dba086f2b Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sun, 23 Nov 2003 20:44:06 +0000 Subject: [PATCH] basic setup and login mechanisms are done git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@23 a67ec6bc-e5d5-0310-a910-815c51eb3124 --- php/domainlist.php | 2 + php/index.php | 9 +-- php/setup.php | 192 +++++++++++++++++++++++++++++++++++++++++++++ php/start.php | 44 +++++++++++ php/tools.php | 33 ++++++++ php/usertypes.php | 7 ++ php/wantauth.php | 20 +++++ 7 files changed, 300 insertions(+), 7 deletions(-) create mode 100644 php/domainlist.php create mode 100644 php/setup.php create mode 100644 php/start.php create mode 100644 php/tools.php create mode 100644 php/usertypes.php create mode 100644 php/wantauth.php diff --git a/php/domainlist.php b/php/domainlist.php new file mode 100644 index 0000000..67c94a5 --- /dev/null +++ b/php/domainlist.php @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/php/index.php b/php/index.php index 3524278..5fde13f 100644 --- a/php/index.php +++ b/php/index.php @@ -4,12 +4,7 @@ GNU-Viech Administration tool -
- - - - -
">
-
+
+
\ No newline at end of file diff --git a/php/setup.php b/php/setup.php new file mode 100644 index 0000000..2bc9c8d --- /dev/null +++ b/php/setup.php @@ -0,0 +1,192 @@ +", $varname); + while ($row=pg_fetch_array($result)) { + printf("", + $row["id"], ($row["id"]==$default) ? " selected" : "", + $row["name"]); + } + print(""); +} + +function client_selbox($varname, $default=0) { + global $dbh; + $result=db_query($dbh, "SELECT cl.id, cl.firstname, cl.lastname, ". + "cl.town, co.name FROM client cl, country co ". + "WHERE cl.country=co.id ORDER BY cl.firstname, ". + "cl.lastname"); + printf(""); +} + +function enter_personal_data() { + global $dbh; + $query = sprintf("INSERT INTO client (firstname, lastname, ". + "address1, country, town, zipcode, state, ". + "active) VALUES ('%s', '%s', '%s', %d, '%s', ". + "'%05d', '%s', true)", + $_POST["firstname"], + $_POST["lastname"], + $_POST["address"], + $_POST["country"], + $_POST["town"], + $_POST["zipcode"], + $_POST["state"]); + db_exec($dbh, $query); +} + +function has_personal_data() { + global $dbh; + $result=db_query($dbh, "SELECT id FROM client"); + return (db_num_rows($result)!=0); +} + +function setup_admin_account() { + global $dbh; + $query = sprintf("INSERT INTO sysuser (name, type, home, shell, ". + "password, client, toupdate, md5pass, sysuid) ". + "VALUES ('%s', %d, '/root', true, '%s', ". + "%d, false, '%s', 0)", + $_POST["adminuser"], + cUSRADMIN, + $_POST["adminpass1"], + $_POST["clientid"], + md5($_POST["adminpass1"])); + db_exec($dbh, $query); +} + +function has_admin_account() { + global $dbh; + $query=sprintf("SELECT id FROM sysuser WHERE type=%d", + cUSRADMIN); + $result=db_query($dbh, $query); + return (db_num_rows($result)!=0); +} +?> + + + +GNU-Viech Administration tool Setup + + + +
+ + + + + +
">
+ +
"> + +
+ +
+ + + + + + + + + + + +
">
+ +
"> + +
+ +
+ + + + + + + + +
">
+ +
"> + +
+Start page\"."), "start.php"); +break; +default: ?> +You are trying to trick me. I don't like this + + + \ No newline at end of file diff --git a/php/start.php b/php/start.php new file mode 100644 index 0000000..758e3cc --- /dev/null +++ b/php/start.php @@ -0,0 +1,44 @@ +"; +} else { + $logged_in = true; + session_start(); + $row=pg_fetch_array($result); + $_SESSION["userid"]=$row["id"]; +} +pg_close($dbh); + +?> + + + +GNU-Viech Administration tool + + +"; + echo _("Please go back and try again."); +} else { + echo _("Session with ID: ").session_id()."
"; + echo _("UID: ").$_SESSION["userid"]."
"; + printf(_("You may now see your Domain list."), + "domainlist.php"); +} +?> + + \ No newline at end of file diff --git a/php/tools.php b/php/tools.php new file mode 100644 index 0000000..45d369d --- /dev/null +++ b/php/tools.php @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/php/wantauth.php b/php/wantauth.php new file mode 100644 index 0000000..bd64fcd --- /dev/null +++ b/php/wantauth.php @@ -0,0 +1,20 @@ + \ No newline at end of file