summaryrefslogtreecommitdiff
path: root/fs_selfservice/php/process_login.php
blob: 1f4fd9a6b225e843f1c22ce199ea7913186cab53 (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
<?php

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

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

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

$error = $response['error'];

if ( $error ) {

  header('Location:login.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");

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

header("Location:main.php?session_id=$session_id")
#die();

?>