a4c2fff41646c635ef76cddeb4be8013c8c3c95f
[freeside.git] / fs_selfservice / wordpress / process_login.php
1 <?php
2
3 $GLOBALS['FREESIDE_PROCESS_LOGIN'] = true;
4
5 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
6
7 $response = $GLOBALS['FREESIDE_LOGIN_RESPONSE'];
8
9 if ( $response['custnum'] || $response['svcnum'] ) {
10
11   wp_redirect("example_selfservice.php");
12   exit;
13
14 } elseif ( $response['customers'] ) {
15   get_header();
16 ?>
17
18   <?php include(dirname(__FILE__).'/elements/error.php'); ?>
19
20   <FORM NAME="SelectCustomerForm" ACTION="process_select_cust.php" METHOD=POST>
21   <INPUT TYPE="hidden" NAME="action" VALUE="switch_cust">
22
23   <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=2 CELLPADDING=0>
24
25     <TR>
26       <TH ALIGN="right">Customer </TH>
27       <TD>
28         <SELECT NAME="custnum" ID="custnum" onChange="custnum_changed()">
29           <OPTION VALUE="">Select a customer
30           <?php foreach ( $response['customers'] AS $custnum => $customer ) { ?>
31             <OPTION VALUE="<?php echo $custnum ?>"><?php echo htmlspecialchars( $customer ) ?>
32           <?php } ?>
33         </SELECT>
34       </TD>
35     </TR>
36
37     <TR>
38       <TD COLSPAN=2 ALIGN="center"><INPUT TYPE="submit" ID="submit" VALUE="Select customer" DISABLED></TD>
39     </TR>
40
41   </TABLE>
42   </FORM>
43
44   <SCRIPT TYPE="text/javascript">
45
46   function custnum_changed () {
47     var form = document.SelectCustomerForm;
48     if ( form.custnum.selectedIndex > 0 ) {
49       form.submit.disabled = false;
50     } else {
51       form.submit.disabled = true;
52     }
53   }
54
55   </SCRIPT>
56
57 <?php
58
59 // } else {
60 // 
61 //   die 'login successful, but unrecognized info (no custnum, svcnum or customers)';
62   
63 }
64
65 ?>
66
67 <?php get_footer(); ?>
68