export NAS table to sqlradius, #14697
[freeside.git] / fs_selfservice / php / process_login.php
1 <?php
2
3 require('freeside.class.php');
4 $freeside = new FreesideSelfService();
5
6 $response = $freeside->login( array( 
7   'username' => strtolower($_POST['username']),
8   'domain'   => strtolower($_POST['domain']),
9   'password' => strtolower($_POST['password']),
10 ) );
11
12 #error_log("[login] received response from freeside: $response");
13
14 $error = $response['error'];
15
16 if ( $error ) {
17
18   header('Location:login.php?username='. urlencode($username).
19                            '&domain='.   urlencode($domain).
20                            '&error='.    urlencode($error)
21         );
22   die();
23
24 }
25
26 // sucessful login
27
28 $session_id = $response['session_id'];
29
30 #error_log("[login] logged into freeside with session_id=$session_id");
31
32 // now what?  for now, always redirect to the main page.
33 // eventually, other options?
34
35 header("Location:main.php?session_id=$session_id")
36 #die();
37
38 ?>