|
PCCS MySQLDatabase Admin Tool version 1.3.4
|
/ -> login.php
1 <?php
2 /////////////////////////////////////////////////////////////////////// 3 // Coder: cthorn 4 // Filename: login.php 5 // Function - Provide "VERY SIMPLE" auth 6 // requires mysql userid and passwd 7 // 8 // Check to see if the app has been installed correctly 9 // look for logs/.INSTALLED 10 // 11 // DisplayLogin Function VERY SIMPLE login solution 12
13 if($HTTP_SERVER_VARS["argc"] != 0) // If someone is trying to pass an argument
14 Header("Location: $PHP_SELF"); // Then reload the page argument-free
15
16 // logAction function 17
18 function logAction($action,$logfile_name) {
19 global $db_user, $ip;
20
21 if(file_exists("logs/$logfile_name")) {
22 $logfile = fopen("logs/$logfile_name","a");
23 fputs($logfile,$ip.",".date("dS of F Y h:i:s A")."," . $db_user .",". $action ."\n");
24 fclose($logfile);
25 } else {
26 exec ("touch logs/$logfile_name");
27 $logfile = fopen("logs/$logfile_name","a");
28 fputs($logfile,$ip.",".date("dS of F Y h:i:s A")."," . $db_user .",". $action ."\n");
29 fclose($logfile);
30 }
31 }
32
33
34 // loginPrompt function 35 function loginPrompt() {
36 global $REMOTE_ADDR;
37 $_packagename = "PCCS MySQLDatabase Admin Tool";
38 $_connectedfrom = $REMOTE_ADDR;
39 print "<CENTER>";
40 print "
41 <h2>$_packagename Login</H2><P>";
42 print "
43 <P>
44 <FONT COLOR=red SIZE=+2>
45 You have connected to a Private Networked Web Application.<br>
46 From: <font color=blue>". $_connectedfrom. " </font>
47 <font color=blue>
48 Date: ".date("m-d-Y"). " Time: ".date("H:i:s")."</font>
49 <BR>
50 AUTHORIZED Users are ONLY ALLOWED access.<br>
51 IF YOU ARE NOT AUTHORIZED TO LOGIN<br>
52 Please Disconnect ...
53 </FONT>
54 <P>
55 ";
56
57
58
59 print "
60 <FONT FACE=\"Arial, Helvetica\">
61 <br>
62 Please Enter a MySQL database userid and password!!!
63 <P>
64
65 <form method=post action=dologin.php?action=dologin>
66 Username: <input type=text name=\"userid\" size=25><br>
67 Password: <input type=password name=\"password\" size=25>
68 <br>
69 <input type=submit value=Login>
70 </form>";
71 print "</CENTER>";
72 }
73
74
75 ?>
76 <HTML><HEAD><TITLE>LOGIN SCREEN</TITLE></HEAD>
77 <BODY>
78 <P>
79
80 <CENTER>
81 <TABLE BGCOLOR=#000000 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER
82 BORDER=0 VALIGN=MIDDLE ><TR><TD BGCOLOR=#000000>
83
84 <TABLE BORDER=0 CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER
85 VALIGN=CENTER BGCOLOR=#dddddd WIDTH=100%><TR><TD>
86
87 <TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER
88 VALIGN=TOP BORDER=0><TR BGCOLOR=#0022cf>
89 <TD BGCOLOR=#ffffff>
90 <CENTER><FONT FACE="Arial, Helvetica, Verdana"
91 SIZE=+1 ><B> </B></FONT></CENTER>
92 </TD>
93 <TD BGCOLOR=#ffffff ALIGN=RIGHT WIDTH=32>
94
95 </TD></TR></TABLE>
96
97 <P>
98 <?php
99 //////////////////////////////////////////////////////////////////////////////////////////////////////////// 100 // coder: Chauncey Thorn 101 // email: cthorn 102 /************************************************************************
103 PCCS MySQLDatabase Admin Tool Login Management System
104 Copyright (C) 2000 Chauncey Thorn
105
106 This program is free software; you can redistribute it and/or
107 modify it under the terms of the GNU General Public License
108 as published by the Free Software Foundation; either version 2
109 of the License, or (at your option) any later version.
110
111 This program is distributed in the hope that it will be useful,
112 but WITHOUT ANY WARRANTY; without even the implied warranty of
113 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114 GNU General Public License for more details.
115
116 You should have received a copy of the GNU General Public License
117 along with this program; if not, write to the Free Software
118 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA , USA.
119 **************************************************************************/
120 // updated 10-27-2000 121 // Is this host allowed to connect 122 $turnonallowed = "off";
123 // check to see if $turnonallowed is active 124 // 125 if($turnonallowed == "on") {
126 $ip = $REMOTE_ADDR;
127
128 // Set the allowed remote host conections 129 // If you have a working knowledge of php arrays you should 130 // be able to extend this list 131 $allowed = array("","","");
132
133 if (($ip !="$allowed[0]") && ($ip !="$allowed[1]") && ($ip !="$allowed[2]")){
134 echo "<h1>Sorry <b>$REMOTE_ADDR</b> can't connect to this server!</h1>";
135 echo "<center>";
136 echo "<br>If you are a administrator add this host to the allowed array in
137 login.php<P>";
138 echo "<B>Either way This action has been logged...";
139 echo "</center>";
140 logAction("Remote access attempt from UNAUTHORIZED host :". $REMOTE_ADDR,"dblog.txt");
141 } // end of $turnonallowed
142 }
143 else {
144 // Display Login Prompt
145
146 loginPrompt();
147 }
148
149
150 ?>
151 </TD>
152 </TR>
153 </TABLE>
154
155
156
157 </TD></TR></TABLE>
158 </TD></TR></TABLE>
159 </CENTER>
160 </BODY>
161 </HTML>
| |