cvs: php-master-web /include login.inc /manage user-notes.php
| From: | Gabor Hojtsy | Date: | Thu, 10 Jun 2004 08:38:30 +0000 |
| Subject: | cvs: php-master-web /include login.inc /manage user-notes.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-24912@lists.php.net to get a copy of this message | ||
goba Thu Jun 10 04:38:30 2004 EDT
Modified files:
/php-master-web/include login.inc
/php-master-web/manage user-notes.php
Log:
reuse login code in the user notes script (it should remember the query string properly to take
actions after login initiated with the PHP manual buttons)
http://cvs.php.net/diff.php/php-master-web/include/login.inc?r1=1.3&r2=1.4&ty=u
Index: php-master-web/include/login.inc
diff -u php-master-web/include/login.inc:1.3 php-master-web/include/login.inc:1.4
--- php-master-web/include/login.inc:1.3 Thu Jun 10 04:28:47 2004
+++ php-master-web/include/login.inc Thu Jun 10 04:38:30 2004
@@ -1,5 +1,5 @@
<?php
-/* $Id: login.inc,v 1.3 2004/06/10 08:28:47 goba Exp $ */
+/* $Id: login.inc,v 1.4 2004/06/10 08:38:30 goba Exp $ */
include_once 'cvs-auth.inc';
@@ -23,21 +23,6 @@
list($user, $pw) = explode(":", base64_decode($_COOKIE['MAGIC_COOKIE']));
}
-function query_string() {
- if ($_SERVER['QUERY_STRING']) {
- return htmlspecialchars("?{$_SERVER['QUERY_STRING']}");
- }
-}
-
-function preserve_form_fields() {
- if ($_SERVER['REQUEST_METHOD'] == "POST" &&
@is_array($_POST['in'])) {
- while (list($k, $v) = each($_POST['in'])) {
- echo "<input type=\"hidden\" name=\"in[",
htmlspecialchars($k),
- "]\" value=\"", htmlspecialchars($v), "\"
/>\n";
- }
- }
-}
-
// Login form, if the user is not yet logged in
if (!$user || !$pw || !verify_password($user,$pw)) { ?>
<html>
@@ -66,4 +51,23 @@
</html>
<?php
exit;
+}
+
+// ----------------------------------------------------------------------------------
+
+function query_string()
+{
+ if ($_SERVER['QUERY_STRING']) {
+ return htmlspecialchars("?{$_SERVER['QUERY_STRING']}");
+ }
+}
+
+function preserve_form_fields()
+{
+ if ($_SERVER['REQUEST_METHOD'] == "POST" &&
@is_array($_POST['in'])) {
+ while (list($k, $v) = each($_POST['in'])) {
+ echo "<input type=\"hidden\" name=\"in[",
htmlspecialchars($k),
+ "]\" value=\"", htmlspecialchars($v), "\"
/>\n";
+ }
+ }
}
http://cvs.php.net/diff.php/php-master-web/manage/user-notes.php?r1=1.40&r2=1.41&ty=u
Index: php-master-web/manage/user-notes.php
diff -u php-master-web/manage/user-notes.php:1.40 php-master-web/manage/user-notes.php:1.41
--- php-master-web/manage/user-notes.php:1.40 Thu Jun 10 04:28:48 2004
+++ php-master-web/manage/user-notes.php Thu Jun 10 04:38:30 2004
@@ -1,11 +1,11 @@
<?php
-// $Id: user-notes.php,v 1.40 2004/06/10 08:28:48 goba Exp $
+// $Id: user-notes.php,v 1.41 2004/06/10 08:38:30 goba Exp $
+// Force login before action can be taken
+include_once 'login.inc';
include_once 'functions.inc';
-include_once 'cvs-auth.inc';
include_once 'email-validation.inc';
-// ** alerts ** remove comment when alerts are on-line
-//require_once 'alert_lib.inc';
+//require_once 'alert_lib.inc'; // remove comment if alerts are needed
$mailto = $mailfrom = "php-notes@lists.php.net";
@@ -33,43 +33,6 @@
at <http://php.net/support>.
Your note has been removed from the online manual.';
-
-if($user && $pass) {
-
setcookie("MAGIC_COOKIE",base64_encode("$user:$pass"),time()+3600*24*12,'/','.php.net');
-}
-
-if (!$user && isset($MAGIC_COOKIE)) {
- list($user, $pass) = explode(":", base64_decode($MAGIC_COOKIE));
-}
-
-if (!$user || !$pass || !verify_password($user,$pass)) {
- head();?>
-<p>You have to log in first.</p>
-<form method="post" action="<?php echo $PHP_SELF;?>">
-<?php
-if (isset($action))
- echo '<input type="hidden" name="action" value="' .
clean($action) . '" />';
-?>
-<table>
- <tr>
- <th align="right">CVS username:</th>
- <td><input type="text" name="user" value="<?php echo
clean($user);?>" size="10" maxlength="32" /></td>
- </tr>
- <tr>
- <th align="right">CVS password:</th>
- <td><input type="password" name="pass" value="<?php echo
clean($pass);?>" size="10" maxlength="32" /></td>
- </tr>
- <tr>
- <td align="center" colspan="2">
- <input type="submit" value="Log in" />
- </td>
- </tr>
-</table>
-</form>
-<?php
- foot();
- exit;
-}
if (!isset($action)) {
// search !