1
0
Fork 0

User information separated to extra file

git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@25 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
Jan Dittberner 2003-12-20 13:47:49 +00:00
parent 68203779c0
commit a35d786f5b
4 changed files with 51 additions and 2 deletions

BIN
php/images/gnu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -34,8 +34,9 @@ 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/>";
include("userhead.php");
// 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");
}

31
php/userhead.php Normal file
View file

@ -0,0 +1,31 @@
<div>
<table>
<tr><td>
<img src="images/gnu.png" width="45" height="43" alt="small GNU head"/>
</td><td>
<p>
<?php
require("usertypes.php");
$dbh = db_open();
$query=sprintf("SELECT name, type, client FROM sysuser WHERE id=%d",
$_SESSION["userid"]);
$result=pg_query($dbh, $query);
$row=pg_fetch_array($result);
printf(_("Logged in as %s (%s)"), $row["name"],
get_usertype_name($row["type"]));
print("<br/>");
$query=sprintf("SELECT client.*, country.name AS cname FROM client, country WHERE client.id=%d AND country.id=client.country", $row["client"]);
$result=pg_query($dbh, $query);
$row=pg_fetch_array($result);
printf("%s %s, %s %s, %s %s, %s %s", $row["firstname"], $row["lastname"],
$row["address1"], $row["address2"], $row["zipcode"], $row["town"],
$row["state"], $row["cname"]);
db_close($dbh);
?>
</p></td></tr></table>
</div>

View file

@ -4,4 +4,21 @@ define("cUSRADMIN",255);
define("cUSRWEB",128);
define("cUSRMAIL",64);
define("cUSRNONE",0);
function get_usertype_name($usertype) {
switch ($usertype) {
case cUSRADMIN:
return _("Administrator");
break;
case cUSRWEB:
return _("Web user");
break;
case cUSRMAIL:
return _("Mail user");
break;
case cUSRNONE:
default:
return _("Unknown user type");
}
}
?>