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:
parent
283f07fbe1
commit
dbae3c8bd3
5 changed files with 43 additions and 19 deletions
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
require("wantauth.php");
|
require("wantauth.php");
|
||||||
require("tools.php");
|
require("tools.php");
|
||||||
|
$dbh=db_open();
|
||||||
session_start();
|
session_start();
|
||||||
include("userhead.php");
|
include("userhead.php");
|
||||||
include("domainstatustypes.php");
|
include("domainstatustypes.php");
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
<?php
|
<?php
|
||||||
$dbh=db_open();
|
|
||||||
$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=pg_query($dbh, $query);
|
||||||
|
@ -26,7 +26,6 @@ else {
|
||||||
}
|
}
|
||||||
print("</table>");
|
print("</table>");
|
||||||
}
|
}
|
||||||
db_close($dbh);
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<a href="registerdomain.php"><?php print(_("Add domain")); ?></a>
|
<a href="registerdomain.php"><?php print(_("Add domain")); ?></a>
|
||||||
|
|
|
@ -1,7 +1,43 @@
|
||||||
<?php
|
<?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("wantauth.php");
|
||||||
require("tools.php");
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
include("userhead.php");
|
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");
|
include("commonfoot.php");
|
||||||
?>
|
?>
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("tools.php");
|
require("tools.php");
|
||||||
require("usertypes.php");
|
require("usertypes.php");
|
||||||
$dbh=db_open();
|
$dbh=db_open();
|
||||||
|
@ -98,14 +97,8 @@ function has_admin_account() {
|
||||||
$result=db_query($dbh, $query);
|
$result=db_query($dbh, $query);
|
||||||
return (db_num_rows($result)!=0);
|
return (db_num_rows($result)!=0);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
include("commonhead.php");
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>GNU-Viech Administration tool Setup</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
if (!isset($_POST["mode"])) {
|
if (!isset($_POST["mode"])) {
|
||||||
$mode = "step1";
|
$mode = "step1";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,11 +3,12 @@ require("wantauth.php");
|
||||||
require("tools.php");
|
require("tools.php");
|
||||||
|
|
||||||
$dbh = db_open();
|
$dbh = db_open();
|
||||||
|
|
||||||
$username = strtolower(substr(trim($_SERVER['PHP_AUTH_USER']), 0, 12));
|
$username = strtolower(substr(trim($_SERVER['PHP_AUTH_USER']), 0, 12));
|
||||||
$password = md5(substr(trim($_SERVER['PHP_AUTH_PW']), 0, 30));
|
$password = md5(substr(trim($_SERVER['PHP_AUTH_PW']), 0, 30));
|
||||||
$query = "SELECT * FROM sysuser WHERE name='$username' AND md5pass='$password'";
|
$query = "SELECT * FROM sysuser WHERE name='$username' AND md5pass='$password'";
|
||||||
//echo $query;
|
//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) {
|
if (pg_num_rows($result) == 0) {
|
||||||
$logged_in = false;
|
$logged_in = false;
|
||||||
|
@ -20,7 +21,6 @@ if (pg_num_rows($result) == 0) {
|
||||||
$row=pg_fetch_array($result);
|
$row=pg_fetch_array($result);
|
||||||
$_SESSION["userid"]=$row["id"];
|
$_SESSION["userid"]=$row["id"];
|
||||||
}
|
}
|
||||||
pg_close($dbh);
|
|
||||||
|
|
||||||
include("commonhead.php");
|
include("commonhead.php");
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -8,9 +8,7 @@ include("commonhead.php");
|
||||||
</td><td>
|
</td><td>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
require("usertypes.php");
|
require_once("usertypes.php");
|
||||||
|
|
||||||
$dbh = db_open();
|
|
||||||
|
|
||||||
$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"]);
|
||||||
|
@ -28,8 +26,6 @@ $row=pg_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"]);
|
||||||
|
|
||||||
db_close($dbh);
|
|
||||||
?>
|
?>
|
||||||
</p></td></tr></table>
|
</p></td></tr></table>
|
||||||
</div>
|
</div>
|
Loading…
Reference in a new issue