/
fungsi.php
86 lines (73 loc) · 2.12 KB
/
fungsi.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
date_default_timezone_set("Asia/Jakarta");
function sesi($grup){
if($_SESSION['grup'] != $grup){
echo '<script>window.location.assign("inside.php");</script>';
}
}
function cekbok($a,$b){
if($a==$b){
return "checked";
}
}
function tabel(){
echo "\n<script>$(document).ready(function(){ $('#tbl,#tbl2,#tbl3').dataTable();});</script>";
}
function yakin(){
echo "onClick=\"return confirm('Apakah Anda yakin akan melakukan aksi ini?');\" ";
}
function eksyen($teks=false,$tujuan){ // buat pindah halaman
if($teks){
die("<script>alert('$teks');</script>
<meta http-equiv='refresh' content='0;$tujuan'>");
}else{
die("<meta http-equiv='refresh' content='0;$tujuan'>");
}
}
function getdata($tabel,$dimana,$kolom){
$a = mysql_query("select * from $tabel where $dimana");
$b = mysql_fetch_array($a);
return $b[$kolom];
}
function ambildata($guid,$tabel,$kolom,$where=null){
if($where==null){
$a = mysql_query("select * from $tabel where GUID='$guid'");
}else{
$a = mysql_query("select * from $tabel where $where");
}
$b = mysql_fetch_array($a);
return $b[$kolom];
}
function data_user($guid,$kolom){
$a = mysql_query("select * from user where GUID='$guid'");
$b = mysql_fetch_array($a);
return $b[$kolom];
}
function data_user_detail($guid,$kolom){
$a = mysql_query("select * from user_detail where GUID='$guid'");
$b = mysql_fetch_array($a);
return $b[$kolom];
}
function data_user_detail_user($guid,$kolom){
$a = mysql_query("select * from user_detail where USER_ID='$guid'");
$b = mysql_fetch_array($a);
return $b[$kolom];
}
function data_mog_user_detail($guid,$kolom){
$a = mysql_query("select * from member_of_group where USER_DETAIL_ID='$guid'");
$b = mysql_fetch_array($a);
return $b[$kolom];
}
function data_group_name($guid,$kolom){
$a = mysql_query("select * from ms_group where GUID='$guid'");
$b = mysql_fetch_array($a);
return $b[$kolom];
}
function group_name($uid,$kolom){
$iduser = data_user($uid,'GUID');
$iduserdetail = data_user_detail_user($iduser,'GUID');
$idmog = data_mog_user_detail($iduserdetail,'MS_GROUP_ID');
$grup = data_group_name($idmog,'GROUP_NAME');
return $grup;
}
?>