Permit EAP-Message and State from the home server, so that
[freeradius.git] / dialup_admin / lib / sql / functions.php3
1 <?php
2 if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
3         include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
4 else{
5         echo "<b>Could not include SQL library</b><br>\n";
6         exit();
7 }
8
9 function connect2db($config)
10 {
11         $link=@da_sql_pconnect($config);
12
13         return $link;
14 }
15
16 function get_user_info($link,$user,$config)
17 {
18         if ($link && $config[sql_use_user_info_table] == 'true'){
19                 $user = da_sql_escape_string($user);
20                 $res=@da_sql_query($link,$config,
21                 "SELECT name FROM $config[sql_user_info_table] WHERE username = '$user';");
22                 if ($res){
23                         $row = @da_sql_fetch_array($res,$config);
24                         if ($row)
25                                 return $row[name];
26                 }       
27         }
28 }
29
30 function closedb($link,$config)
31 {
32         return 1;
33 }
34 function sql_xlat($filter,$login,$config)
35 {
36         $string = $filter;
37         $http_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
38         if ($filter != ''){
39                 $string = preg_replace('/%u/',$login,$string);
40                 $string = preg_replace('/%U/',$http_user,$string);
41                 $string = preg_replace('/%m/',$mappings[$http_user],$string);
42         }
43
44         return $string;
45 }
46 ?>