include ("./config/dbconfig.php3"); include ("./config/common.php3"); include ("./config/functions.php3"); if(!EN_dbConnect()) { $error = mysql_errno().": ".mysql_error(); exit; } // here goes the add session code. if (!isset($PHP_AUTH_USER)) { header('WWW-Authenticate: Basic realm="KRASOS E-Cards"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; $ip = $REMOTE_ADDR; $host = gethostbyaddr($ip); echo "User from host:[$host] with ip address:[$ip] not found"; $error = mysql_errno().": ".mysql_error(); exit; }else if (isset($PHP_AUTH_USER)) { $query = "select userID , username , password , auth , active from users where username = '$PHP_AUTH_USER' and password = '$PHP_AUTH_PW'"; $numresults=@mysql_db_query($db,$query); if(!$numresults) { header('WWW-Authenticate: Basic realm="KRASOS E-Cards"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; $ip = $REMOTE_ADDR; $host = gethostbyaddr($ip); echo "User from host:[$host] with ip address:[$ip] not found"; $error = mysql_errno().": ".mysql_error(); exit; } $numrows=@mysql_num_rows($numresults); $row =@mysql_fetch_array($numresults); if($numrows) { $id = $row['userID']; $auth = $row['auth']; $active = $row['active']; if(!$active) { echo $notActive; exit; } setcookie("loginfo",$id."/".$auth."/".$active); //$query = "insert into PrK_Log values ('0','$id',now(),'user [$username] logged in.')"; //$result = mysql_db_query($db,$query); //if(!$result) //{ //$error = mysql_errno().": ".mysql_error(); // } ?>