+++ /dev/null
-<?php\r
-\r
- /**\r
- * Central WebDB configuration\r
- *\r
- * $Id: config.inc.php,v 1.6 2002/04/15 11:57:28 chriskl Exp $\r
- */\r
-\r
- // Set error reporting level\r
- error_reporting(E_ALL);\r
-\r
- // App settings\r
- $appName = 'WebDB';\r
- $appIntro = 'Welcome to WebDB.';\r
- $appBase = '../public_html';\r
- $appVersion = '0.1-dev';\r
- \r
- // GUI settings\r
- $guiLeftFrameWidth = 200;\r
- $guiTheme = 'default';\r
-\r
- // Servers and types\r
- $confServers = array();\r
- $confServers[0]['desc'] = 'Home-PG';\r
- $confServers[0]['host'] = 'localhost';\r
- $confServers[0]['port'] = '5432';\r
- $confServers[0]['type'] = 'Postgres71';\r
- $confServers[0]['default'] = 'template1';\r
- \r
- // MySQL example\r
- $confServers[1]['desc'] = 'Home-MySQL';\r
- $confServers[1]['host'] = 'localhost';\r
- $confServers[1]['port'] = 'xxx'; // Port isn't being used anywhere yet\r
- $confServers[1]['type'] = 'MySQL';\r
- $confServers[1]['default'] = '';\r
- \r
- // Language\r
- include_once ('../lang/template.php');\r
- \r
- // If login action is set, then set login variables\r
- if (isset($formServer) && isset($formUsername) && isset($formPassword)) {\r
- $webdbServerID = $formServer;\r
- $webdbUsername = $formUsername;\r
- $webdbPassword = $formPassword;\r
- setCookie('webdbServerID', $webdbServerID);\r
- setCookie('webdbUsername', $webdbUsername);\r
- setCookie('webdbPassword', $webdbPassword);\r
- }\r
- \r
- // If the logged in settings aren't present, put up the login screen\r
- if (!isset($webdbUsername) || !isset($webdbPassword) || !isset($webdbServerID) || !isset($confServers[$webdbServerID])) {\r
- include($appBase . '/login.php');\r
- exit;\r
- }\r
- \r
- // Create data accessor object, if valid\r
- if (isset($webdbServerID) && isset($confServers[$webdbServerID])) {\r
- $_type = $confServers[$webdbServerID]['type'];\r
- include_once('../classes/database/' . $_type . '.php');\r
- $data = new $_type( $confServers[$webdbServerID]['host'],\r
- $confServers[$webdbServerID]['port'],\r
- $confServers[$webdbServerID]['default'],\r
- $webdbUsername,\r
- $webdbPassword);\r
- }\r
-\r
- // Create local (database-specific) data accessor object, if valid\r
- if (isset($webdbServerID) && isset($confServers[$webdbServerID]) && isset($database)) {\r
- $_type = $confServers[$webdbServerID]['type'];\r
- include_once('../classes/database/' . $_type . '.php');\r
- $localData = new $_type( $confServers[$webdbServerID]['host'],\r
- $confServers[$webdbServerID]['port'],\r
- $database,\r
- $webdbUsername,\r
- $webdbPassword);\r
- }\r
-\r
- // Create Misc class references\r
- include_once('../classes/Misc.php');\r
- $misc = new Misc();\r
-\r
- // Theme\r
- echo "<style type=\"text/css\">\n<!--\n";\r
- include("../themes/{$guiTheme}/global.css");\r
- echo "\n-->\n</style>\n";\r
- \r
-?>
\ No newline at end of file
--- /dev/null
+<?php\r
+\r
+ /**\r
+ * Central WebDB configuration. As a user you may modify the\r
+ * settings here for your particular configuration.\r
+ *\r
+ * $Id: config.inc.php-dist,v 1.1 2002/05/15 09:57:55 chriskl Exp $\r
+ */\r
+\r
+ // Set error reporting level\r
+ error_reporting(E_ALL);\r
+\r
+ // App settings\r
+ $appName = 'WebDB';\r
+ $appIntro = 'Welcome to WebDB.';\r
+ $appBase = '../public_html';\r
+ $appVersion = '0.1-dev';\r
+ \r
+ /*\r
+ * GUI settings\r
+ */ \r
+ \r
+ // Width of the left frame\r
+ $guiLeftFrameWidth = 200;\r
+ // Which look & feel theme to use\r
+ $guiTheme = 'default';\r
+\r
+ // Servers and types\r
+ $confServers = array();\r
+ $confServers[0]['desc'] = 'Home-PG';\r
+ $confServers[0]['host'] = 'localhost';\r
+ $confServers[0]['port'] = '5432';\r
+ $confServers[0]['type'] = 'Postgres71';\r
+ $confServers[0]['default'] = 'template1';\r
+ \r
+ // Servers and types\r
+ $confServers[1]['desc'] = 'Dev-PG';\r
+ $confServers[1]['host'] = 'database-dev';\r
+ $confServers[1]['port'] = '5432';\r
+ $confServers[1]['type'] = 'Postgres71';\r
+ $confServers[1]['default'] = 'template1';\r
+ \r
+ // MySQL example\r
+ $confServers[2]['desc'] = 'Home-MySQL';\r
+ $confServers[2]['host'] = 'localhost';\r
+ $confServers[2]['port'] = 'xxx'; // Port isn't being used anywhere yet\r
+ $confServers[2]['type'] = 'MySQL';\r
+ $confServers[2]['default'] = '';\r
+ \r
+ /*****************************************\r
+ * Don't modify anything below this line *\r
+ *****************************************/\r
+\r
+ // Language\r
+ include_once('../lang/template.php');\r
+ \r
+ // Main library\r
+ include_once('../libraries/lib.inc.php');\r
+ \r
+?>\r
--- /dev/null
+<?php\r
+\r
+ /**\r
+ * Function library read in upon startup\r
+ *\r
+ * $Id: lib.inc.php,v 1.1 2002/05/15 09:57:55 chriskl Exp $\r
+ */\r
+\r
+ // If login action is set, then set login variables\r
+ if (isset($_POST['formServer']) && isset($_POST['formUsername']) && isset($_POST['formPassword'])) {\r
+ $webdbServerID = $_POST['formServer'];\r
+ $webdbUsername = $_POST['formUsername'];\r
+ $webdbPassword = $_POST['formPassword'];\r
+ setCookie('webdbServerID', $webdbServerID);\r
+ setCookie('webdbUsername', $webdbUsername);\r
+ setCookie('webdbPassword', $webdbPassword);\r
+ $_COOKIE['webdbServerID'] = $webdbServerID;\r
+ $_COOKIE['webdbUsername'] = $webdbUsername;\r
+ $_COOKIE['webdbPassword'] = $webdbPassword;\r
+ }\r
+ \r
+ // If the logged in settings aren't present, put up the login screen\r
+ if (!isset($_COOKIE['webdbUsername']) || \r
+ !isset($_COOKIE['webdbPassword']) || \r
+ !isset($_COOKIE['webdbServerID']) || \r
+ !isset($confServers[$_COOKIE['webdbServerID']])) {\r
+ include($appBase . '/login.php');\r
+ exit;\r
+ }\r
+ \r
+ // Create data accessor object, if valid\r
+ if (isset($_COOKIE['webdbServerID']) && isset($confServers[$_COOKIE['webdbServerID']])) {\r
+ $_type = $confServers[$_COOKIE['webdbServerID']]['type'];\r
+ include_once('../classes/database/' . $_type . '.php');\r
+ $data = new $_type( $confServers[$_COOKIE['webdbServerID']]['host'],\r
+ $confServers[$_COOKIE['webdbServerID']]['port'],\r
+ $confServers[$_COOKIE['webdbServerID']]['default'],\r
+ $_COOKIE['webdbUsername'],\r
+ $_COOKIE['webdbPassword']);\r
+ }\r
+\r
+ // Create local (database-specific) data accessor object, if valid\r
+ if (isset($_COOKIE['webdbServerID']) && isset($confServers[$_COOKIE['webdbServerID']]) && isset($_REQUEST['database'])) {\r
+ $_type = $confServers[$_COOKIE['webdbServerID']]['type'];\r
+ include_once('../classes/database/' . $_type . '.php');\r
+ $localData = new $_type( $confServers[$_COOKIE['webdbServerID']]['host'],\r
+ $confServers[$_COOKIE['webdbServerID']]['port'],\r
+ $_REQUEST['database'],\r
+ $_COOKIE['webdbUsername'],\r
+ $_COOKIE['webdbPassword']);\r
+ }\r
+\r
+ // Create Misc class references\r
+ include_once('../classes/Misc.php');\r
+ $misc = new Misc();\r
+\r
+ // Theme\r
+ echo "<style type=\"text/css\">\n<!--\n";\r
+ include("../themes/{$guiTheme}/global.css");\r
+ echo "\n-->\n</style>\n";\r
+ \r
+?>
\ No newline at end of file
/**\r
* Main object browser\r
*\r
- * $Id: browser.php,v 1.5 2002/04/10 04:09:47 chriskl Exp $\r
+ * $Id: browser.php,v 1.6 2002/05/15 09:57:55 chriskl Exp $\r
*/\r
\r
// Include application functions\r
// Construct expanding tree\r
$tree = new Tree ('class.tree');\r
$tree->set_frame ('detail');\r
- $root = $tree->open_tree (htmlspecialchars($confServers[$webdbServerID]['desc']), '');\r
+ $root = $tree->open_tree (htmlspecialchars($confServers[$_COOKIE['webdbServerID']]['desc']), '');\r
\r
$databases = &$data->getDatabases();\r
while (!$databases->EOF) {\r
/**\r
* Login screen\r
*\r
- * $Id: login.php,v 1.2 2002/02/12 01:11:58 kkemp102294 Exp $\r
+ * $Id: login.php,v 1.3 2002/05/15 09:57:55 chriskl Exp $\r
*/\r
\r
// Include application functions\r
<tr height="115">\r
<td height="115" align="center" valign="middle">\r
<table border="0" cellpadding="2" cellspacing="0">\r
- <form action="<?= $PHP_SELF ?>" method="post" name="login_form">\r
+ <form action="<?= $_SERVER['PHP_SELF'] ?>" method="post" name="login_form">\r
<tr>\r
<td class="form">Username:</td>\r
<td><input type="text" name="formUsername" value="<?php isset($webdbUsername) ? htmlspecialchars($webdbUsername) : '' ?>" size="24"></td>\r
</tr>\r
</form>\r
</table>\r
+ <script language=javascript>\r
+ var uname = document.login_form.formUsername;\r
+ var pword = document.login_form.formPassword;\r
+ if (uname.value == "") { \r
+ uname.focus();\r
+ } else {\r
+ pword.focus();\r
+ }\r
+ </script>\r
</td>\r
</tr>\r
- <script language=javascript>\r
- var uname = document.login_form.set_username;\r
- var pword = document.login_form.set_password;\r
- if (uname.value == "") { \r
- uname.focus();\r
- } else {\r
- pword.focus();\r
- }\r
- </script>\r
</table> \r
</td>\r
</tr>\r
/**\r
* List tables in a database\r
*\r
- * $Id: tables.php,v 1.2 2002/04/10 04:09:47 chriskl Exp $\r
+ * $Id: tables.php,v 1.3 2002/05/15 09:57:55 chriskl Exp $\r
*/\r
\r
// Include application functions\r
include_once('../conf/config.inc.php');\r
\r
- if (!isset($action)) $action = '';\r
+ $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';\r
+ $PHP_SELF = $_SERVER['PHP_SELF'];\r
\r
?>\r
\r
\r
switch ($action) {\r
case 'browse': \r
- echo "<h2>", htmlspecialchars($database), ": ", htmlspecialchars($table), "</h2>\n";\r
- $rs = &$localData->browseTable($table, $offset, $limit);\r
+ echo "<h2>", htmlspecialchars($_GET['database']), ": ", htmlspecialchars($_GET['table']), "</h2>\n";\r
+ $rs = &$localData->browseTable($_GET['table'], $_GET['offset'], $_GET['limit']);\r
\r
if ($rs->recordCount() > 0) {\r
echo "<table>\n<tr>";\r
\r
break;\r
default:\r
- echo "<h2>", htmlspecialchars($database), "</h2>\n";\r
+ echo "<h2>", htmlspecialchars($_GET['database']), "</h2>\n";\r
\r
$tables = &$localData->getTables();\r
\r
$id = (($i % 2) == 0 ? '1' : '2');\r
echo "<tr><td class=data{$id}>", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "</td>\n";\r
echo "<td class=data{$id}>", htmlspecialchars($tables->f[$data->tbFields['tbowner']]), "</td>\n";\r
- echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=browse&offset=0&limit=30&database=", \r
- htmlspecialchars($database), "&table=", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "\">Browse</a></td>\n";\r
+ echo "<td class=opbutton{$id}><a href=\"{$PHP_SELF}?action=browse&offset=0&limit=30&database=", \r
+ htmlspecialchars($_GET['database']), "&table=", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "\">Browse</a></td>\n";\r
echo "<td class=opbutton{$id}>Select</td>\n";\r
echo "<td class=opbutton{$id}>Insert</td>\n";\r
echo "<td class=opbutton{$id}>Properties</td>\n";\r
/**\r
* Top menu for WebDB\r
*\r
- * $Id: topbar.php,v 1.4 2002/05/01 09:37:30 chriskl Exp $\r
+ * $Id: topbar.php,v 1.5 2002/05/15 09:57:55 chriskl Exp $\r
*/\r
\r
// Include application functions\r
<table width="100%" border="0" cellspacing="0" cellpadding="0">\r
<tr> \r
<td width="211" rowspan="2"><img src="images/themes/<?= $guiTheme ?>/title.gif" width=211 height=50 alt="<? htmlspecialchars($appName) ?>"></td>\r
- <td width="69%"><?= $confServers[$webdbServerID]['type'] ?> running on \r
- <?= htmlspecialchars($confServers[$webdbServerID]['host']) ?>:<?= $confServers[$webdbServerID]['port'] ?>\r
- -- You are logged in as user <b><?= htmlspecialchars($webdbUsername) ?></b>, \r
+ <td width="69%"><?= $confServers[$_COOKIE['webdbServerID']]['type'] ?> running on \r
+ <?= htmlspecialchars($confServers[$_COOKIE['webdbServerID']]['host']) ?>:<?= $confServers[$_COOKIE['webdbServerID']]['port'] ?>\r
+ -- You are logged in as user <b><?= htmlspecialchars($_COOKIE['webdbUsername']) ?></b>, \r
<?= date('jS M, Y g:iA') ?></font></td>\r
</tr>\r
<tr>\r
/**\r
* Manage users in a database cluster\r
*\r
- * $Id: users.php,v 1.1 2002/05/01 09:37:30 chriskl Exp $\r
+ * $Id: users.php,v 1.2 2002/05/15 09:57:55 chriskl Exp $\r
*/\r
\r
// Include application functions\r
include_once('../conf/config.inc.php');\r
- \r
- if (!isset($action)) $action = '';\r
+\r
+ $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';\r
if (!isset($msg)) $msg = '';\r
+ $PHP_SELF = $_SERVER['PHP_SELF'];\r
\r
/** \r
* Function to save after editing a user\r
*/\r
function doSaveEdit() {\r
- global $data, $username, $formCreateDB, $formSuper, $formExpires, $form;\r
+ global $data;\r
\r
- $status = $data->setUser($username, '', isset($formCreateDB), isset($formSuper), $formExpires);\r
+ $status = $data->setUser($_POST['username'], '', isset($_POST['formCreateDB']), isset($_POST['formSuper']), $_POST['formExpires']);\r
if ($status == 0)\r
doProperties('User updated.');\r
else\r
* Function to allow editing of a user\r
*/\r
function doEdit($msg = '') {\r
- global $data, $misc, $username;\r
+ global $data, $misc;\r
global $PHP_SELF, $strUsername, $strSuper, $strCreateDB, $strExpires, $strActions, $strNoUsers;\r
\r
- echo "<h2>Users: ", htmlspecialchars($username), ": Edit</h2>\n";\r
+ echo "<h2>Users: ", htmlspecialchars($_REQUEST['username']), ": Edit</h2>\n";\r
$misc->printMsg($msg);\r
\r
- $userdata = &$data->getUser($username);\r
+ $userdata = &$data->getUser($_REQUEST['username']);\r
\r
if ($userdata->recordCount() > 0) {\r
$userdata->f[$data->uFields['ucreatedb']] = $data->phpBool($userdata->f[$data->uFields['ucreatedb']]);\r
echo "<td class=data1><input size=30 name=formExpires value=\"", htmlspecialchars($userdata->f[$data->uFields['uexpires']]), "\"></td></tr>\n";\r
echo "</table>\n";\r
echo "<input type=hidden name=action value=save_edit>\n";\r
- echo "<input type=hidden name=username value=\"", htmlspecialchars($username), "\">\n";\r
+ echo "<input type=hidden name=username value=\"", htmlspecialchars($_REQUEST['username']), "\">\n";\r
echo "<input type=submit value=Save> <input type=reset>\n";\r
echo "</form>\n";\r
}\r
\r
echo "<p><a class=navlink href=\"$PHP_SELF\">Show All Users</a> |\n";\r
echo "<a class=navlink href=\"$PHP_SELF?action=properties&username=", \r
- urlencode($username), "\">Properties</a></p>\n";\r
+ urlencode($_REQUEST['username']), "\">Properties</a></p>\n";\r
}\r
\r
/**\r
* Show read only properties for a user\r
*/\r
function doProperties($msg = '') {\r
- global $data, $misc, $username;\r
+ global $data, $misc;\r
global $PHP_SELF, $strUsername, $strSuper, $strCreateDB, $strExpires, $strActions, $strNoUsers;\r
\r
- echo "<h2>Users: ", htmlspecialchars($username), ": Properties</h2>\n";\r
+ echo "<h2>Users: ", htmlspecialchars($_REQUEST['username']), ": Properties</h2>\n";\r
$misc->printMsg($msg);\r
\r
- $userdata = &$data->getUser($username);\r
+ $userdata = &$data->getUser($_REQUEST['username']);\r
\r
if ($userdata->recordCount() > 0) {\r
echo "<table>\n";\r
\r
echo "<p><a class=navlink href=\"$PHP_SELF\">Show All Users</a> |\n";\r
echo "<a class=navlink href=\"$PHP_SELF?action=edit&username=", \r
- urlencode($username), "\">Edit</a></p>\n";\r
+ urlencode($_REQUEST['username']), "\">Edit</a></p>\n";\r
}\r
\r
/**\r
* Show confirmation of drop and perform actual drop\r
*/\r
function doDrop($confirm) {\r
- global $data, $username;\r
+ global $data;\r
global $PHP_SELF;\r
\r
if ($confirm) { \r
- echo "<h2>Users: ", htmlspecialchars($username), ": Drop</h2>\n";\r
+ echo "<h2>Users: ", htmlspecialchars($_REQUEST['username']), ": Drop</h2>\n";\r
\r
- echo "<p>Are you sure you want to drop the user \"", htmlspecialchars($username), "\"?</p>\n";\r
+ echo "<p>Are you sure you want to drop the user \"", htmlspecialchars($_REQUEST['username']), "\"?</p>\n";\r
\r
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";\r
echo "<input type=hidden name=action value=drop>\n";\r
- echo "<input type=hidden name=username value=\"", htmlspecialchars($username), "\">\n";\r
+ echo "<input type=hidden name=username value=\"", htmlspecialchars($_REQUEST['username']), "\">\n";\r
echo "<input type=submit name=choice value=\"Yes\"> <input type=submit name=choice value=\"No\">\n";\r
echo "</form>\n";\r
}\r
else {\r
- $status = $data->dropUser($username);\r
+ $status = $data->dropUser($_REQUEST['username']);\r
if ($status == 0)\r
doDefault('User dropped.');\r
else\r
* Actually creates the new view in the database\r
*/\r
function doSaveCreate() {\r
- global $data, $formUsername, $formPassword, $formSuper, $formCreateDB, $formExpires;\r
+ global $data;\r
\r
// @@ NOTE: No groups handled yet\r
- $status = $data->createUser($formUsername, $formPassword, isset($formSuper), isset($formCreateDB), $formExpires, array());\r
+ $status = $data->createUser($_POST['formUsername'], $_POST['formPassword'], \r
+ isset($_POST['formSuper']), isset($_POST['formCreateDB']), $_POST['formExpires'], array());\r
if ($status == 0)\r
doDefault('User created.');\r
else\r
doCreate();\r
break;\r
case 'drop':\r
- if ($choice == 'Yes') doDrop(false);\r
+ if ($_REQUEST['choice'] == 'Yes') doDrop(false);\r
else doDefault();\r
break;\r
case 'confirm_drop':\r
/**\r
* Manage views in a database\r
*\r
- * $Id: views.php,v 1.2 2002/04/15 12:16:35 chriskl Exp $\r
+ * $Id: views.php,v 1.3 2002/05/15 09:57:55 chriskl Exp $\r
*/\r
\r
// Include application functions\r
include_once('../conf/config.inc.php');\r
\r
- if (!isset($action)) $action = '';\r
+ $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';\r
if (!isset($msg)) $msg = '';\r
+ $PHP_SELF = $_SERVER['PHP_SELF'];\r
\r
/** \r
* Function to save after editing a view\r