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

Contents of /newmaint/gpglogin2.wml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Sun Aug 14 19:15:00 2005 UTC (7 years, 9 months ago) by tbm
Branch: MAIN
Changes since 1.5: +3 -3 lines
Prepare for a migration to PHP 4: use $_REQUEST['var'] and $_SESSION['var']
to refer to web form and session variables.
1 tbm 1.1 <?
2    
3     session_start();
4     include("gpgconfig.inc");
5     include("common.inc");
6    
7     session_name("GPG-Coord");
8     session_unregister("s_username");
9    
10     ?>
11     <HTML>
12     <BODY bgcolor="#ffffff">
13     <?
14     function find_person($login, $password) {
15     global $s_username;
16    
17     if (! ($db = open_db())) {
18     return FALSE;
19     }
20 tbm 1.4 $sql = "SELECT * FROM people WHERE email = '$login'";
21 tbm 1.1 if (! ($result = pg_exec($db, $sql))) {
22     echo "Problem with query", pg_ErrorMessage($db), "<BR>";
23     return FALSE;
24     }
25     if (pg_NumRows($result) == 1) {
26     $row = pg_Fetch_Array($result, 0);
27 weasel 1.3 if ((passwd_verify($row["passwd"], $password)) || ($row["passwd"] == "")) {
28 tbm 1.1 $s_username = $login;
29     session_register("s_username");
30     return TRUE;
31     }
32     }
33     return FALSE;
34     }
35     ?>
36     <?
37     #=============main()
38 tbm 1.6 if ($_REQUEST['username'] == "") {
39 tbm 1.1 ?>
40     No username supplied, please click the back button and enter in a username.
41     <?
42     session_destroy();
43     } else {
44 tbm 1.6 $username = strip_tags($_REQUEST['username']);
45     $passwd = strip_tags($_REQUEST['passwd']);
46 tbm 1.1 if (find_person($username, $passwd)) {
47    
48     echo "<META http-equiv=\"refresh\" content=\"0;URL=gpgmain.php?";?><?=SID?>
49     <? echo "\">"; ?>
50     Logged in ok, click <A href="gpgmain.php?<?=SID?>">here</A> to continue if the
51     refresh doesn't do it itself.
52     <?
53     } else {
54     session_destroy();
55 tbm 1.5 echo "<P>I can either not find you in the database or you have entered in ",
56     "the wrong password. Click <A href=\"gpgpasswd.php?email=$username\">here</A> ",
57 tbm 1.2 "to receive your password by e-mail.</P>";
58 tbm 1.1 }
59     } ?>
60     </BODY>
61     </HTML>

  ViewVC Help
Powered by ViewVC 1.1.5