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 / login.php,v < prev    next >
Text File  |  2003-10-20  |  7KB  |  392 lines

  1. head    1.7;
  2. access;
  3. symbols
  4.     Initial:1.1.1.1 bule:1.1.1;
  5. locks; strict;
  6. comment    @# @;
  7.  
  8.  
  9. 1.7
  10. date    2003.10.20.00.21.45;    author bule;    state Exp;
  11. branches;
  12. next    1.6;
  13.  
  14. 1.6
  15. date    2003.10.18.00.33.41;    author bule;    state Exp;
  16. branches;
  17. next    1.5;
  18.  
  19. 1.5
  20. date    2003.10.06.00.39.27;    author bule;    state Exp;
  21. branches;
  22. next    1.4;
  23.  
  24. 1.4
  25. date    2003.10.01.06.51.29;    author bule;    state Exp;
  26. branches;
  27. next    1.3;
  28.  
  29. 1.3
  30. date    2003.09.11.05.28.22;    author bule;    state Exp;
  31. branches;
  32. next    1.2;
  33.  
  34. 1.2
  35. date    2003.08.19.19.05.16;    author bule;    state Exp;
  36. branches;
  37. next    1.1;
  38.  
  39. 1.1
  40. date    2003.08.12.19.18.23;    author bule;    state Exp;
  41. branches
  42.     1.1.1.1;
  43. next    ;
  44.  
  45. 1.1.1.1
  46. date    2003.08.12.19.18.23;    author bule;    state Exp;
  47. branches;
  48. next    ;
  49.  
  50.  
  51. desc
  52. @@
  53.  
  54.  
  55. 1.7
  56. log
  57. @*** empty log message ***
  58. @
  59. text
  60. @<?
  61. session_start();
  62. require_once("../php/Indonesia.php");
  63. require_once("../php/Web.php");
  64. //////////////////////////////////////////////////////////////////////////////
  65. //////////////////////////////////////////////////////////////////////////////
  66. // Project Name: Bahasa Indonesia Dictionary
  67. // Directory:    bahasa/web
  68. // File Name:    login.php
  69. // Author(s):    John L. Whiteman
  70. // Created:      June 23, 2003  
  71. // Modified:     October 19, 2003
  72. // Description:  The purpose of this unrestricted access PHP web 
  73. //               client page is allow administrators to log into
  74. //               the restricted web pages. 
  75. // 
  76. // Copyright (c) 2003 John L. Whiteman
  77. //
  78. // Permission is herby granted, free of charge, to any person obtaining a 
  79. // copy of this software, data, and associated documentation files 
  80. // (the "Software"), to deal in the Software without restriction, 
  81. // including without limitation the rights to use, copy, modify, merge, 
  82. // publish, distribute, sublicense, and/or sell copies of Software, and to
  83. // permit persons to whom the Software is furnished to do so, subject to 
  84. // the following conditions:
  85. //
  86. // The above copyright notice and this permission notice shall be 
  87. // included in all copies or substantial portions of the Software.
  88. //
  89. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
  90. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
  91. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  92. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 
  93. // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHERE IN AN ACTION OF CONTRACT,
  94. // TORT OR OTHERWISE, ARISING IN THE SOFTWARE.  
  95. //////////////////////////////////////////////////////////////////////////////
  96. //////////////////////////////////////////////////////////////////////////////
  97. $indonesia = new Indonesia();
  98.  
  99. $web = new Web();
  100.  
  101. if (($_SESSION['ADMIN']) || ($_SESSION['DB_ADMIN'])) {
  102.  
  103.     $web->redirect("admin.php");
  104.  
  105.     exit;
  106.  
  107. } else if (
  108. (isset($_POST['name'])) && 
  109. (isset($_POST['password'])) &&
  110. (isset($_POST['user_flag']))) {
  111.  
  112.     $errstr =
  113.     $indonesia->login($_POST['name'], $_POST['password']);
  114.  
  115.     if ($errstr == "") {
  116.  
  117.         if ($_POST['user_flag'] == "admin") {
  118.  
  119.             $_SESSION['ADMIN'] = $_POST['name'];
  120.  
  121.             $web->redirect("admin.php");
  122.  
  123.             exit;
  124.  
  125.         } else {
  126.  
  127.             $_SESSION['DB_ADMIN'] = $_POST['name'];
  128.  
  129.             $web->redirect("admin.php");
  130.  
  131.             exit;
  132.         }
  133.     } 
  134. }
  135. ?>
  136. <html>
  137. <head>
  138. <title>Bahasa Indonesia Dictionary: Login</title>
  139.  
  140. <link href="bahasa.css" rel="stylesheet" type="text/css">
  141.  
  142. <script type="text/javascript" src="bahasa.js"></script>
  143.  
  144. <script language="Javascript" type="text/javascript">
  145. <!--
  146. //////////////////////////////////////////////////////////////////////////////
  147. function verify() {
  148.  
  149.     var name = document.login.name.value;
  150.  
  151.     name = trim(name);
  152.  
  153.     if (is_white_space(name)) {
  154.  
  155.         alert("You must enter your name.");
  156.  
  157.         document.login.name.focus();
  158.  
  159.         return(false);
  160.     } 
  161.  
  162.     var password = document.login.password.value;
  163.  
  164.     if (is_white_space(password)) {
  165.  
  166.         alert("You must enter your password.");
  167.  
  168.         document.login.password.focus();
  169.  
  170.         return(false);
  171.     } 
  172.  
  173.     return(true);
  174. }
  175. //////////////////////////////////////////////////////////////////////////////
  176. // -->
  177. </script>
  178. </head>
  179. <html>
  180. <body>
  181.  
  182. <?
  183.     $status = $indonesia->get_dictionary_status();
  184.  
  185.     $user_flag = "";
  186.  
  187.     $user = "";
  188.  
  189.     if (
  190.     ($status["status"] == 1) ||
  191.     ($status["status"] == 2) || 
  192.     ($status["status"] == 3)) {
  193.  
  194.         $web->show_logo("Database Administrator Login");
  195.  
  196.         $user_flag = "database";
  197.  
  198.         $user = "Login as Database Administrator!";
  199.  
  200.     } else {
  201.  
  202.         $web->show_logo("Web Administrator Login");
  203.  
  204.         $user_flag = "admin";
  205.  
  206.         $user = "Login as an Administrator!";
  207.     }
  208. ?>
  209.  
  210. <a href="search.php">Search Dictionary</a>
  211.  
  212. <form name="login" method="post" onSubmit='return verify()'>
  213. <table cellpadding="3" cellspacing="3" border="0">
  214. <tr>
  215. <td>Name:</td>
  216. <td>
  217. <input type="text" name="name" size="50" maxlength="255">
  218. </td>
  219. </tr>
  220. <tr>
  221. <td>Password:</td>
  222. <td>
  223. <input type="password" name="password" size="50" maxlength="255">
  224. </td>
  225. </tr>
  226. <tr>
  227. <td colspan="2" align="right">
  228. <input type="submit" value="<?echo ${user};?>">
  229. </td>
  230. </tr>
  231. </table>
  232. <input type="hidden" name="user_flag" value=<?print "\"${user_flag}\"";?>>
  233. </form>
  234. <script language="Javascript" type="text/javascript">
  235. document.login.name.focus();
  236. </script>
  237. </body>
  238. </html>
  239. @
  240.  
  241.  
  242. 1.6
  243. log
  244. @*** empty log message ***
  245. @
  246. text
  247. @d12 1
  248. a12 1
  249. // Modified:     October 17, 2003
  250. d80 2
  251. @
  252.  
  253.  
  254. 1.5
  255. log
  256. @*** empty log message ***
  257. @
  258. text
  259. @d12 1
  260. a12 1
  261. // Modified:     October 05, 2003
  262. d79 3
  263. a81 3
  264. <title>
  265. Bahasa Indonesia Dictionary: Login
  266. </title>
  267. d84 2
  268. a85 26
  269.  
  270. function is_white_space(stoken) {
  271.  
  272.     if (stoken == null) return(true);
  273.     
  274.     if (stoken == '') return(true);
  275.  
  276.     if (stoken == "") return(true);
  277.  
  278.     return(false);
  279. }
  280.  
  281. function trim(stoken) {
  282.  
  283.     if (is_white_space(stoken)) {
  284.  
  285.         return(stoken);
  286.     }
  287.  
  288.     stoken = stoken.replace(/^\s*/, "");
  289.  
  290.     stoken = stoken.replace(/\s*&/, "");
  291.  
  292.     return(stoken);
  293. }
  294.  
  295. d114 2
  296. a115 1
  297.  
  298. @
  299.  
  300.  
  301. 1.4
  302. log
  303. @*** empty log message ***
  304. @
  305. text
  306. @d12 1
  307. a12 1
  308. // Modified:     September 30, 2003
  309. d156 1
  310. a156 2
  311.         print "
  312.         <h2>Bahasa Indonesia Dictionary: Database Login</h2>\n"; 
  313. d164 1
  314. a164 2
  315.         print "
  316.         <h2>Bahasa Indonesia Dictionary: Administrator Login</h2>\n"; 
  317. @
  318.  
  319.  
  320. 1.3
  321. log
  322. @*** empty log message ***
  323. @
  324. text
  325. @d12 1
  326. a12 1
  327. // Modified:     September 05, 2003
  328. d42 1
  329. a42 3
  330. if (
  331. (session_is_registered("ADMIN")) || 
  332. (session_is_registered("DB_ADMIN"))) {
  333. d60 1
  334. a60 3
  335.             $ADMIN = $_POST['name'];
  336.  
  337.             session_register("ADMIN");
  338. d68 1
  339. a68 3
  340.             $DB_ADMIN = $_POST['name'];
  341.  
  342.             session_register("DB_ADMIN");
  343. @
  344.  
  345.  
  346. 1.2
  347. log
  348. @*** empty log message ***
  349. @
  350. text
  351. @d12 1
  352. a12 1
  353. // Modified:     August 19, 2003
  354. d155 2
  355. d167 2
  356. d175 2
  357. d180 1
  358. a180 1
  359. <a href="search.php">Search</a>
  360. d187 1
  361. a187 1
  362. <input type="text" name="name">
  363. d193 1
  364. a193 1
  365. <input type="password" name="password">
  366. d197 2
  367. a198 2
  368. <td colspan="2" align="center">
  369. <input type="submit" value="Login">
  370. @
  371.  
  372.  
  373. 1.1
  374. log
  375. @Initial revision
  376. @
  377. text
  378. @d5 33
  379. a37 1
  380.  
  381. a202 1
  382.  
  383. @
  384.  
  385.  
  386. 1.1.1.1
  387. log
  388. @Bahasa Indonesia Dictionary
  389. @
  390. text
  391. @@
  392.