add back-office xmlrpc api and daemon, RT#27958
[freeside.git] / ng_selfservice / process_login.php
1 <?
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' => $_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:index.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, setting cookie");
31
32 // now what?  for now, always redirect to the main page.
33 // eventually, other options?
34
35 setcookie('session_id', $session_id);
36
37 header("Location:main.php")
38 #die();
39
40 ?>