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:
parent
2641ac4f10
commit
f6ca9aa8a1
5 changed files with 23 additions and 19 deletions
|
@ -10,9 +10,9 @@ include("domainstatustypes.php");
|
||||||
<?php
|
<?php
|
||||||
$query=sprintf("SELECT * FROM domain WHERE client=%d",
|
$query=sprintf("SELECT * FROM domain WHERE client=%d",
|
||||||
$_SESSION["client"]);
|
$_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) {
|
if ($rows==0) {
|
||||||
print("<p>" . _("You don't have any domains registered.") . "</p>");
|
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>");
|
print("<p>" . _("Here is a list of your currently registered domains.") . "</p>");
|
||||||
printf("<table><tr><th>%s</th><th>%s</th></tr>",
|
printf("<table><tr><th>%s</th><th>%s</th></tr>",
|
||||||
_("Domain name"), _("Status"));
|
_("Domain name"), _("Status"));
|
||||||
while ($row=pg_fetch_array($result)) {
|
while ($row=db_fetch_array($result)) {
|
||||||
printf("<tr><td>%s</td><td>%s</td></tr>",
|
printf("<tr><td>%s</td><td>%s</td></tr>",
|
||||||
$row["domainname"], get_domainstatustype_name($row["status"]));
|
$row["domainname"], get_domainstatustype_name($row["status"]));
|
||||||
}
|
}
|
||||||
|
@ -31,4 +31,4 @@ else {
|
||||||
<a href="registerdomain.php"><?php print(_("Add domain")); ?></a>
|
<a href="registerdomain.php"><?php print(_("Add domain")); ?></a>
|
||||||
<?php
|
<?php
|
||||||
include("commonfoot.php");
|
include("commonfoot.php");
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -30,7 +30,7 @@ function country_selbox($varname, $default=0) {
|
||||||
global $dbh;
|
global $dbh;
|
||||||
$result=db_query($dbh, "SELECT * FROM country ORDER BY name");
|
$result=db_query($dbh, "SELECT * FROM country ORDER BY name");
|
||||||
printf("<SELECT name=\"%s\">", $varname);
|
printf("<SELECT name=\"%s\">", $varname);
|
||||||
while ($row=pg_fetch_array($result)) {
|
while ($row=db_fetch_array($result)) {
|
||||||
printf("<OPTION value=\"%d\"%s>%s</OPTION>",
|
printf("<OPTION value=\"%d\"%s>%s</OPTION>",
|
||||||
$row["id"], ($row["id"]==$default) ? " selected" : "",
|
$row["id"], ($row["id"]==$default) ? " selected" : "",
|
||||||
$row["name"]);
|
$row["name"]);
|
||||||
|
@ -45,7 +45,7 @@ function client_selbox($varname, $default=0) {
|
||||||
"WHERE cl.country=co.id ORDER BY cl.firstname, ".
|
"WHERE cl.country=co.id ORDER BY cl.firstname, ".
|
||||||
"cl.lastname");
|
"cl.lastname");
|
||||||
printf("<SELECT name=\"%s\">", $varname);
|
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>",
|
printf("<OPTION value=\"%d\"%s>%s %s (%s, %s)</OPTION>",
|
||||||
$row["id"], ($row["id"]==$default) ? " selected" : "",
|
$row["id"], ($row["id"]==$default) ? " selected" : "",
|
||||||
$row["firstname"], $row["lastname"], $row["town"],
|
$row["firstname"], $row["lastname"], $row["town"],
|
||||||
|
@ -182,4 +182,4 @@ default: ?>
|
||||||
You are trying to trick me. I don't like this
|
You are trying to trick me. I don't like this
|
||||||
<?php endswitch; ?>
|
<?php endswitch; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -10,7 +10,7 @@ $query = "SELECT * FROM sysuser WHERE name='$username' AND md5pass='$password'";
|
||||||
//echo $query;
|
//echo $query;
|
||||||
$result = db_query($dbh, $query) or die("query failed");
|
$result = db_query($dbh, $query) or die("query failed");
|
||||||
|
|
||||||
if (pg_num_rows($result) == 0) {
|
if (db_num_rows($result) == 0) {
|
||||||
$logged_in = false;
|
$logged_in = false;
|
||||||
authenticate();
|
authenticate();
|
||||||
echo $_SERVER['PHP_AUTH_USER'];
|
echo $_SERVER['PHP_AUTH_USER'];
|
||||||
|
@ -18,7 +18,7 @@ if (pg_num_rows($result) == 0) {
|
||||||
} else {
|
} else {
|
||||||
$logged_in = true;
|
$logged_in = true;
|
||||||
session_start();
|
session_start();
|
||||||
$row=pg_fetch_array($result);
|
$row=db_fetch_array($result);
|
||||||
$_SESSION["userid"]=$row["id"];
|
$_SESSION["userid"]=$row["id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,4 +42,4 @@ if (! $logged_in) {
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
include("commonfoot.php");
|
include("commonfoot.php");
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("../config.php");
|
require("/var/local/gvadm/config.php");
|
||||||
|
|
||||||
function db_open() {
|
function db_open() {
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -23,11 +23,15 @@ function db_close($dbh) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function db_query($dbh, $query) {
|
function db_query($dbh, $query) {
|
||||||
$result = pg_query($dbh, $query)
|
$result = pg_exec($dbh, $query)
|
||||||
or die("Couldn't query database!");
|
or die("Couldn't query database!");
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function db_num_rows($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);
|
||||||
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ require_once("usertypes.php");
|
||||||
|
|
||||||
$query=sprintf("SELECT name, type, client FROM sysuser WHERE id=%d",
|
$query=sprintf("SELECT name, type, client FROM sysuser WHERE id=%d",
|
||||||
$_SESSION["userid"]);
|
$_SESSION["userid"]);
|
||||||
$result=pg_query($dbh, $query);
|
$result=db_query($dbh, $query);
|
||||||
$row=pg_fetch_array($result);
|
$row=db_fetch_array($result);
|
||||||
printf(_("Logged in as %s (%s)"), $row["name"],
|
printf(_("Logged in as %s (%s)"), $row["name"],
|
||||||
get_usertype_name($row["type"]));
|
get_usertype_name($row["type"]));
|
||||||
|
|
||||||
|
@ -21,11 +21,11 @@ print("<br/>");
|
||||||
$_SESSION["client"]=$row["client"];
|
$_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"]);
|
$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);
|
$result=db_query($dbh, $query);
|
||||||
$row=pg_fetch_array($result);
|
$row=db_fetch_array($result);
|
||||||
printf("%s %s, %s %s, %s %s, %s %s", $row["firstname"], $row["lastname"],
|
printf("%s %s, %s %s, %s %s, %s %s", $row["firstname"], $row["lastname"],
|
||||||
$row["address1"], $row["address2"], $row["zipcode"], $row["town"],
|
$row["address1"], $row["address2"], $row["zipcode"], $row["town"],
|
||||||
$row["state"], $row["cname"]);
|
$row["state"], $row["cname"]);
|
||||||
?>
|
?>
|
||||||
</p></td></tr></table>
|
</p></td></tr></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue