1
0
Fork 0

adapt to real environment

git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@33 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
Jan Dittberner 2004-05-10 19:46:56 +00:00
parent 2641ac4f10
commit f6ca9aa8a1
5 changed files with 23 additions and 19 deletions

View file

@ -10,9 +10,9 @@ include("domainstatustypes.php");
<?php
$query=sprintf("SELECT * FROM domain WHERE client=%d",
$_SESSION["client"]);
$result=pg_query($dbh, $query);
$result=db_query($dbh, $query);
$rows=pg_num_rows($result);
$rows=db_num_rows($result);
if ($rows==0) {
print("<p>" . _("You don't have any domains registered.") . "</p>");
}
@ -20,7 +20,7 @@ else {
print("<p>" . _("Here is a list of your currently registered domains.") . "</p>");
printf("<table><tr><th>%s</th><th>%s</th></tr>",
_("Domain name"), _("Status"));
while ($row=pg_fetch_array($result)) {
while ($row=db_fetch_array($result)) {
printf("<tr><td>%s</td><td>%s</td></tr>",
$row["domainname"], get_domainstatustype_name($row["status"]));
}
@ -31,4 +31,4 @@ else {
<a href="registerdomain.php"><?php print(_("Add domain")); ?></a>
<?php
include("commonfoot.php");
?>
?>

View file

@ -30,7 +30,7 @@ function country_selbox($varname, $default=0) {
global $dbh;
$result=db_query($dbh, "SELECT * FROM country ORDER BY name");
printf("<SELECT name=\"%s\">", $varname);
while ($row=pg_fetch_array($result)) {
while ($row=db_fetch_array($result)) {
printf("<OPTION value=\"%d\"%s>%s</OPTION>",
$row["id"], ($row["id"]==$default) ? " selected" : "",
$row["name"]);
@ -45,7 +45,7 @@ function client_selbox($varname, $default=0) {
"WHERE cl.country=co.id ORDER BY cl.firstname, ".
"cl.lastname");
printf("<SELECT name=\"%s\">", $varname);
while ($row=pg_fetch_array($result)) {
while ($row=db_fetch_array($result)) {
printf("<OPTION value=\"%d\"%s>%s %s (%s, %s)</OPTION>",
$row["id"], ($row["id"]==$default) ? " selected" : "",
$row["firstname"], $row["lastname"], $row["town"],
@ -182,4 +182,4 @@ default: ?>
You are trying to trick me. I don't like this
<?php endswitch; ?>
</body>
</html>
</html>

View file

@ -10,7 +10,7 @@ $query = "SELECT * FROM sysuser WHERE name='$username' AND md5pass='$password'";
//echo $query;
$result = db_query($dbh, $query) or die("query failed");
if (pg_num_rows($result) == 0) {
if (db_num_rows($result) == 0) {
$logged_in = false;
authenticate();
echo $_SERVER['PHP_AUTH_USER'];
@ -18,7 +18,7 @@ if (pg_num_rows($result) == 0) {
} else {
$logged_in = true;
session_start();
$row=pg_fetch_array($result);
$row=db_fetch_array($result);
$_SESSION["userid"]=$row["id"];
}
@ -42,4 +42,4 @@ if (! $logged_in) {
</div>
<?php
include("commonfoot.php");
?>
?>

View file

@ -1,6 +1,6 @@
<?php
require("../config.php");
require("/var/local/gvadm/config.php");
function db_open() {
global $config;
@ -23,11 +23,15 @@ function db_close($dbh) {
}
function db_query($dbh, $query) {
$result = pg_query($dbh, $query)
$result = pg_exec($dbh, $query)
or die("Couldn't query database!");
return $result;
}
function db_num_rows($result) {
return pg_num_rows($result);
}
return pg_numrows($result);
}
function db_fetch_array($sth) {
return pg_fetch_array($sth);
}

View file

@ -12,8 +12,8 @@ require_once("usertypes.php");
$query=sprintf("SELECT name, type, client FROM sysuser WHERE id=%d",
$_SESSION["userid"]);
$result=pg_query($dbh, $query);
$row=pg_fetch_array($result);
$result=db_query($dbh, $query);
$row=db_fetch_array($result);
printf(_("Logged in as %s (%s)"), $row["name"],
get_usertype_name($row["type"]));
@ -21,11 +21,11 @@ print("<br/>");
$_SESSION["client"]=$row["client"];
$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);
$result=db_query($dbh, $query);
$row=db_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"]);
?>
</p></td></tr></table>
</div>
</div>