home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
oss
/
cvs-2004
/
bahasa
/
web
/
admins.php,v
< prev
next >
Wrap
Text File
|
2003-10-20
|
13KB
|
668 lines
head 1.7;
access;
symbols
Initial:1.1.1.1 bule:1.1.1;
locks; strict;
comment @# @;
1.7
date 2003.10.20.00.21.45; author bule; state Exp;
branches;
next 1.6;
1.6
date 2003.10.18.00.33.41; author bule; state Exp;
branches;
next 1.5;
1.5
date 2003.10.06.00.39.26; author bule; state Exp;
branches;
next 1.4;
1.4
date 2003.10.01.06.51.28; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.09.11.05.28.22; author bule; state Exp;
branches;
next 1.2;
1.2
date 2003.08.19.06.42.07; author bule; state Exp;
branches;
next 1.1;
1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches;
next ;
desc
@@
1.7
log
@*** empty log message ***
@
text
@<?
session_start();
require_once("../php/Indonesia.php");
require_once("../php/Web.php");
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Project Name: Bahasa Indonesia Dictionary
// Directory: bahasa/web
// File Name: admins.php
// Author(s): John L. Whiteman
// Created: June 23, 2003
// Modified: October 19, 2003
// Description: The purpose of this restricted access PHP web client
// page is to allow creation and deletion of administrators.
//
// Copyright (c) 2003 John L. Whiteman
//
// Permission is herby granted, free of charge, to any person obtaining a
// copy of this software, data, and associated documentation files
// (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHERE IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING IN THE SOFTWARE.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
$web = new Web();
if (!$_SESSION['ADMIN']) {
$web->redirect("login.php");
exit;
}
$indonesia = new Indonesia();
$status = $indonesia->get_dictionary_status();
if ($status["status"] == 1 || $status["status"] == 2) {
$web->redirect("admin.php");
exit;
}
if ($_SESSION['NODUP_ADMINS']) {
unset($_SESSION['NODUPS_ADMINS']);
$web->redirect("admin.php");
exit;
}
?>
<html>
<head>
<title>Bahasa Indonesia Dictionary: Administrators</title>
<link href="bahasa.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="bahasa.js"></script>
<script language="Javascript" type="text/javascript">
<!--
//////////////////////////////////////////////////////////////////////////////
function verify() {
name = document.administrators.name.value;
name = trim(name);
if (is_white_space(name)) {
alert(
"You must enter your administrator name!");
document.administrators.name.focus();
return(false);
}
password = document.administrators.password.value;
if (is_white_space(password)) {
alert(
"You must enter your administrator password!");
document.administrators.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
function verify_delete() {
delete_name = document.administrators.delete_name.value;
delete_name = trim(delete_name);
if (is_white_space(delete_name)) {
alert(
"You must enter administrator's name!");
document.administrators.delete_name.focus();
return(false);
}
name = document.administrators.name.value;
name = trim(name);
if (is_white_space(name)) {
alert(
"You must enter your administrator name!");
document.administrators.name.focus();
return(false);
}
password = document.administrators.password.value;
if (is_white_space(password)) {
alert(
"You must enter your administrator password!");
document.administrators.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
function verify_insert() {
insert_name = document.administrators.insert_name.value;
insert_name = trim(insert_name);
if (is_white_space(insert_name)) {
alert(
"You must enter a new administrator name!");
document.administrators.insert_name.focus();
return(false);
}
if ((insert_name.length < 5) || (insert_name.length > 50)) {
alert(
"Please keep the new administrator's name between " +
"5 to 50 characters in length.");
document.administrators.insert_name.focus();
return(false);
}
insert_password = document.administrators.insert_password.value;
if (is_white_space(insert_password)) {
alert(
"You must enter the new administrator's password!");
document.administrators.insert_password.focus();
return(false);
}
if ((insert_password.length < 5) || (insert_password.length > 50)) {
alert(
"Please keep the new administrator's password between " +
"5 to 50 characters in length.");
document.administrators.insert_password.focus();
return(false);
}
name = document.administrators.name.value;
name = trim(name);
if (is_white_space(name)) {
alert(
"You must enter your administrator name!");
document.administrators.name.focus();
return(false);
}
password = document.administrators.password.value;
if (is_white_space(password)) {
alert(
"You must enter your administrator password!");
document.administrators.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
// -->
</script>
</head>
<html>
<body>
<?
$web->show_logo("Administrators");
?>
<a href="admin.php">Administration</a>
<?
if (
(isset($_POST['name'])) &&
(isset($_POST['password'])) &&
(isset($_POST['delete_name']))) {
$errstr =
$indonesia->delete_administrator(
$_POST['delete_name'],
$_POST['name'], $_POST['password']);
if ($errstr != "") {
print "<hr><b>${errstr}</b><hr>\n";
} else {
print
"<br><hr><b>\n" .
"Successfully deleted administrator!" .
"</b><hr><br>\n";
$_SESSION['NODUP_ADMINS'] = 1;
}
} else if (
(isset($_POST['name'])) &&
(isset($_POST['password'])) &&
(isset($_POST['insert_name'])) &&
(isset($_POST['insert_password']))) {
$errstr =
$indonesia->insert_administrator(
$_POST['insert_name'], $_POST['insert_password'],
$_POST['name'], $_POST['password']);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
} else {
print
"<br><hr><b>\n" .
"Successfully added new administrator!" .
"</b><hr><br>\n";
$_SESSION['NODUP_ADMINS'] = 1;
}
} else if (
(isset($_POST['name'])) &&
(isset($_POST['password'])) &&
(isset($_POST['insert_administrator']))) {
$errstr =
$indonesia->login_db_user($_POST['name'], $_POST['password']);
if ($errstr != "") {
print "<hr><b>${errstr}</b><hr>\n";
} else {
show_insert_administrator_form();
}
} else if (
(isset($_POST['name'])) &&
(isset($_POST['password'])) &&
(isset($_POST['delete_administrator']))) {
$errstr =
$indonesia->login_db_user($_POST['name'], $_POST['password']);
if ($errstr != "") {
print "<hr><b>${errstr}</b><hr>\n";
} else {
show_delete_administrator_form();
}
} else {
show_admin_options_form($web, $indonesia);
}
?>
</body>
</html>
<?
//////////////////////////////////////////////////////////////////////////////
function show_admin_options_form($web, $indonesia) {
$administrators = array();
$errstr = $indonesia->get_administrators($administrators);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$delete_administrator_html = "";
if (count($administrators) > -1) {
$delete_administrator_html .=
"</tr><tr>\n" .
"<td>\n" .
"<input type=\"submit\" name=\"delete_administrator\" " .
"value=\"Delete an Existing Administrator!\">\n" .
"</td>\n";
}
print <<<EOFSAOF
<form name="administrators" method="post" onSubmit='return verify()'>
<table cellpadding="3" cellspacing="3" border="1">
<tr>
<td align="right">
Name:
<input type="text" name="name" maxlength="255" size="50">
Password:
<input type="password" name="password" maxlength="255" size="50">
</td>
</tr><tr>
<td>
<input type="submit" name="insert_administrator"
value="Add a New Administrator!">
</td>
$delete_administrator_html
</tr>
</table>
</form>
<script language="Javascript" type="text/javascript">
document.administrators.name.focus();
</script>
EOFSAOF;
return;
}
//////////////////////////////////////////////////////////////////////////////
function show_delete_administrator_form() {
print <<<EOFDAF
<form name="administrators" method="post" onSubmit='return verify_delete()'>
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>Enter Administrator's Name:</td>
<td><input type="text" maxlength="50" name="delete_name"></td>
</tr><tr>
<td>Name:</td>
<td><input type="text" name="name"></td>
</tr></tr>
<td>Password:</td>
<td><input type="password" name="password"></td>
</tr><tr>
<td colspan="2" align="right">
<input type="reset" value="Clear Form!">
<input type="submit" value="Delete Administrator!">
</td>
</tr>
</table>
</form>
<script language="Javascript" type="text/javascript">
document.administrators.delete_name.focus();
</script>
EOFDAF;
return;
}
//////////////////////////////////////////////////////////////////////////////
function show_insert_administrator_form() {
print <<<EOFIAF
<form name="administrators" method="post" onSubmit='return verify_insert()'>
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>New Administrator's Name (5-50 characters):</td>
<td><input type="text" maxlength="50" name="insert_name"></td>
</tr><tr>
<td>New Administrator's Password (5-50 characters):</td>
<td><input type="password" maxlength="50" name="insert_password"></td>
</tr><tr>
<td>Name:</td>
<td><input type="text" name="name"></td>
</tr></tr>
<td>Password:</td>
<td><input type="password" name="password"></td>
</tr><tr>
<td colspan="2" align="right">
<input type="reset" value="Clear Form!">
<input type="submit" value="Insert New Administrator!">
</td>
</tr>
</table>
</form>
<script language="Javascript" type="text/javascript">
document.administrators.insert_name.focus();
</script>
EOFIAF;
return;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
?>
@
1.6
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d69 2
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d68 3
a70 3
<title>
Bahasa Indonesia Dictionary: Administrators
</title>
d73 1
a73 25
//////////////////////////////////////////////////////////////////////////////
function is_white_space(stoken) {
if (stoken == null) return(true);
if (stoken == '') return(true);
if (stoken == "") return(true);
return(false);
}
//////////////////////////////////////////////////////////////////////////////
function trim(stoken) {
if (is_white_space(stoken)) {
return(stoken);
}
stoken = stoken.replace(/^\s*/, "");
stoken = stoken.replace(/\s*&/, "");
return(stoken);
}
d230 1
a230 1
//////////////////////////////////////////////////////////////////////////////
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d259 3
a261 1
<h2>Bahasa Indonesia Dictionary: Administrators</h2>
@
1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 05, 2003
d39 1
a39 1
if (!session_is_registered("ADMIN")) {
d57 1
a57 1
if (session_is_registered("NODUP_ADMINS")) {
d59 1
a59 1
session_unregister("NODUP_ADMINS");
d284 1
a284 3
$NODUP_ADMINS = 1;
session_register("NODUP_ADMINS");
d309 1
a309 3
$NODUP_ADMINS = 1;
session_register("NODUP_ADMINS");
@
1.2
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 18, 2003
d275 1
a275 1
print "<br><hr><b>${errstr}</b><hr><br>\n";
d326 1
a326 1
print "<br><hr><b>${errstr}</b><hr><br>\n";
d343 1
a343 1
print "<br><hr><b>${errstr}</b><hr><br>\n";
d386 1
a386 1
<table cellpadding="3" cellspacing="3" border="0">
d390 1
a390 1
<input type="text" name="name">
d393 1
a393 1
<input type="password" name="password">
a400 2
</tr><tr>
<td> </td>
@
1.1
log
@Initial revision
@
text
@d5 32
a36 1
a478 1
@
1.1.1.1
log
@Bahasa Indonesia Dictionary
@
text
@@