/[webwml]/newmaint/gpglogin2.wml
ViewVC logotype

Contents of /newmaint/gpglogin2.wml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Sun Aug 14 19:16:26 2005 UTC (7 years, 9 months ago) by tbm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +3 -0 lines
add proper copyright headers.  This code is unser the GPL, version 2 or
higher.  Most of it has been written by Craig Small <csmall@debian.org> and
Martin Michlmayr <tbm@cyrius.com>, with some contributions from Peter
Palfrader <weasel@debian.org>, Ralf Treinen <treinen@debian.org> and
others.
1 # Copyright (C) 2001, 2002, 2003, 2004, 2005 Martin Michlmayr <tbm@cyrius.com>
2 # This file may be distributed under the GPL v2 or higher.
3
4 <?
5
6 session_start();
7 include("gpgconfig.inc");
8 include("common.inc");
9
10 session_name("GPG-Coord");
11
12 ?>
13 <HTML>
14 <BODY bgcolor="#ffffff">
15 <?
16 function find_person($login, $password) {
17 global $s_username;
18
19 if (! ($db = open_db())) {
20 return FALSE;
21 }
22 $sql = "SELECT * FROM people WHERE email = '$login'";
23 if (! ($result = pg_exec($db, $sql))) {
24 echo "Problem with query", pg_ErrorMessage($db), "<BR>";
25 return FALSE;
26 }
27 if (pg_NumRows($result) == 1) {
28 $row = pg_Fetch_Array($result, 0);
29 if ((passwd_verify($row["passwd"], $password)) || ($row["passwd"] == "")) {
30 $s_username = $login;
31 session_register("s_username");
32 return TRUE;
33 }
34 }
35 return FALSE;
36 }
37 ?>
38 <?
39 #=============main()
40 if ($_REQUEST['username'] == "") {
41 ?>
42 No username supplied, please click the back button and enter in a username.
43 <?
44 session_destroy();
45 } else {
46 $username = strip_tags($_REQUEST['username']);
47 $passwd = strip_tags($_REQUEST['passwd']);
48 if (find_person($username, $passwd)) {
49
50 echo "<META http-equiv=\"refresh\" content=\"0;URL=gpgmain.php?";?><?=SID?>
51 <? echo "\">"; ?>
52 Logged in ok, click <A href="gpgmain.php?<?=SID?>">here</A> to continue if the
53 refresh doesn't do it itself.
54 <?
55 } else {
56 session_destroy();
57 echo "<P>I can either not find you in the database or you have entered in ",
58 "the wrong password. Click <A href=\"gpgpasswd.php?email=$username\">here</A> ",
59 "to receive your password by e-mail.</P>";
60 }
61 } ?>
62 </BODY>
63 </HTML>

  ViewVC Help
Powered by ViewVC 1.1.5