Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function parseITBLDAPAttribute($x)
- {
- $z = new StdClass;
- $x = explode(';',$x);
- for($n=0;$n<count($x);$n++){
- $y = explode('=>',$x[$n]);
- if(count($y) > 1){
- $z->{$y[0]} = isset($y[1]) ? $y[1] : '';
- }
- }
- return $z;
- }
- function access_post(){
- $username = $this->post('username');
- $password = $this->post('password');
- $silogin = array(
- 'username' => $username,
- 'password' => $password
- );
- $wsdl = 'http://nic-ng.itb.ac.id/riset/sson.php?wsdl';
- $client = new nusoap_client($wsdl,true);
- $cekuser = ($client->call('login',$silogin) == '1' ? TRUE : FALSE);
- if ($cekuser) {
- $ITB_LDAPAttributes = $client->call('getAllAtribute', array(
- 'SID'=> $silogin['username']
- ));
- $LDAP_parsedData = $this->parseITBLDAPAttribute($ITB_LDAPAttributes);
- $userdata = array(
- 'id_ITB' => $silogin['username'],
- 'profile' => array(
- 'ai3' => $silogin['username'],
- 'nama' => $LDAP_parsedData->itbNamaLengkap,
- 'email' => explode(',', $LDAP_parsedData->itbAlamatMail),
- 'email_nonITB' => isset($LDAP_parsedData->itbEmailNonITB) ? $LDAP_parsedData->itbEmailNonITB: '',
- 'nip' => isset($LDAP_parsedData->itbNIP)? @end(explode(',',$LDAP_parsedData->itbNIP)) : "",
- 'nim' => isset($LDAP_parsedData->itbNIM)? @end(explode(',',$LDAP_parsedData->itbNIM)) : "",
- 'unit' => $LDAP_parsedData->itbUnity,
- 'jenis_civitas' => $LDAP_parsedData->itbStatus
- )
- );
- echo $userdata;
- } else{
- //$this->response(array('status'=>false,'message'=>'Akun Anda Tidak Ada !'));
- echo "Akun Tidak Ada";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement