1
0
Fork 0

add domain

git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@31 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
Jan Dittberner 2004-03-08 17:42:14 +00:00
parent 283f07fbe1
commit dbae3c8bd3
5 changed files with 43 additions and 19 deletions

View file

@ -1,13 +1,13 @@
<?php
require("wantauth.php");
require("tools.php");
$dbh=db_open();
session_start();
include("userhead.php");
include("domainstatustypes.php");
?>
<div>
<?php
$dbh=db_open();
$query=sprintf("SELECT * FROM domain WHERE client=%d",
$_SESSION["client"]);
$result=pg_query($dbh, $query);
@ -26,7 +26,6 @@ else {
}
print("</table>");
}
db_close($dbh);
?>
</div>
<a href="registerdomain.php"><?php print(_("Add domain")); ?></a>

View file

@ -1,7 +1,43 @@
<?php
require_once("tools.php");
require_once("usertypes.php");
$dbh = db_open();
function add_domain() {
global $dbh;
$query = sprintf("INSERT INTO domain (domainname, client) VALUES ('%s', %d)",
$_POST["domainname"],
$_SESSION["client"]);
db_exec($dbh, $query);
}
require("wantauth.php");
require("tools.php");
session_start();
include("userhead.php");
if (!isset($_POST["mode"])) {
$mode = "step1";
} else {
$mode = $_POST["mode"];
}
switch ($mode) {
case "step1" :
?>
<p><?php print(_("Add new domain")); ?></p>
<form action="<?php echo $PHP_SELF; ?>" method="post">
<input type="hidden" name="mode" value="commit">
<table>
<tr><td><?php print(_("Domain name:")); ?></td><td><input type="text" name="domainname"></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="submit" value="<?php print(_("add")); ?>"</td></tr>
</table>
</form>
<?php
break;
case "commit" :
add_domain();
default:
break;
}
include("commonfoot.php");
?>

View file

@ -1,5 +1,4 @@
<?php
require("tools.php");
require("usertypes.php");
$dbh=db_open();
@ -98,14 +97,8 @@ function has_admin_account() {
$result=db_query($dbh, $query);
return (db_num_rows($result)!=0);
}
?>
<!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 Setup</title>
</head>
<body>
<?php
include("commonhead.php");
if (!isset($_POST["mode"])) {
$mode = "step1";
} else {

View file

@ -3,11 +3,12 @@ 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");
$result = db_query($dbh, $query) or die("query failed");
if (pg_num_rows($result) == 0) {
$logged_in = false;
@ -20,7 +21,6 @@ if (pg_num_rows($result) == 0) {
$row=pg_fetch_array($result);
$_SESSION["userid"]=$row["id"];
}
pg_close($dbh);
include("commonhead.php");
?>

View file

@ -8,9 +8,7 @@ include("commonhead.php");
</td><td>
<p>
<?php
require("usertypes.php");
$dbh = db_open();
require_once("usertypes.php");
$query=sprintf("SELECT name, type, client FROM sysuser WHERE id=%d",
$_SESSION["userid"]);
@ -28,8 +26,6 @@ $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>