File:  [mozdev] / cdn / www / b2-include / b2verifauth.php
Revision 1.6: download - view: text, annotated - select for diffs - revision graph
Thu Mar 6 15:08:48 2003 UTC (16 years, 4 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
.

    1: <?php
    2: 
    3: require_once(PROJECT_PATH . '/b2config.php');
    4: 
    5: /* connecting the db */
    6: $connexion = @mysql_connect($server,$loginsql,$passsql) or die("Can't connect to the database<br>".mysql_error());
    7: mysql_select_db("$base");
    8: 
    9: /* checking login & pass in the database */
   10: function veriflog() {
   11: 	global $HTTP_COOKIE_VARS;
   12: 	global $tableusers,$tablesettings,$tablecategories,$tableposts,$tablecomments;
   13: 
   14: 	if (!empty($HTTP_COOKIE_VARS["cafeloguser"])) {
   15: 		$user_login = $HTTP_COOKIE_VARS["cafeloguser"];
   16: 		$user_pass_md5 = $HTTP_COOKIE_VARS["cafelogpass"];
   17: 	} else {
   18: 		return false;
   19: 	}
   20: 
   21: 	if (!($user_login != ""))
   22: 		return false;
   23: 	if (!$user_pass_md5)
   24: 		return false;
   25: 
   26: 	$query =  " SELECT user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' ";
   27: 	$result = @mysql_query($query) or die("Query: $query<br /><br />Error: ".mysql_error());
   28: 
   29: 	$lines = mysql_num_rows($result);
   30: 	if ($lines<1) {
   31: 		return false;
   32: 	} else {
   33: 		$res=mysql_fetch_row($result);
   34: 		if ($res[0]==$user_login && md5($res[1])==$user_pass_md5) {
   35: 			return true;
   36: 		} else {
   37: 			return false;
   38: 		}
   39: 	}
   40: }
   41: #if ( $user_login!="" && $user_pass!="" && $id_session!="" && $adresse_ip==$REMOTE_ADDR) {
   42: #	if ( !(veriflog()) AND !(verifcookielog()) ) {
   43: 	if (!(veriflog())) {
   44: 		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
   45: 		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
   46: 		header("Cache-Control: no-cache, must-revalidate");
   47: 		header("Pragma: no-cache");
   48: 		if (!empty($HTTP_COOKIE_VARS["cafeloguser"])) {
   49: 			$error="<b>Error</b>: wrong login or password";
   50: 		}
   51: 		include(PROJECT_PATH . "/protected/b2login.php");
   52: 		exit();
   53: 	}
   54: #}
   55: ?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>