cvs: php-master-web /include login.inc
| From: | jim winstead | Date: | Sat, 27 Oct 2001 19:59:56 +0000 |
| Subject: | cvs: php-master-web /include login.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-7217@lists.php.net to get a copy of this message | ||
jimw Sat Oct 27 15:59:56 2001 EDT
Modified files:
/php-master-web/include login.inc
Log:
preserve query string and posted in[] array across login attempts
Index: php-master-web/include/login.inc
diff -u php-master-web/include/login.inc:1.1 php-master-web/include/login.inc:1.2
--- php-master-web/include/login.inc:1.1 Wed Oct 17 20:22:49 2001
+++ php-master-web/include/login.inc Sat Oct 27 15:59:55 2001
@@ -9,13 +9,29 @@
list($user,$pw) = explode(":", base64_decode($MAGIC_COOKIE));
}
+function query_string() {
+ if ($GLOBALS['QUERY_STRING']) {
+ return htmlspecialchars("?$GLOBALS[QUERY_STRING]");
+ }
+}
+
+function preserve_form_fields() {
+ if ($GLOBALS['REQUEST_METHOD'] == "POST" &&
@is_array($GLOBALS['in'])) {
+ while (list($k,$v) = each($GLOBALS['in'])) {
+ echo "<input type=\"hidden\" name=\"in[", htmlspecialchars($k),
+ "]\" value=\"", htmlspecialchars($v), "\" />\n";
+ }
+ }
+}
+
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?>">
+<form method="post" action="<?php echo $PHP_SELF,
query_string();?>">
+<?php echo preserve_form_fields();?>
<input type="hidden" name="save" value="1" />
<table>
<tr>