cvs: php-master-web /include login.inc /manage mirrors.php
| From: | Jim Winstead | Date: | Thu, 18 Oct 2001 00:22:49 +0000 |
| Subject: | cvs: php-master-web /include login.inc /manage mirrors.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-7056@lists.php.net to get a copy of this message | ||
jimw Wed Oct 17 20:22:49 2001 EDT
Added files:
/php-master-web/include login.inc
Modified files:
/php-master-web/manage mirrors.php
Log:
split login stuff into include file
Index: php-master-web/manage/mirrors.php
diff -u php-master-web/manage/mirrors.php:1.1 php-master-web/manage/mirrors.php:1.2
--- php-master-web/manage/mirrors.php:1.1 Mon Oct 1 16:51:21 2001
+++ php-master-web/manage/mirrors.php Wed Oct 17 20:22:48 2001
@@ -1,5 +1,5 @@
<?php
-require 'cvs-auth.inc';
+require 'login.inc';
# these are just here temporarily. they'll be in a database table eventually.
$COUNTRIES = array(
@@ -88,37 +88,7 @@
'uk' => 'Ukranian',
);
-
-if (isset($save) && isset($user) && isset($pw)) {
-
setcookie("MAGIC_COOKIE",base64_encode("$user:$pw"),time()+3600*24*12,'/','.php.net');
-}
-if (isset($MAGIC_COOKIE) && !isset($user) && !isset($pw)) {
- list($user,$pw) = explode(":", base64_decode($MAGIC_COOKIE));
-}
-
echo '<html><head><title>mirror
administration</title></head><body>';
-
-if (!$user || !$pw || !verify_password($user,$pw)) {?>
-<form method="POST" action="<?php echo $PHP_SELF?>">
-<input type="hidden" name="save" value="1" />
-<table>
- <tr>
- <th align="right">Username:</th>
- <td><input type="text" name="user" value="<?php echo
htmlspecialchars(stripslashes($user));?>" />
- </tr>
- <tr>
- <th align="right">Password:</th>
- <td><input type="password" name="pw" value="<?php echo
htmlspecialchars(stripslashes($pw));?>" />
- </tr>
- <tr>
- <td align="center" colspan="2"><input type="submit"
value="Login" /></td>
- </tr>
-</table>
-</form>
-<?php
- echo '</body></html>';
- exit;
-}
mysql_connect("localhost","nobody","")
or die("unable to connect to database");
Index: php-master-web/include/login.inc
+++ php-master-web/include/login.inc
<?php
require 'cvs-auth.inc';
if (isset($save) && isset($user) && isset($pw)) {
setcookie("MAGIC_COOKIE",base64_encode("$user:$pw"),time()+3600*24*12,'/','.php.net');
}
if (isset($MAGIC_COOKIE) && !isset($user) && !isset($pw)) {
list($user,$pw) = explode(":", base64_decode($MAGIC_COOKIE));
}
if (!$user || !$pw || !verify_password($user,$pw)) {?>
<html>
<head>
<title>you must log in</title>
</head>
<body>
<form method="POST" action="<?php echo $PHP_SELF?>">
<input type="hidden" name="save" value="1" />
<table>
<tr>
<th align="right">Username:</th>
<td><input type="text" name="user" value="<?php echo
htmlspecialchars(stripslashes($user));?>" />
</tr>
<tr>
<th align="right">Password:</th>
<td><input type="password" name="pw" value="<?php echo
htmlspecialchars(stripslashes($pw));?>" />
</tr>
<tr>
<td align="center" colspan="2"><input type="submit"
value="Login" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
exit;
}