Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- echo myUri(2);
- print_r($_POST);//username, password, type
- $select="<option>Pilih Tipe</option>";
- foreach($_POST as $nm=>$val)$$nm=$val;
- $sql="select * from `".prefix()."users` where username='$username'";
- $userData= queryFetch($sql);
- if($userData['password'])
- {
- //PROSES CHECK APAKAH PASSWORD BENAR.. proses ini milik joomla
- $ar=explode(":",$userData['password']);
- $pass=md5($password.$ar[1]).":$ar[1]";
- $sql="select count(password) c from `".prefix()."users`
- where username='$username' and password='$pass'";
- echo $sql;
- $row=queryFetch($sql);
- $loginOK=$row['c']==1?TRUE:FALSE;
- //password salah
- if(!$loginOK)
- $alert="Periksa kembali User dan Password Anda";
- }else{
- $loginOK=FALSE;
- $alert="Periksa kembali User Anda";
- }
- if(intval($type)==0&&$loginOK==TRUE)
- {
- //==============LIST YANG BISA DI AMBIL
- $sql="select role_id id, role_name name
- from `".prefix()."hrd_role` role, `".prefix()."hrd_userrole` userrole
- where role.role_id=urole_role
- and urole_user=$userData[id]";
- $q=query($sql);
- $select="";
- while($row=fetch($q))
- {
- $select.="<option value='{$row['id']}'>{$row['name']}</option>";
- }
- }elseif($loginOK==TRUE){
- $sql="select count(role_name) c
- from `".prefix()."hrd_role` role, `".prefix()."hrd_userrole` userrole
- where role.role_id=urole_role
- and urole_user=$userData[id]
- and urole_role=$type";
- $row=queryFetch($sql);
- $loginOK=$row['c']==1?TRUE:FALSE;
- $loginOK=="TRUE"?$url=my_url()."usercp":$url=NULL;
- //===bila tipe yang dipilih tidak sesuai tidak akan di proses
- if(!$loginOK){
- $alert="Periksa kembali Role Anda";
- }else{
- $alert="Selamat Datang ".$userData['name'];
- }
- }
- $post=ob_get_contents();
- ob_end_clean();
- $a=array(
- 'post'=>$post
- );
- if(isset($select))
- {
- $a['type']=$select;
- }
- if(isset($url))
- {
- $a['url']=$url;
- }
- if(isset($alert))
- {
- $a['alert']=$alert;
- }
- $json= json_encode($a);
- die($json);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement