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
This commit is contained in:
parent
69f7fbb050
commit
4c553504b2
7 changed files with 300 additions and 7 deletions
44
php/start.php
Normal file
44
php/start.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
require("wantauth.php");
|
||||
require("tools.php");
|
||||
|
||||
$dbh = db_open();
|
||||
$username = strtolower(substr(trim($_SERVER['PHP_AUTH_USER']), 0, 12));
|
||||
$password = md5(substr(trim($_SERVER['PHP_AUTH_PW']), 0, 30));
|
||||
$query = "SELECT * FROM sysuser WHERE name='$username' AND md5pass='$password'";
|
||||
//echo $query;
|
||||
$result = pg_query($dbh, $query) or die("query failed");
|
||||
|
||||
if (pg_num_rows($result) == 0) {
|
||||
$logged_in = false;
|
||||
authenticate();
|
||||
echo $_SERVER['PHP_AUTH_USER'];
|
||||
echo "NOT LOGGED IN<br/>";
|
||||
} else {
|
||||
$logged_in = true;
|
||||
session_start();
|
||||
$row=pg_fetch_array($result);
|
||||
$_SESSION["userid"]=$row["id"];
|
||||
}
|
||||
pg_close($dbh);
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>GNU-Viech Administration tool</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if (! $logged_in) {
|
||||
echo _("You're not known to the system.")."<br/>";
|
||||
echo _("Please go back and try again.");
|
||||
} else {
|
||||
echo _("Session with ID: ").session_id()."<br/>";
|
||||
echo _("UID: ").$_SESSION["userid"]."<br/>";
|
||||
printf(_("You may now see your <a href=\"%s\">Domain list</a>."),
|
||||
"domainlist.php");
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue