cvs: php-gtk-web / admin-login.php

[email protected] ("Steph Fox") Wed, 05 Jul 2006 01:30:26 -0000
Newsgroups php.gtk.webmaster
Message-ID <cvssfox1152063026@cvsserver>
sfox		Wed Jul  5 01:30:26 2006 UTC

  Modified files:              
    /php-gtk-web	admin-login.php 
  Log:
  Alter login to work with our own cookie
  
http://cvs.php.net/viewvc.cgi/php-gtk-web/admin-login.php?r1=1.8&r2=1.9&diff_format=u
Index: php-gtk-web/admin-login.php
diff -u php-gtk-web/admin-login.php:1.8 php-gtk-web/admin-login.php:1.9
--- php-gtk-web/admin-login.php:1.8	Mon Mar 27 13:08:09 2006
+++ php-gtk-web/admin-login.php	Wed Jul  5 01:30:26 2006
@@ -1,29 +1,48 @@
 <?php
 
-// 
 // rather than have login pages spread throughout the site let's have one place for logging in
-// that's easy to remember.
-// 
+// that's easy to remember
 
-//require_once 'cvs-auth.inc';
-
-if (!isset($_COOKIE['MAGIC_COOKIE'])) {
-	Header("Location: http://master.php.net/manage/users.php");
-	exit;
-}
+require_once('config.inc');
+require_once('cvs-auth.inc');
 
 commonHeader("Administration Login");
 
-print("
-	<h1>You're logged in</h1>
-	Where do you really want to go today?
-	<br>
-	<br>
-	<ul>
-		<li><a href='/apps/admin-apps.php'>Application Administration</a><br><br>
-		<li><a href='/manual1/admin-notes.php'>Notes Administration</a>
-	</ul>
-");
+if (!isset($_COOKIE['GTK'])) {
+	if (isset($_POST['submit']) && isset($_POST['pass'])) {
+		verify_password($_POST['user'], $_POST['pass']);
+	} else {
+		$user = null;
+?>
+
+		<form action = "<?php echo $_SERVER['PHP_SELF'];?>" method = 'POST'>
+		User: <input type = 'text' name = 'user' value = "<?php echo $user;?>">
+		<br />
+		Pass: <input type = 'password' name = 'pass' value = '' size = '12'>
+		<br />
+		<br />
+		<input type = 'submit' name = 'submit'>
+		</form>
+
+<?php
+	}
+} else {
+	unset($user);
+	unset($pass);
+	print("
+		<h1>You're logged in</h1>
+		Where do you want to go today?
+		<br />
+		<br />
+		<ul>
+			<li><a href='/apps/admin-apps.php'>Application Administration</a>
+			<br />
+			<li><a href='/manual/admin-notes.php'>Notes Administration</a>
+			<br />
+			<li><a href='admin-logout.php'>Log out</a>
+		</ul>
+	");
+}
 
 commonFooter();