summaryrefslogtreecommitdiff
path: root/ng_selfservice/process_login.php
blob: d2d01550d355341394e5fed42a10da29c2f874c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?

require('freeside.class.php');
$freeside = new FreesideSelfService();

$response = $freeside->login( array( 
  'username' => strtolower($_POST['username']),
  'domain'   => strtolower($_POST['domain']),
  'password' => $_POST['password'],
) );

#error_log("[login] received response from freeside: $response");

$error = $response['error'];

if ( $error ) {

  header('Location:index.php?username='. urlencode($username).
                            '&domain='.   urlencode($domain).
                            '&error='.    urlencode($error)
        );
  die();

}

// sucessful login

$session_id = $response['session_id'];

error_log("[login] logged into freeside with session_id=$session_id, setting cookie");

// now what?  for now, always redirect to the main page.
// eventually, other options?

setcookie('session_id', $session_id);

header("Location:main.php")
#die();

?>