/[gentoo-src]/glep15/authenticate.php
Gentoo

Contents of /glep15/authenticate.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sat Nov 22 15:40:37 2003 UTC (11 years, 1 month ago) by hythloday
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +11 -7 lines
Added skeleton upload and viewing capabilities.

1 <?php
2 /***************************************************************************
3 * authenticate.php
4 *
5 * Fri Oct 17 17:19:18 2003
6 * Copyright 2003 lisa seelye - lisa@gentoo.org
7 * Copyright 2003 Gentoo Technologies, Inc. - http://www.gentoo.org/
8 *
9 * $Header: /home/cvsroot/gentoo-src/glep15/authenticate.php,v 1.2 2003/11/21 17:17:01 hythloday Exp $
10 ***************************************************************************
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 **************************************************************************/
25
26 /* This is a module for authentication. It has one public function,
27 * authenticate(), which takes two string parameters: $username and $password.
28 * It should return TRUE (userid) or FALSE, if the username/password
29 * combination results in an authenticated user.
30
31 *** TEST THIS FUNCTION THOROUGHLY***
32 */
33
34 @require_once("mysql.php");
35 @require_once("functions.php");
36 @require_once("cookie.php");
37
38 function authenticate($username,$password) {
39 global $link, $user_table;
40 $username = norm($username);
41 $password = md5(norm($password));
42 $sql = "SELECT uid FROM $user_table WHERE uname='$username' AND upw='$password'";
43 $result = @mysql_query($sql,$link);
44 if ( $result ) {
45 /* NULL if not a good user/pass match */
46 $obj = mysql_fetch_object($result);
47 }
48 return $obj->uid;
49 }
50
51 /* Add by jh as this needs to be part of the API somewhere. */
52 function get_username () {
53 return "FIXME";
54 }
55 ?>

  ViewVC Help
Powered by ViewVC 1.1.20