@@ -1,194 +1,194 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | - function tgl_indo($tgl){ |
|
3 | + function tgl_indo($tgl){ |
|
4 | 4 | |
5 | - $tanggal = substr($tgl,8,2); |
|
5 | + $tanggal = substr($tgl,8,2); |
|
6 | 6 | |
7 | - $bulan = getBulan(substr($tgl,5,2)); |
|
7 | + $bulan = getBulan(substr($tgl,5,2)); |
|
8 | 8 | |
9 | - $tahun = substr($tgl,0,4); |
|
9 | + $tahun = substr($tgl,0,4); |
|
10 | 10 | |
11 | - return $tanggal.'/'.$bulan.'/'.$tahun; |
|
11 | + return $tanggal.'/'.$bulan.'/'.$tahun; |
|
12 | 12 | |
13 | - } |
|
13 | + } |
|
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | - function getBulan($bln){ |
|
17 | + function getBulan($bln){ |
|
18 | 18 | |
19 | - switch ($bln){ |
|
19 | + switch ($bln){ |
|
20 | 20 | |
21 | - case 1: |
|
21 | + case 1: |
|
22 | 22 | |
23 | - return "01"; |
|
23 | + return "01"; |
|
24 | 24 | |
25 | - break; |
|
25 | + break; |
|
26 | 26 | |
27 | - case 2: |
|
27 | + case 2: |
|
28 | 28 | |
29 | - return "02"; |
|
29 | + return "02"; |
|
30 | 30 | |
31 | - break; |
|
31 | + break; |
|
32 | 32 | |
33 | - case 3: |
|
33 | + case 3: |
|
34 | 34 | |
35 | - return "03"; |
|
35 | + return "03"; |
|
36 | 36 | |
37 | - break; |
|
37 | + break; |
|
38 | 38 | |
39 | - case 4: |
|
39 | + case 4: |
|
40 | 40 | |
41 | - return "04"; |
|
41 | + return "04"; |
|
42 | 42 | |
43 | - break; |
|
43 | + break; |
|
44 | 44 | |
45 | - case 5: |
|
45 | + case 5: |
|
46 | 46 | |
47 | - return "05"; |
|
47 | + return "05"; |
|
48 | 48 | |
49 | - break; |
|
49 | + break; |
|
50 | 50 | |
51 | - case 6: |
|
51 | + case 6: |
|
52 | 52 | |
53 | - return "06"; |
|
53 | + return "06"; |
|
54 | 54 | |
55 | - break; |
|
55 | + break; |
|
56 | 56 | |
57 | - case 7: |
|
57 | + case 7: |
|
58 | 58 | |
59 | - return "07"; |
|
59 | + return "07"; |
|
60 | 60 | |
61 | - break; |
|
61 | + break; |
|
62 | 62 | |
63 | - case 8: |
|
63 | + case 8: |
|
64 | 64 | |
65 | - return "08"; |
|
65 | + return "08"; |
|
66 | 66 | |
67 | - break; |
|
67 | + break; |
|
68 | 68 | |
69 | - case 9: |
|
69 | + case 9: |
|
70 | 70 | |
71 | - return "09"; |
|
71 | + return "09"; |
|
72 | 72 | |
73 | - break; |
|
73 | + break; |
|
74 | 74 | |
75 | - case 10: |
|
75 | + case 10: |
|
76 | 76 | |
77 | - return "10"; |
|
77 | + return "10"; |
|
78 | 78 | |
79 | - break; |
|
79 | + break; |
|
80 | 80 | |
81 | - case 11: |
|
81 | + case 11: |
|
82 | 82 | |
83 | - return "11"; |
|
83 | + return "11"; |
|
84 | 84 | |
85 | - break; |
|
85 | + break; |
|
86 | 86 | |
87 | - case 12: |
|
87 | + case 12: |
|
88 | 88 | |
89 | - return "12"; |
|
89 | + return "12"; |
|
90 | 90 | |
91 | - break; |
|
91 | + break; |
|
92 | 92 | |
93 | - } |
|
93 | + } |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | |
98 | 98 | |
99 | - function tgl_indo1($tgl1){ |
|
99 | + function tgl_indo1($tgl1){ |
|
100 | 100 | |
101 | - $tanggal1 = substr($tgl1,8,2); |
|
101 | + $tanggal1 = substr($tgl1,8,2); |
|
102 | 102 | |
103 | - $bulan1 = getBulan1(substr($tgl1,5,2)); |
|
103 | + $bulan1 = getBulan1(substr($tgl1,5,2)); |
|
104 | 104 | |
105 | - $tahun1 = substr($tgl1,0,4); |
|
105 | + $tahun1 = substr($tgl1,0,4); |
|
106 | 106 | |
107 | - return $tanggal1.' '.$bulan1.' '.$tahun1; |
|
107 | + return $tanggal1.' '.$bulan1.' '.$tahun1; |
|
108 | 108 | |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | 111 | |
112 | 112 | |
113 | - function getBulan1($bln1){ |
|
113 | + function getBulan1($bln1){ |
|
114 | 114 | |
115 | - switch ($bln1){ |
|
115 | + switch ($bln1){ |
|
116 | 116 | |
117 | - case 1: |
|
117 | + case 1: |
|
118 | 118 | |
119 | - return "Januari"; |
|
119 | + return "Januari"; |
|
120 | 120 | |
121 | - break; |
|
121 | + break; |
|
122 | 122 | |
123 | - case 2: |
|
123 | + case 2: |
|
124 | 124 | |
125 | - return "Februari"; |
|
125 | + return "Februari"; |
|
126 | 126 | |
127 | - break; |
|
127 | + break; |
|
128 | 128 | |
129 | - case 3: |
|
129 | + case 3: |
|
130 | 130 | |
131 | - return "Maret"; |
|
131 | + return "Maret"; |
|
132 | 132 | |
133 | - break; |
|
133 | + break; |
|
134 | 134 | |
135 | - case 4: |
|
135 | + case 4: |
|
136 | 136 | |
137 | - return "April"; |
|
137 | + return "April"; |
|
138 | 138 | |
139 | - break; |
|
139 | + break; |
|
140 | 140 | |
141 | - case 5: |
|
141 | + case 5: |
|
142 | 142 | |
143 | - return "Mei"; |
|
143 | + return "Mei"; |
|
144 | 144 | |
145 | - break; |
|
145 | + break; |
|
146 | 146 | |
147 | - case 6: |
|
147 | + case 6: |
|
148 | 148 | |
149 | - return "Juni"; |
|
149 | + return "Juni"; |
|
150 | 150 | |
151 | - break; |
|
151 | + break; |
|
152 | 152 | |
153 | - case 7: |
|
153 | + case 7: |
|
154 | 154 | |
155 | - return "Juli"; |
|
155 | + return "Juli"; |
|
156 | 156 | |
157 | - break; |
|
157 | + break; |
|
158 | 158 | |
159 | - case 8: |
|
159 | + case 8: |
|
160 | 160 | |
161 | - return "Agustus"; |
|
161 | + return "Agustus"; |
|
162 | 162 | |
163 | - break; |
|
163 | + break; |
|
164 | 164 | |
165 | - case 9: |
|
165 | + case 9: |
|
166 | 166 | |
167 | - return "September"; |
|
167 | + return "September"; |
|
168 | 168 | |
169 | - break; |
|
169 | + break; |
|
170 | 170 | |
171 | - case 10: |
|
171 | + case 10: |
|
172 | 172 | |
173 | - return "Oktober"; |
|
173 | + return "Oktober"; |
|
174 | 174 | |
175 | - break; |
|
175 | + break; |
|
176 | 176 | |
177 | - case 11: |
|
177 | + case 11: |
|
178 | 178 | |
179 | - return "November"; |
|
179 | + return "November"; |
|
180 | 180 | |
181 | - break; |
|
181 | + break; |
|
182 | 182 | |
183 | - case 12: |
|
183 | + case 12: |
|
184 | 184 | |
185 | - return "Desember"; |
|
185 | + return "Desember"; |
|
186 | 186 | |
187 | - break; |
|
187 | + break; |
|
188 | 188 | |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | - } |
|
191 | + } |
|
192 | 192 | |
193 | 193 | ?> |
194 | 194 |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - function tgl_indo($tgl){ |
|
3 | + function tgl_indo($tgl) { |
|
4 | 4 | |
5 | - $tanggal = substr($tgl,8,2); |
|
5 | + $tanggal = substr($tgl, 8, 2); |
|
6 | 6 | |
7 | - $bulan = getBulan(substr($tgl,5,2)); |
|
7 | + $bulan = getBulan(substr($tgl, 5, 2)); |
|
8 | 8 | |
9 | - $tahun = substr($tgl,0,4); |
|
9 | + $tahun = substr($tgl, 0, 4); |
|
10 | 10 | |
11 | 11 | return $tanggal.'/'.$bulan.'/'.$tahun; |
12 | 12 | |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | - function getBulan($bln){ |
|
17 | + function getBulan($bln) { |
|
18 | 18 | |
19 | - switch ($bln){ |
|
19 | + switch ($bln) { |
|
20 | 20 | |
21 | 21 | case 1: |
22 | 22 | |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | |
99 | - function tgl_indo1($tgl1){ |
|
99 | + function tgl_indo1($tgl1) { |
|
100 | 100 | |
101 | - $tanggal1 = substr($tgl1,8,2); |
|
101 | + $tanggal1 = substr($tgl1, 8, 2); |
|
102 | 102 | |
103 | - $bulan1 = getBulan1(substr($tgl1,5,2)); |
|
103 | + $bulan1 = getBulan1(substr($tgl1, 5, 2)); |
|
104 | 104 | |
105 | - $tahun1 = substr($tgl1,0,4); |
|
105 | + $tahun1 = substr($tgl1, 0, 4); |
|
106 | 106 | |
107 | 107 | return $tanggal1.' '.$bulan1.' '.$tahun1; |
108 | 108 | |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | |
112 | 112 | |
113 | - function getBulan1($bln1){ |
|
113 | + function getBulan1($bln1) { |
|
114 | 114 | |
115 | - switch ($bln1){ |
|
115 | + switch ($bln1) { |
|
116 | 116 | |
117 | 117 | case 1: |
118 | 118 |
@@ -6,6 +6,6 @@ |
||
6 | 6 | $password = "root"; |
7 | 7 | $database = "db_puskesmas"; |
8 | 8 | |
9 | -mysql_connect($server,$username,$password) or die("Koneksi gagal"); |
|
9 | +mysql_connect($server, $username, $password) or die("Koneksi gagal"); |
|
10 | 10 | mysql_select_db($database) or die("Database tidak bisa dibuka"); |
11 | 11 | ?> |
@@ -21,133 +21,133 @@ |
||
21 | 21 | barcode( $filepath, $text, $size, $orientation, $code_type, $print, $sizefactor ); |
22 | 22 | |
23 | 23 | function barcode( $filepath="", $text="0", $size="20", $orientation="horizontal", $code_type="code128", $print=false, $SizeFactor=1 ) { |
24 | - $code_string = ""; |
|
25 | - // Translate the $text into barcode the correct $code_type |
|
26 | - if ( in_array(strtolower($code_type), array("code128", "code128b")) ) { |
|
27 | - $chksum = 104; |
|
28 | - // Must not change order of array elements as the checksum depends on the array's key to validate final code |
|
29 | - $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","\`"=>"111422","a"=>"121124","b"=>"121421","c"=>"141122","d"=>"141221","e"=>"112214","f"=>"112412","g"=>"122114","h"=>"122411","i"=>"142112","j"=>"142211","k"=>"241211","l"=>"221114","m"=>"413111","n"=>"241112","o"=>"134111","p"=>"111242","q"=>"121142","r"=>"121241","s"=>"114212","t"=>"124112","u"=>"124211","v"=>"411212","w"=>"421112","x"=>"421211","y"=>"212141","z"=>"214121","{"=>"412121","|"=>"111143","}"=>"111341","~"=>"131141","DEL"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","FNC 4"=>"114131","CODE A"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); |
|
30 | - $code_keys = array_keys($code_array); |
|
31 | - $code_values = array_flip($code_keys); |
|
32 | - for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
33 | - $activeKey = substr( $text, ($X-1), 1); |
|
34 | - $code_string .= $code_array[$activeKey]; |
|
35 | - $chksum=($chksum + ($code_values[$activeKey] * $X)); |
|
36 | - } |
|
37 | - $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
|
38 | - |
|
39 | - $code_string = "211214" . $code_string . "2331112"; |
|
40 | - } elseif ( strtolower($code_type) == "code128a" ) { |
|
41 | - $chksum = 103; |
|
42 | - $text = strtoupper($text); // Code 128A doesn't support lower case |
|
43 | - // Must not change order of array elements as the checksum depends on the array's key to validate final code |
|
44 | - $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","NUL"=>"111422","SOH"=>"121124","STX"=>"121421","ETX"=>"141122","EOT"=>"141221","ENQ"=>"112214","ACK"=>"112412","BEL"=>"122114","BS"=>"122411","HT"=>"142112","LF"=>"142211","VT"=>"241211","FF"=>"221114","CR"=>"413111","SO"=>"241112","SI"=>"134111","DLE"=>"111242","DC1"=>"121142","DC2"=>"121241","DC3"=>"114212","DC4"=>"124112","NAK"=>"124211","SYN"=>"411212","ETB"=>"421112","CAN"=>"421211","EM"=>"212141","SUB"=>"214121","ESC"=>"412121","FS"=>"111143","GS"=>"111341","RS"=>"131141","US"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","CODE B"=>"114131","FNC 4"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); |
|
45 | - $code_keys = array_keys($code_array); |
|
46 | - $code_values = array_flip($code_keys); |
|
47 | - for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
48 | - $activeKey = substr( $text, ($X-1), 1); |
|
49 | - $code_string .= $code_array[$activeKey]; |
|
50 | - $chksum=($chksum + ($code_values[$activeKey] * $X)); |
|
51 | - } |
|
52 | - $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
|
53 | - |
|
54 | - $code_string = "211412" . $code_string . "2331112"; |
|
55 | - } elseif ( strtolower($code_type) == "code39" ) { |
|
56 | - $code_array = array("0"=>"111221211","1"=>"211211112","2"=>"112211112","3"=>"212211111","4"=>"111221112","5"=>"211221111","6"=>"112221111","7"=>"111211212","8"=>"211211211","9"=>"112211211","A"=>"211112112","B"=>"112112112","C"=>"212112111","D"=>"111122112","E"=>"211122111","F"=>"112122111","G"=>"111112212","H"=>"211112211","I"=>"112112211","J"=>"111122211","K"=>"211111122","L"=>"112111122","M"=>"212111121","N"=>"111121122","O"=>"211121121","P"=>"112121121","Q"=>"111111222","R"=>"211111221","S"=>"112111221","T"=>"111121221","U"=>"221111112","V"=>"122111112","W"=>"222111111","X"=>"121121112","Y"=>"221121111","Z"=>"122121111","-"=>"121111212","."=>"221111211"," "=>"122111211","$"=>"121212111","/"=>"121211121","+"=>"121112121","%"=>"111212121","*"=>"121121211"); |
|
57 | - |
|
58 | - // Convert to uppercase |
|
59 | - $upper_text = strtoupper($text); |
|
60 | - |
|
61 | - for ( $X = 1; $X<=strlen($upper_text); $X++ ) { |
|
62 | - $code_string .= $code_array[substr( $upper_text, ($X-1), 1)] . "1"; |
|
63 | - } |
|
64 | - |
|
65 | - $code_string = "1211212111" . $code_string . "121121211"; |
|
66 | - } elseif ( strtolower($code_type) == "code25" ) { |
|
67 | - $code_array1 = array("1","2","3","4","5","6","7","8","9","0"); |
|
68 | - $code_array2 = array("3-1-1-1-3","1-3-1-1-3","3-3-1-1-1","1-1-3-1-3","3-1-3-1-1","1-3-3-1-1","1-1-1-3-3","3-1-1-3-1","1-3-1-3-1","1-1-3-3-1"); |
|
69 | - |
|
70 | - for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
71 | - for ( $Y = 0; $Y < count($code_array1); $Y++ ) { |
|
72 | - if ( substr($text, ($X-1), 1) == $code_array1[$Y] ) |
|
73 | - $temp[$X] = $code_array2[$Y]; |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - for ( $X=1; $X<=strlen($text); $X+=2 ) { |
|
78 | - if ( isset($temp[$X]) && isset($temp[($X + 1)]) ) { |
|
79 | - $temp1 = explode( "-", $temp[$X] ); |
|
80 | - $temp2 = explode( "-", $temp[($X + 1)] ); |
|
81 | - for ( $Y = 0; $Y < count($temp1); $Y++ ) |
|
82 | - $code_string .= $temp1[$Y] . $temp2[$Y]; |
|
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - $code_string = "1111" . $code_string . "311"; |
|
87 | - } elseif ( strtolower($code_type) == "codabar" ) { |
|
88 | - $code_array1 = array("1","2","3","4","5","6","7","8","9","0","-","$",":","/",".","+","A","B","C","D"); |
|
89 | - $code_array2 = array("1111221","1112112","2211111","1121121","2111121","1211112","1211211","1221111","2112111","1111122","1112211","1122111","2111212","2121112","2121211","1121212","1122121","1212112","1112122","1112221"); |
|
90 | - |
|
91 | - // Convert to uppercase |
|
92 | - $upper_text = strtoupper($text); |
|
93 | - |
|
94 | - for ( $X = 1; $X<=strlen($upper_text); $X++ ) { |
|
95 | - for ( $Y = 0; $Y<count($code_array1); $Y++ ) { |
|
96 | - if ( substr($upper_text, ($X-1), 1) == $code_array1[$Y] ) |
|
97 | - $code_string .= $code_array2[$Y] . "1"; |
|
98 | - } |
|
99 | - } |
|
100 | - $code_string = "11221211" . $code_string . "1122121"; |
|
101 | - } |
|
102 | - |
|
103 | - // Pad the edges of the barcode |
|
104 | - $code_length = 20; |
|
105 | - if ($print) { |
|
106 | - $text_height = 30; |
|
107 | - } else { |
|
108 | - $text_height = 0; |
|
109 | - } |
|
24 | + $code_string = ""; |
|
25 | + // Translate the $text into barcode the correct $code_type |
|
26 | + if ( in_array(strtolower($code_type), array("code128", "code128b")) ) { |
|
27 | + $chksum = 104; |
|
28 | + // Must not change order of array elements as the checksum depends on the array's key to validate final code |
|
29 | + $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","\`"=>"111422","a"=>"121124","b"=>"121421","c"=>"141122","d"=>"141221","e"=>"112214","f"=>"112412","g"=>"122114","h"=>"122411","i"=>"142112","j"=>"142211","k"=>"241211","l"=>"221114","m"=>"413111","n"=>"241112","o"=>"134111","p"=>"111242","q"=>"121142","r"=>"121241","s"=>"114212","t"=>"124112","u"=>"124211","v"=>"411212","w"=>"421112","x"=>"421211","y"=>"212141","z"=>"214121","{"=>"412121","|"=>"111143","}"=>"111341","~"=>"131141","DEL"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","FNC 4"=>"114131","CODE A"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); |
|
30 | + $code_keys = array_keys($code_array); |
|
31 | + $code_values = array_flip($code_keys); |
|
32 | + for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
33 | + $activeKey = substr( $text, ($X-1), 1); |
|
34 | + $code_string .= $code_array[$activeKey]; |
|
35 | + $chksum=($chksum + ($code_values[$activeKey] * $X)); |
|
36 | + } |
|
37 | + $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
|
38 | + |
|
39 | + $code_string = "211214" . $code_string . "2331112"; |
|
40 | + } elseif ( strtolower($code_type) == "code128a" ) { |
|
41 | + $chksum = 103; |
|
42 | + $text = strtoupper($text); // Code 128A doesn't support lower case |
|
43 | + // Must not change order of array elements as the checksum depends on the array's key to validate final code |
|
44 | + $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","NUL"=>"111422","SOH"=>"121124","STX"=>"121421","ETX"=>"141122","EOT"=>"141221","ENQ"=>"112214","ACK"=>"112412","BEL"=>"122114","BS"=>"122411","HT"=>"142112","LF"=>"142211","VT"=>"241211","FF"=>"221114","CR"=>"413111","SO"=>"241112","SI"=>"134111","DLE"=>"111242","DC1"=>"121142","DC2"=>"121241","DC3"=>"114212","DC4"=>"124112","NAK"=>"124211","SYN"=>"411212","ETB"=>"421112","CAN"=>"421211","EM"=>"212141","SUB"=>"214121","ESC"=>"412121","FS"=>"111143","GS"=>"111341","RS"=>"131141","US"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","CODE B"=>"114131","FNC 4"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); |
|
45 | + $code_keys = array_keys($code_array); |
|
46 | + $code_values = array_flip($code_keys); |
|
47 | + for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
48 | + $activeKey = substr( $text, ($X-1), 1); |
|
49 | + $code_string .= $code_array[$activeKey]; |
|
50 | + $chksum=($chksum + ($code_values[$activeKey] * $X)); |
|
51 | + } |
|
52 | + $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
|
53 | + |
|
54 | + $code_string = "211412" . $code_string . "2331112"; |
|
55 | + } elseif ( strtolower($code_type) == "code39" ) { |
|
56 | + $code_array = array("0"=>"111221211","1"=>"211211112","2"=>"112211112","3"=>"212211111","4"=>"111221112","5"=>"211221111","6"=>"112221111","7"=>"111211212","8"=>"211211211","9"=>"112211211","A"=>"211112112","B"=>"112112112","C"=>"212112111","D"=>"111122112","E"=>"211122111","F"=>"112122111","G"=>"111112212","H"=>"211112211","I"=>"112112211","J"=>"111122211","K"=>"211111122","L"=>"112111122","M"=>"212111121","N"=>"111121122","O"=>"211121121","P"=>"112121121","Q"=>"111111222","R"=>"211111221","S"=>"112111221","T"=>"111121221","U"=>"221111112","V"=>"122111112","W"=>"222111111","X"=>"121121112","Y"=>"221121111","Z"=>"122121111","-"=>"121111212","."=>"221111211"," "=>"122111211","$"=>"121212111","/"=>"121211121","+"=>"121112121","%"=>"111212121","*"=>"121121211"); |
|
57 | + |
|
58 | + // Convert to uppercase |
|
59 | + $upper_text = strtoupper($text); |
|
60 | + |
|
61 | + for ( $X = 1; $X<=strlen($upper_text); $X++ ) { |
|
62 | + $code_string .= $code_array[substr( $upper_text, ($X-1), 1)] . "1"; |
|
63 | + } |
|
64 | + |
|
65 | + $code_string = "1211212111" . $code_string . "121121211"; |
|
66 | + } elseif ( strtolower($code_type) == "code25" ) { |
|
67 | + $code_array1 = array("1","2","3","4","5","6","7","8","9","0"); |
|
68 | + $code_array2 = array("3-1-1-1-3","1-3-1-1-3","3-3-1-1-1","1-1-3-1-3","3-1-3-1-1","1-3-3-1-1","1-1-1-3-3","3-1-1-3-1","1-3-1-3-1","1-1-3-3-1"); |
|
69 | + |
|
70 | + for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
71 | + for ( $Y = 0; $Y < count($code_array1); $Y++ ) { |
|
72 | + if ( substr($text, ($X-1), 1) == $code_array1[$Y] ) |
|
73 | + $temp[$X] = $code_array2[$Y]; |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + for ( $X=1; $X<=strlen($text); $X+=2 ) { |
|
78 | + if ( isset($temp[$X]) && isset($temp[($X + 1)]) ) { |
|
79 | + $temp1 = explode( "-", $temp[$X] ); |
|
80 | + $temp2 = explode( "-", $temp[($X + 1)] ); |
|
81 | + for ( $Y = 0; $Y < count($temp1); $Y++ ) |
|
82 | + $code_string .= $temp1[$Y] . $temp2[$Y]; |
|
83 | + } |
|
84 | + } |
|
85 | + |
|
86 | + $code_string = "1111" . $code_string . "311"; |
|
87 | + } elseif ( strtolower($code_type) == "codabar" ) { |
|
88 | + $code_array1 = array("1","2","3","4","5","6","7","8","9","0","-","$",":","/",".","+","A","B","C","D"); |
|
89 | + $code_array2 = array("1111221","1112112","2211111","1121121","2111121","1211112","1211211","1221111","2112111","1111122","1112211","1122111","2111212","2121112","2121211","1121212","1122121","1212112","1112122","1112221"); |
|
90 | + |
|
91 | + // Convert to uppercase |
|
92 | + $upper_text = strtoupper($text); |
|
93 | + |
|
94 | + for ( $X = 1; $X<=strlen($upper_text); $X++ ) { |
|
95 | + for ( $Y = 0; $Y<count($code_array1); $Y++ ) { |
|
96 | + if ( substr($upper_text, ($X-1), 1) == $code_array1[$Y] ) |
|
97 | + $code_string .= $code_array2[$Y] . "1"; |
|
98 | + } |
|
99 | + } |
|
100 | + $code_string = "11221211" . $code_string . "1122121"; |
|
101 | + } |
|
102 | + |
|
103 | + // Pad the edges of the barcode |
|
104 | + $code_length = 20; |
|
105 | + if ($print) { |
|
106 | + $text_height = 30; |
|
107 | + } else { |
|
108 | + $text_height = 0; |
|
109 | + } |
|
110 | 110 | |
111 | - for ( $i=1; $i <= strlen($code_string); $i++ ){ |
|
112 | - $code_length = $code_length + (integer)(substr($code_string,($i-1),1)); |
|
111 | + for ( $i=1; $i <= strlen($code_string); $i++ ){ |
|
112 | + $code_length = $code_length + (integer)(substr($code_string,($i-1),1)); |
|
113 | 113 | } |
114 | 114 | |
115 | - if ( strtolower($orientation) == "horizontal" ) { |
|
116 | - $img_width = $code_length*$SizeFactor; |
|
117 | - $img_height = $size; |
|
118 | - } else { |
|
119 | - $img_width = $size; |
|
120 | - $img_height = $code_length*$SizeFactor; |
|
121 | - } |
|
122 | - |
|
123 | - $image = imagecreate($img_width, $img_height + $text_height); |
|
124 | - $black = imagecolorallocate ($image, 0, 0, 0); |
|
125 | - $white = imagecolorallocate ($image, 255, 255, 255); |
|
126 | - |
|
127 | - imagefill( $image, 0, 0, $white ); |
|
128 | - if ( $print ) { |
|
129 | - imagestring($image, 5, 31, $img_height, $text, $black ); |
|
130 | - } |
|
131 | - |
|
132 | - $location = 10; |
|
133 | - for ( $position = 1 ; $position <= strlen($code_string); $position++ ) { |
|
134 | - $cur_size = $location + ( substr($code_string, ($position-1), 1) ); |
|
135 | - if ( strtolower($orientation) == "horizontal" ) |
|
136 | - imagefilledrectangle( $image, $location*$SizeFactor, 0, $cur_size*$SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black) ); |
|
137 | - else |
|
138 | - imagefilledrectangle( $image, 0, $location*$SizeFactor, $img_width, $cur_size*$SizeFactor, ($position % 2 == 0 ? $white : $black) ); |
|
139 | - $location = $cur_size; |
|
140 | - } |
|
115 | + if ( strtolower($orientation) == "horizontal" ) { |
|
116 | + $img_width = $code_length*$SizeFactor; |
|
117 | + $img_height = $size; |
|
118 | + } else { |
|
119 | + $img_width = $size; |
|
120 | + $img_height = $code_length*$SizeFactor; |
|
121 | + } |
|
122 | + |
|
123 | + $image = imagecreate($img_width, $img_height + $text_height); |
|
124 | + $black = imagecolorallocate ($image, 0, 0, 0); |
|
125 | + $white = imagecolorallocate ($image, 255, 255, 255); |
|
126 | + |
|
127 | + imagefill( $image, 0, 0, $white ); |
|
128 | + if ( $print ) { |
|
129 | + imagestring($image, 5, 31, $img_height, $text, $black ); |
|
130 | + } |
|
131 | + |
|
132 | + $location = 10; |
|
133 | + for ( $position = 1 ; $position <= strlen($code_string); $position++ ) { |
|
134 | + $cur_size = $location + ( substr($code_string, ($position-1), 1) ); |
|
135 | + if ( strtolower($orientation) == "horizontal" ) |
|
136 | + imagefilledrectangle( $image, $location*$SizeFactor, 0, $cur_size*$SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black) ); |
|
137 | + else |
|
138 | + imagefilledrectangle( $image, 0, $location*$SizeFactor, $img_width, $cur_size*$SizeFactor, ($position % 2 == 0 ? $white : $black) ); |
|
139 | + $location = $cur_size; |
|
140 | + } |
|
141 | 141 | |
142 | - // Draw barcode to the screen or save in a file |
|
143 | - if ( $filepath=="" ) { |
|
144 | - header ('Content-type: image/png'); |
|
145 | - imagepng($image); |
|
146 | - imagedestroy($image); |
|
147 | - } else { |
|
148 | - imagepng($image,$filepath); |
|
149 | - imagedestroy($image); |
|
150 | - } |
|
142 | + // Draw barcode to the screen or save in a file |
|
143 | + if ( $filepath=="" ) { |
|
144 | + header ('Content-type: image/png'); |
|
145 | + imagepng($image); |
|
146 | + imagedestroy($image); |
|
147 | + } else { |
|
148 | + imagepng($image,$filepath); |
|
149 | + imagedestroy($image); |
|
150 | + } |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | ?> |
@@ -9,95 +9,95 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // For demonstration purposes, get pararameters that are passed in through $_GET or set to the default value |
12 | -$filepath = (isset($_GET["filepath"])?$_GET["filepath"]:""); |
|
13 | -$text = (isset($_GET["text"])?$_GET["text"]:"0"); |
|
14 | -$size = (isset($_GET["size"])?$_GET["size"]:"20"); |
|
15 | -$orientation = (isset($_GET["orientation"])?$_GET["orientation"]:"horizontal"); |
|
16 | -$code_type = (isset($_GET["codetype"])?$_GET["codetype"]:"code128"); |
|
17 | -$print = (isset($_GET["print"])&&$_GET["print"]=='true'?true:false); |
|
18 | -$sizefactor = (isset($_GET["sizefactor"])?$_GET["sizefactor"]:"1"); |
|
12 | +$filepath = (isset($_GET["filepath"]) ? $_GET["filepath"] : ""); |
|
13 | +$text = (isset($_GET["text"]) ? $_GET["text"] : "0"); |
|
14 | +$size = (isset($_GET["size"]) ? $_GET["size"] : "20"); |
|
15 | +$orientation = (isset($_GET["orientation"]) ? $_GET["orientation"] : "horizontal"); |
|
16 | +$code_type = (isset($_GET["codetype"]) ? $_GET["codetype"] : "code128"); |
|
17 | +$print = (isset($_GET["print"]) && $_GET["print"]=='true' ?true:false); |
|
18 | +$sizefactor = (isset($_GET["sizefactor"]) ? $_GET["sizefactor"] : "1"); |
|
19 | 19 | |
20 | 20 | // This function call can be copied into your project and can be made from anywhere in your code |
21 | -barcode( $filepath, $text, $size, $orientation, $code_type, $print, $sizefactor ); |
|
21 | +barcode($filepath, $text, $size, $orientation, $code_type, $print, $sizefactor); |
|
22 | 22 | |
23 | -function barcode( $filepath="", $text="0", $size="20", $orientation="horizontal", $code_type="code128", $print=false, $SizeFactor=1 ) { |
|
23 | +function barcode($filepath = "", $text = "0", $size = "20", $orientation = "horizontal", $code_type = "code128", $print = false, $SizeFactor = 1) { |
|
24 | 24 | $code_string = ""; |
25 | 25 | // Translate the $text into barcode the correct $code_type |
26 | - if ( in_array(strtolower($code_type), array("code128", "code128b")) ) { |
|
26 | + if (in_array(strtolower($code_type), array("code128", "code128b"))) { |
|
27 | 27 | $chksum = 104; |
28 | 28 | // Must not change order of array elements as the checksum depends on the array's key to validate final code |
29 | - $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","\`"=>"111422","a"=>"121124","b"=>"121421","c"=>"141122","d"=>"141221","e"=>"112214","f"=>"112412","g"=>"122114","h"=>"122411","i"=>"142112","j"=>"142211","k"=>"241211","l"=>"221114","m"=>"413111","n"=>"241112","o"=>"134111","p"=>"111242","q"=>"121142","r"=>"121241","s"=>"114212","t"=>"124112","u"=>"124211","v"=>"411212","w"=>"421112","x"=>"421211","y"=>"212141","z"=>"214121","{"=>"412121","|"=>"111143","}"=>"111341","~"=>"131141","DEL"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","FNC 4"=>"114131","CODE A"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); |
|
29 | + $code_array = array(" "=>"212222", "!"=>"222122", "\""=>"222221", "#"=>"121223", "$"=>"121322", "%"=>"131222", "&"=>"122213", "'"=>"122312", "("=>"132212", ")"=>"221213", "*"=>"221312", "+"=>"231212", ","=>"112232", "-"=>"122132", "."=>"122231", "/"=>"113222", "0"=>"123122", "1"=>"123221", "2"=>"223211", "3"=>"221132", "4"=>"221231", "5"=>"213212", "6"=>"223112", "7"=>"312131", "8"=>"311222", "9"=>"321122", ":"=>"321221", ";"=>"312212", "<"=>"322112", "="=>"322211", ">"=>"212123", "?"=>"212321", "@"=>"232121", "A"=>"111323", "B"=>"131123", "C"=>"131321", "D"=>"112313", "E"=>"132113", "F"=>"132311", "G"=>"211313", "H"=>"231113", "I"=>"231311", "J"=>"112133", "K"=>"112331", "L"=>"132131", "M"=>"113123", "N"=>"113321", "O"=>"133121", "P"=>"313121", "Q"=>"211331", "R"=>"231131", "S"=>"213113", "T"=>"213311", "U"=>"213131", "V"=>"311123", "W"=>"311321", "X"=>"331121", "Y"=>"312113", "Z"=>"312311", "["=>"332111", "\\"=>"314111", "]"=>"221411", "^"=>"431111", "_"=>"111224", "\`"=>"111422", "a"=>"121124", "b"=>"121421", "c"=>"141122", "d"=>"141221", "e"=>"112214", "f"=>"112412", "g"=>"122114", "h"=>"122411", "i"=>"142112", "j"=>"142211", "k"=>"241211", "l"=>"221114", "m"=>"413111", "n"=>"241112", "o"=>"134111", "p"=>"111242", "q"=>"121142", "r"=>"121241", "s"=>"114212", "t"=>"124112", "u"=>"124211", "v"=>"411212", "w"=>"421112", "x"=>"421211", "y"=>"212141", "z"=>"214121", "{"=>"412121", "|"=>"111143", "}"=>"111341", "~"=>"131141", "DEL"=>"114113", "FNC 3"=>"114311", "FNC 2"=>"411113", "SHIFT"=>"411311", "CODE C"=>"113141", "FNC 4"=>"114131", "CODE A"=>"311141", "FNC 1"=>"411131", "Start A"=>"211412", "Start B"=>"211214", "Start C"=>"211232", "Stop"=>"2331112"); |
|
30 | 30 | $code_keys = array_keys($code_array); |
31 | 31 | $code_values = array_flip($code_keys); |
32 | - for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
33 | - $activeKey = substr( $text, ($X-1), 1); |
|
32 | + for ($X = 1; $X<=strlen($text); $X++) { |
|
33 | + $activeKey = substr($text, ($X - 1), 1); |
|
34 | 34 | $code_string .= $code_array[$activeKey]; |
35 | - $chksum=($chksum + ($code_values[$activeKey] * $X)); |
|
35 | + $chksum = ($chksum + ($code_values[$activeKey] * $X)); |
|
36 | 36 | } |
37 | 37 | $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
38 | 38 | |
39 | - $code_string = "211214" . $code_string . "2331112"; |
|
40 | - } elseif ( strtolower($code_type) == "code128a" ) { |
|
39 | + $code_string = "211214".$code_string."2331112"; |
|
40 | + } elseif (strtolower($code_type)=="code128a") { |
|
41 | 41 | $chksum = 103; |
42 | 42 | $text = strtoupper($text); // Code 128A doesn't support lower case |
43 | 43 | // Must not change order of array elements as the checksum depends on the array's key to validate final code |
44 | - $code_array = array(" "=>"212222","!"=>"222122","\""=>"222221","#"=>"121223","$"=>"121322","%"=>"131222","&"=>"122213","'"=>"122312","("=>"132212",")"=>"221213","*"=>"221312","+"=>"231212",","=>"112232","-"=>"122132","."=>"122231","/"=>"113222","0"=>"123122","1"=>"123221","2"=>"223211","3"=>"221132","4"=>"221231","5"=>"213212","6"=>"223112","7"=>"312131","8"=>"311222","9"=>"321122",":"=>"321221",";"=>"312212","<"=>"322112","="=>"322211",">"=>"212123","?"=>"212321","@"=>"232121","A"=>"111323","B"=>"131123","C"=>"131321","D"=>"112313","E"=>"132113","F"=>"132311","G"=>"211313","H"=>"231113","I"=>"231311","J"=>"112133","K"=>"112331","L"=>"132131","M"=>"113123","N"=>"113321","O"=>"133121","P"=>"313121","Q"=>"211331","R"=>"231131","S"=>"213113","T"=>"213311","U"=>"213131","V"=>"311123","W"=>"311321","X"=>"331121","Y"=>"312113","Z"=>"312311","["=>"332111","\\"=>"314111","]"=>"221411","^"=>"431111","_"=>"111224","NUL"=>"111422","SOH"=>"121124","STX"=>"121421","ETX"=>"141122","EOT"=>"141221","ENQ"=>"112214","ACK"=>"112412","BEL"=>"122114","BS"=>"122411","HT"=>"142112","LF"=>"142211","VT"=>"241211","FF"=>"221114","CR"=>"413111","SO"=>"241112","SI"=>"134111","DLE"=>"111242","DC1"=>"121142","DC2"=>"121241","DC3"=>"114212","DC4"=>"124112","NAK"=>"124211","SYN"=>"411212","ETB"=>"421112","CAN"=>"421211","EM"=>"212141","SUB"=>"214121","ESC"=>"412121","FS"=>"111143","GS"=>"111341","RS"=>"131141","US"=>"114113","FNC 3"=>"114311","FNC 2"=>"411113","SHIFT"=>"411311","CODE C"=>"113141","CODE B"=>"114131","FNC 4"=>"311141","FNC 1"=>"411131","Start A"=>"211412","Start B"=>"211214","Start C"=>"211232","Stop"=>"2331112"); |
|
44 | + $code_array = array(" "=>"212222", "!"=>"222122", "\""=>"222221", "#"=>"121223", "$"=>"121322", "%"=>"131222", "&"=>"122213", "'"=>"122312", "("=>"132212", ")"=>"221213", "*"=>"221312", "+"=>"231212", ","=>"112232", "-"=>"122132", "."=>"122231", "/"=>"113222", "0"=>"123122", "1"=>"123221", "2"=>"223211", "3"=>"221132", "4"=>"221231", "5"=>"213212", "6"=>"223112", "7"=>"312131", "8"=>"311222", "9"=>"321122", ":"=>"321221", ";"=>"312212", "<"=>"322112", "="=>"322211", ">"=>"212123", "?"=>"212321", "@"=>"232121", "A"=>"111323", "B"=>"131123", "C"=>"131321", "D"=>"112313", "E"=>"132113", "F"=>"132311", "G"=>"211313", "H"=>"231113", "I"=>"231311", "J"=>"112133", "K"=>"112331", "L"=>"132131", "M"=>"113123", "N"=>"113321", "O"=>"133121", "P"=>"313121", "Q"=>"211331", "R"=>"231131", "S"=>"213113", "T"=>"213311", "U"=>"213131", "V"=>"311123", "W"=>"311321", "X"=>"331121", "Y"=>"312113", "Z"=>"312311", "["=>"332111", "\\"=>"314111", "]"=>"221411", "^"=>"431111", "_"=>"111224", "NUL"=>"111422", "SOH"=>"121124", "STX"=>"121421", "ETX"=>"141122", "EOT"=>"141221", "ENQ"=>"112214", "ACK"=>"112412", "BEL"=>"122114", "BS"=>"122411", "HT"=>"142112", "LF"=>"142211", "VT"=>"241211", "FF"=>"221114", "CR"=>"413111", "SO"=>"241112", "SI"=>"134111", "DLE"=>"111242", "DC1"=>"121142", "DC2"=>"121241", "DC3"=>"114212", "DC4"=>"124112", "NAK"=>"124211", "SYN"=>"411212", "ETB"=>"421112", "CAN"=>"421211", "EM"=>"212141", "SUB"=>"214121", "ESC"=>"412121", "FS"=>"111143", "GS"=>"111341", "RS"=>"131141", "US"=>"114113", "FNC 3"=>"114311", "FNC 2"=>"411113", "SHIFT"=>"411311", "CODE C"=>"113141", "CODE B"=>"114131", "FNC 4"=>"311141", "FNC 1"=>"411131", "Start A"=>"211412", "Start B"=>"211214", "Start C"=>"211232", "Stop"=>"2331112"); |
|
45 | 45 | $code_keys = array_keys($code_array); |
46 | 46 | $code_values = array_flip($code_keys); |
47 | - for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
48 | - $activeKey = substr( $text, ($X-1), 1); |
|
47 | + for ($X = 1; $X<=strlen($text); $X++) { |
|
48 | + $activeKey = substr($text, ($X - 1), 1); |
|
49 | 49 | $code_string .= $code_array[$activeKey]; |
50 | - $chksum=($chksum + ($code_values[$activeKey] * $X)); |
|
50 | + $chksum = ($chksum + ($code_values[$activeKey] * $X)); |
|
51 | 51 | } |
52 | 52 | $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
53 | 53 | |
54 | - $code_string = "211412" . $code_string . "2331112"; |
|
55 | - } elseif ( strtolower($code_type) == "code39" ) { |
|
56 | - $code_array = array("0"=>"111221211","1"=>"211211112","2"=>"112211112","3"=>"212211111","4"=>"111221112","5"=>"211221111","6"=>"112221111","7"=>"111211212","8"=>"211211211","9"=>"112211211","A"=>"211112112","B"=>"112112112","C"=>"212112111","D"=>"111122112","E"=>"211122111","F"=>"112122111","G"=>"111112212","H"=>"211112211","I"=>"112112211","J"=>"111122211","K"=>"211111122","L"=>"112111122","M"=>"212111121","N"=>"111121122","O"=>"211121121","P"=>"112121121","Q"=>"111111222","R"=>"211111221","S"=>"112111221","T"=>"111121221","U"=>"221111112","V"=>"122111112","W"=>"222111111","X"=>"121121112","Y"=>"221121111","Z"=>"122121111","-"=>"121111212","."=>"221111211"," "=>"122111211","$"=>"121212111","/"=>"121211121","+"=>"121112121","%"=>"111212121","*"=>"121121211"); |
|
54 | + $code_string = "211412".$code_string."2331112"; |
|
55 | + } elseif (strtolower($code_type)=="code39") { |
|
56 | + $code_array = array("0"=>"111221211", "1"=>"211211112", "2"=>"112211112", "3"=>"212211111", "4"=>"111221112", "5"=>"211221111", "6"=>"112221111", "7"=>"111211212", "8"=>"211211211", "9"=>"112211211", "A"=>"211112112", "B"=>"112112112", "C"=>"212112111", "D"=>"111122112", "E"=>"211122111", "F"=>"112122111", "G"=>"111112212", "H"=>"211112211", "I"=>"112112211", "J"=>"111122211", "K"=>"211111122", "L"=>"112111122", "M"=>"212111121", "N"=>"111121122", "O"=>"211121121", "P"=>"112121121", "Q"=>"111111222", "R"=>"211111221", "S"=>"112111221", "T"=>"111121221", "U"=>"221111112", "V"=>"122111112", "W"=>"222111111", "X"=>"121121112", "Y"=>"221121111", "Z"=>"122121111", "-"=>"121111212", "."=>"221111211", " "=>"122111211", "$"=>"121212111", "/"=>"121211121", "+"=>"121112121", "%"=>"111212121", "*"=>"121121211"); |
|
57 | 57 | |
58 | 58 | // Convert to uppercase |
59 | 59 | $upper_text = strtoupper($text); |
60 | 60 | |
61 | - for ( $X = 1; $X<=strlen($upper_text); $X++ ) { |
|
62 | - $code_string .= $code_array[substr( $upper_text, ($X-1), 1)] . "1"; |
|
61 | + for ($X = 1; $X<=strlen($upper_text); $X++) { |
|
62 | + $code_string .= $code_array[substr($upper_text, ($X - 1), 1)]."1"; |
|
63 | 63 | } |
64 | 64 | |
65 | - $code_string = "1211212111" . $code_string . "121121211"; |
|
66 | - } elseif ( strtolower($code_type) == "code25" ) { |
|
67 | - $code_array1 = array("1","2","3","4","5","6","7","8","9","0"); |
|
68 | - $code_array2 = array("3-1-1-1-3","1-3-1-1-3","3-3-1-1-1","1-1-3-1-3","3-1-3-1-1","1-3-3-1-1","1-1-1-3-3","3-1-1-3-1","1-3-1-3-1","1-1-3-3-1"); |
|
65 | + $code_string = "1211212111".$code_string."121121211"; |
|
66 | + } elseif (strtolower($code_type)=="code25") { |
|
67 | + $code_array1 = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0"); |
|
68 | + $code_array2 = array("3-1-1-1-3", "1-3-1-1-3", "3-3-1-1-1", "1-1-3-1-3", "3-1-3-1-1", "1-3-3-1-1", "1-1-1-3-3", "3-1-1-3-1", "1-3-1-3-1", "1-1-3-3-1"); |
|
69 | 69 | |
70 | - for ( $X = 1; $X <= strlen($text); $X++ ) { |
|
71 | - for ( $Y = 0; $Y < count($code_array1); $Y++ ) { |
|
72 | - if ( substr($text, ($X-1), 1) == $code_array1[$Y] ) |
|
70 | + for ($X = 1; $X<=strlen($text); $X++) { |
|
71 | + for ($Y = 0; $Y<count($code_array1); $Y++) { |
|
72 | + if (substr($text, ($X - 1), 1)==$code_array1[$Y]) |
|
73 | 73 | $temp[$X] = $code_array2[$Y]; |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - for ( $X=1; $X<=strlen($text); $X+=2 ) { |
|
78 | - if ( isset($temp[$X]) && isset($temp[($X + 1)]) ) { |
|
79 | - $temp1 = explode( "-", $temp[$X] ); |
|
80 | - $temp2 = explode( "-", $temp[($X + 1)] ); |
|
81 | - for ( $Y = 0; $Y < count($temp1); $Y++ ) |
|
82 | - $code_string .= $temp1[$Y] . $temp2[$Y]; |
|
77 | + for ($X = 1; $X<=strlen($text); $X += 2) { |
|
78 | + if (isset($temp[$X]) && isset($temp[($X + 1)])) { |
|
79 | + $temp1 = explode("-", $temp[$X]); |
|
80 | + $temp2 = explode("-", $temp[($X + 1)]); |
|
81 | + for ($Y = 0; $Y<count($temp1); $Y++) |
|
82 | + $code_string .= $temp1[$Y].$temp2[$Y]; |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - $code_string = "1111" . $code_string . "311"; |
|
87 | - } elseif ( strtolower($code_type) == "codabar" ) { |
|
88 | - $code_array1 = array("1","2","3","4","5","6","7","8","9","0","-","$",":","/",".","+","A","B","C","D"); |
|
89 | - $code_array2 = array("1111221","1112112","2211111","1121121","2111121","1211112","1211211","1221111","2112111","1111122","1112211","1122111","2111212","2121112","2121211","1121212","1122121","1212112","1112122","1112221"); |
|
86 | + $code_string = "1111".$code_string."311"; |
|
87 | + } elseif (strtolower($code_type)=="codabar") { |
|
88 | + $code_array1 = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "$", ":", "/", ".", "+", "A", "B", "C", "D"); |
|
89 | + $code_array2 = array("1111221", "1112112", "2211111", "1121121", "2111121", "1211112", "1211211", "1221111", "2112111", "1111122", "1112211", "1122111", "2111212", "2121112", "2121211", "1121212", "1122121", "1212112", "1112122", "1112221"); |
|
90 | 90 | |
91 | 91 | // Convert to uppercase |
92 | 92 | $upper_text = strtoupper($text); |
93 | 93 | |
94 | - for ( $X = 1; $X<=strlen($upper_text); $X++ ) { |
|
95 | - for ( $Y = 0; $Y<count($code_array1); $Y++ ) { |
|
96 | - if ( substr($upper_text, ($X-1), 1) == $code_array1[$Y] ) |
|
97 | - $code_string .= $code_array2[$Y] . "1"; |
|
94 | + for ($X = 1; $X<=strlen($upper_text); $X++) { |
|
95 | + for ($Y = 0; $Y<count($code_array1); $Y++) { |
|
96 | + if (substr($upper_text, ($X - 1), 1)==$code_array1[$Y]) |
|
97 | + $code_string .= $code_array2[$Y]."1"; |
|
98 | 98 | } |
99 | 99 | } |
100 | - $code_string = "11221211" . $code_string . "1122121"; |
|
100 | + $code_string = "11221211".$code_string."1122121"; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // Pad the edges of the barcode |
@@ -108,44 +108,44 @@ discard block |
||
108 | 108 | $text_height = 0; |
109 | 109 | } |
110 | 110 | |
111 | - for ( $i=1; $i <= strlen($code_string); $i++ ){ |
|
112 | - $code_length = $code_length + (integer)(substr($code_string,($i-1),1)); |
|
111 | + for ($i = 1; $i<=strlen($code_string); $i++) { |
|
112 | + $code_length = $code_length + (integer)(substr($code_string, ($i - 1), 1)); |
|
113 | 113 | } |
114 | 114 | |
115 | - if ( strtolower($orientation) == "horizontal" ) { |
|
116 | - $img_width = $code_length*$SizeFactor; |
|
115 | + if (strtolower($orientation)=="horizontal") { |
|
116 | + $img_width = $code_length * $SizeFactor; |
|
117 | 117 | $img_height = $size; |
118 | 118 | } else { |
119 | 119 | $img_width = $size; |
120 | - $img_height = $code_length*$SizeFactor; |
|
120 | + $img_height = $code_length * $SizeFactor; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $image = imagecreate($img_width, $img_height + $text_height); |
124 | - $black = imagecolorallocate ($image, 0, 0, 0); |
|
125 | - $white = imagecolorallocate ($image, 255, 255, 255); |
|
124 | + $black = imagecolorallocate($image, 0, 0, 0); |
|
125 | + $white = imagecolorallocate($image, 255, 255, 255); |
|
126 | 126 | |
127 | - imagefill( $image, 0, 0, $white ); |
|
128 | - if ( $print ) { |
|
129 | - imagestring($image, 5, 31, $img_height, $text, $black ); |
|
127 | + imagefill($image, 0, 0, $white); |
|
128 | + if ($print) { |
|
129 | + imagestring($image, 5, 31, $img_height, $text, $black); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $location = 10; |
133 | - for ( $position = 1 ; $position <= strlen($code_string); $position++ ) { |
|
134 | - $cur_size = $location + ( substr($code_string, ($position-1), 1) ); |
|
135 | - if ( strtolower($orientation) == "horizontal" ) |
|
136 | - imagefilledrectangle( $image, $location*$SizeFactor, 0, $cur_size*$SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black) ); |
|
133 | + for ($position = 1; $position<=strlen($code_string); $position++) { |
|
134 | + $cur_size = $location + (substr($code_string, ($position - 1), 1)); |
|
135 | + if (strtolower($orientation)=="horizontal") |
|
136 | + imagefilledrectangle($image, $location * $SizeFactor, 0, $cur_size * $SizeFactor, $img_height, ($position % 2==0 ? $white : $black)); |
|
137 | 137 | else |
138 | - imagefilledrectangle( $image, 0, $location*$SizeFactor, $img_width, $cur_size*$SizeFactor, ($position % 2 == 0 ? $white : $black) ); |
|
138 | + imagefilledrectangle($image, 0, $location * $SizeFactor, $img_width, $cur_size * $SizeFactor, ($position % 2==0 ? $white : $black)); |
|
139 | 139 | $location = $cur_size; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Draw barcode to the screen or save in a file |
143 | - if ( $filepath=="" ) { |
|
144 | - header ('Content-type: image/png'); |
|
143 | + if ($filepath=="") { |
|
144 | + header('Content-type: image/png'); |
|
145 | 145 | imagepng($image); |
146 | 146 | imagedestroy($image); |
147 | 147 | } else { |
148 | - imagepng($image,$filepath); |
|
148 | + imagepng($image, $filepath); |
|
149 | 149 | imagedestroy($image); |
150 | 150 | } |
151 | 151 | } |
@@ -69,8 +69,9 @@ discard block |
||
69 | 69 | |
70 | 70 | for ( $X = 1; $X <= strlen($text); $X++ ) { |
71 | 71 | for ( $Y = 0; $Y < count($code_array1); $Y++ ) { |
72 | - if ( substr($text, ($X-1), 1) == $code_array1[$Y] ) |
|
73 | - $temp[$X] = $code_array2[$Y]; |
|
72 | + if ( substr($text, ($X-1), 1) == $code_array1[$Y] ) { |
|
73 | + $temp[$X] = $code_array2[$Y]; |
|
74 | + } |
|
74 | 75 | } |
75 | 76 | } |
76 | 77 | |
@@ -78,8 +79,9 @@ discard block |
||
78 | 79 | if ( isset($temp[$X]) && isset($temp[($X + 1)]) ) { |
79 | 80 | $temp1 = explode( "-", $temp[$X] ); |
80 | 81 | $temp2 = explode( "-", $temp[($X + 1)] ); |
81 | - for ( $Y = 0; $Y < count($temp1); $Y++ ) |
|
82 | - $code_string .= $temp1[$Y] . $temp2[$Y]; |
|
82 | + for ( $Y = 0; $Y < count($temp1); $Y++ ) { |
|
83 | + $code_string .= $temp1[$Y] . $temp2[$Y]; |
|
84 | + } |
|
83 | 85 | } |
84 | 86 | } |
85 | 87 | |
@@ -93,8 +95,9 @@ discard block |
||
93 | 95 | |
94 | 96 | for ( $X = 1; $X<=strlen($upper_text); $X++ ) { |
95 | 97 | for ( $Y = 0; $Y<count($code_array1); $Y++ ) { |
96 | - if ( substr($upper_text, ($X-1), 1) == $code_array1[$Y] ) |
|
97 | - $code_string .= $code_array2[$Y] . "1"; |
|
98 | + if ( substr($upper_text, ($X-1), 1) == $code_array1[$Y] ) { |
|
99 | + $code_string .= $code_array2[$Y] . "1"; |
|
100 | + } |
|
98 | 101 | } |
99 | 102 | } |
100 | 103 | $code_string = "11221211" . $code_string . "1122121"; |
@@ -132,10 +135,11 @@ discard block |
||
132 | 135 | $location = 10; |
133 | 136 | for ( $position = 1 ; $position <= strlen($code_string); $position++ ) { |
134 | 137 | $cur_size = $location + ( substr($code_string, ($position-1), 1) ); |
135 | - if ( strtolower($orientation) == "horizontal" ) |
|
136 | - imagefilledrectangle( $image, $location*$SizeFactor, 0, $cur_size*$SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black) ); |
|
137 | - else |
|
138 | - imagefilledrectangle( $image, 0, $location*$SizeFactor, $img_width, $cur_size*$SizeFactor, ($position % 2 == 0 ? $white : $black) ); |
|
138 | + if ( strtolower($orientation) == "horizontal" ) { |
|
139 | + imagefilledrectangle( $image, $location*$SizeFactor, 0, $cur_size*$SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black) ); |
|
140 | + } else { |
|
141 | + imagefilledrectangle( $image, 0, $location*$SizeFactor, $img_width, $cur_size*$SizeFactor, ($position % 2 == 0 ? $white : $black) ); |
|
142 | + } |
|
139 | 143 | $location = $cur_size; |
140 | 144 | } |
141 | 145 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <? |
2 | - function getPost($name){ |
|
3 | - if(isset($_POST[$name])) |
|
4 | - return (get_magic_quotes_gpc() ? $_POST[$name] : addslashes($_POST[$name])); |
|
5 | - else |
|
6 | - return false; |
|
7 | - } |
|
2 | + function getPost($name){ |
|
3 | + if(isset($_POST[$name])) |
|
4 | + return (get_magic_quotes_gpc() ? $_POST[$name] : addslashes($_POST[$name])); |
|
5 | + else |
|
6 | + return false; |
|
7 | + } |
|
8 | 8 | ?> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <? |
2 | - function getPost($name){ |
|
3 | - if(isset($_POST[$name])) |
|
2 | + function getPost($name) { |
|
3 | + if (isset($_POST[$name])) |
|
4 | 4 | return (get_magic_quotes_gpc() ? $_POST[$name] : addslashes($_POST[$name])); |
5 | 5 | else |
6 | 6 | return false; |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <? |
2 | 2 | function getPost($name){ |
3 | - if(isset($_POST[$name])) |
|
4 | - return (get_magic_quotes_gpc() ? $_POST[$name] : addslashes($_POST[$name])); |
|
5 | - else |
|
6 | - return false; |
|
3 | + if(isset($_POST[$name])) { |
|
4 | + return (get_magic_quotes_gpc() ? $_POST[$name] : addslashes($_POST[$name])); |
|
5 | + } else { |
|
6 | + return false; |
|
7 | + } |
|
7 | 8 | } |
8 | 9 | ?> |
@@ -2,187 +2,187 @@ |
||
2 | 2 | |
3 | 3 | // Upload gambar untuk product |
4 | 4 | function BarangImage($fupload_name){ |
5 | - //direktori gambar |
|
6 | - $vdir_upload = "../../images/barang/"; |
|
7 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
5 | + //direktori gambar |
|
6 | + $vdir_upload = "../../images/barang/"; |
|
7 | + $vfile_upload = $vdir_upload . $fupload_name; |
|
8 | 8 | |
9 | - //Simpan gambar dalam ukuran sebenarnya |
|
10 | - move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
9 | + //Simpan gambar dalam ukuran sebenarnya |
|
10 | + move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
11 | 11 | |
12 | - //identitas file asli |
|
13 | - $im_src = imagecreatefromjpeg($vfile_upload); |
|
14 | - $src_width = imageSX($im_src); |
|
15 | - $src_height = imageSY($im_src); |
|
12 | + //identitas file asli |
|
13 | + $im_src = imagecreatefromjpeg($vfile_upload); |
|
14 | + $src_width = imageSX($im_src); |
|
15 | + $src_height = imageSY($im_src); |
|
16 | 16 | |
17 | - //Simpan dalam versi small 110 pixel |
|
18 | - //Set ukuran gambar hasil perubahan |
|
19 | - $dst_width = 220; |
|
20 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
17 | + //Simpan dalam versi small 110 pixel |
|
18 | + //Set ukuran gambar hasil perubahan |
|
19 | + $dst_width = 220; |
|
20 | + $dst_height = ($dst_width/$src_width)*$src_height; |
|
21 | 21 | |
22 | - //proses perubahan ukuran |
|
23 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
24 | - imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
22 | + //proses perubahan ukuran |
|
23 | + $im = imagecreatetruecolor($dst_width,$dst_height); |
|
24 | + imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
25 | 25 | |
26 | - //Simpan gambar |
|
27 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
26 | + //Simpan gambar |
|
27 | + imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
28 | 28 | |
29 | 29 | |
30 | - //Simpan dalam versi medium 360 pixel |
|
31 | - //Set ukuran gambar hasil perubahan |
|
32 | - $dst_width2 = 280; |
|
33 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
30 | + //Simpan dalam versi medium 360 pixel |
|
31 | + //Set ukuran gambar hasil perubahan |
|
32 | + $dst_width2 = 280; |
|
33 | + $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
34 | 34 | |
35 | - //proses perubahan ukuran |
|
36 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
37 | - imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
35 | + //proses perubahan ukuran |
|
36 | + $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
37 | + imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
38 | 38 | |
39 | - //Simpan gambar |
|
40 | - //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
41 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
39 | + //Simpan gambar |
|
40 | + //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
41 | + imagejpeg($im2,$vdir_upload . $fupload_name); |
|
42 | 42 | |
43 | - //Hapus gambar di memori komputer |
|
44 | - imagedestroy($im_src); |
|
45 | - imagedestroy($im); |
|
46 | - imagedestroy($im2); |
|
43 | + //Hapus gambar di memori komputer |
|
44 | + imagedestroy($im_src); |
|
45 | + imagedestroy($im); |
|
46 | + imagedestroy($im2); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // Upload gambar untuk news |
50 | 50 | function ProfileImage($fupload_name){ |
51 | - //direktori gambar |
|
52 | - $vdir_upload = "../../images/profile/"; |
|
53 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
51 | + //direktori gambar |
|
52 | + $vdir_upload = "../../images/profile/"; |
|
53 | + $vfile_upload = $vdir_upload . $fupload_name; |
|
54 | 54 | |
55 | - //Simpan gambar dalam ukuran sebenarnya |
|
56 | - move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
55 | + //Simpan gambar dalam ukuran sebenarnya |
|
56 | + move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
57 | 57 | |
58 | - //identitas file asli |
|
59 | - $im_src = imagecreatefromjpeg($vfile_upload); |
|
60 | - $src_width = imageSX($im_src); |
|
61 | - $src_height = imageSY($im_src); |
|
58 | + //identitas file asli |
|
59 | + $im_src = imagecreatefromjpeg($vfile_upload); |
|
60 | + $src_width = imageSX($im_src); |
|
61 | + $src_height = imageSY($im_src); |
|
62 | 62 | |
63 | - //Simpan dalam versi small 110 pixel |
|
64 | - //Set ukuran gambar hasil perubahan |
|
65 | - $dst_width = 280; |
|
66 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
63 | + //Simpan dalam versi small 110 pixel |
|
64 | + //Set ukuran gambar hasil perubahan |
|
65 | + $dst_width = 280; |
|
66 | + $dst_height = ($dst_width/$src_width)*$src_height; |
|
67 | 67 | |
68 | - //proses perubahan ukuran |
|
69 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
70 | - imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
68 | + //proses perubahan ukuran |
|
69 | + $im = imagecreatetruecolor($dst_width,$dst_height); |
|
70 | + imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
71 | 71 | |
72 | - //Simpan gambar |
|
73 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
72 | + //Simpan gambar |
|
73 | + imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
74 | 74 | |
75 | 75 | |
76 | - //Simpan dalam versi medium 360 pixel |
|
77 | - //Set ukuran gambar hasil perubahan |
|
78 | - $dst_width2 = 480; |
|
79 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
76 | + //Simpan dalam versi medium 360 pixel |
|
77 | + //Set ukuran gambar hasil perubahan |
|
78 | + $dst_width2 = 480; |
|
79 | + $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
80 | 80 | |
81 | - //proses perubahan ukuran |
|
82 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
83 | - imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
81 | + //proses perubahan ukuran |
|
82 | + $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
83 | + imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
84 | 84 | |
85 | - //Simpan gambar |
|
86 | - //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
87 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
85 | + //Simpan gambar |
|
86 | + //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
87 | + imagejpeg($im2,$vdir_upload . $fupload_name); |
|
88 | 88 | |
89 | - //Hapus gambar di memori komputer |
|
90 | - imagedestroy($im_src); |
|
91 | - imagedestroy($im); |
|
92 | - imagedestroy($im2); |
|
89 | + //Hapus gambar di memori komputer |
|
90 | + imagedestroy($im_src); |
|
91 | + imagedestroy($im); |
|
92 | + imagedestroy($im2); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | 96 | // Upload gambar untuk product |
97 | 97 | function GuestImage($fupload_name){ |
98 | - //direktori gambar |
|
99 | - $vdir_upload = "../../images/guest/"; |
|
100 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
98 | + //direktori gambar |
|
99 | + $vdir_upload = "../../images/guest/"; |
|
100 | + $vfile_upload = $vdir_upload . $fupload_name; |
|
101 | 101 | |
102 | - //Simpan gambar dalam ukuran sebenarnya |
|
103 | - move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
102 | + //Simpan gambar dalam ukuran sebenarnya |
|
103 | + move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
104 | 104 | |
105 | - //identitas file asli |
|
106 | - $im_src = imagecreatefromjpeg($vfile_upload); |
|
107 | - $src_width = imageSX($im_src); |
|
108 | - $src_height = imageSY($im_src); |
|
105 | + //identitas file asli |
|
106 | + $im_src = imagecreatefromjpeg($vfile_upload); |
|
107 | + $src_width = imageSX($im_src); |
|
108 | + $src_height = imageSY($im_src); |
|
109 | 109 | |
110 | - //Simpan dalam versi small 110 pixel |
|
111 | - //Set ukuran gambar hasil perubahan |
|
112 | - $dst_width = 180; |
|
113 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
110 | + //Simpan dalam versi small 110 pixel |
|
111 | + //Set ukuran gambar hasil perubahan |
|
112 | + $dst_width = 180; |
|
113 | + $dst_height = ($dst_width/$src_width)*$src_height; |
|
114 | 114 | |
115 | - //proses perubahan ukuran |
|
116 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
117 | - imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
115 | + //proses perubahan ukuran |
|
116 | + $im = imagecreatetruecolor($dst_width,$dst_height); |
|
117 | + imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
118 | 118 | |
119 | - //Simpan gambar |
|
120 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
119 | + //Simpan gambar |
|
120 | + imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
121 | 121 | |
122 | 122 | |
123 | - //Simpan dalam versi medium 360 pixel |
|
124 | - //Set ukuran gambar hasil perubahan |
|
125 | - $dst_width2 = 280; |
|
126 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
123 | + //Simpan dalam versi medium 360 pixel |
|
124 | + //Set ukuran gambar hasil perubahan |
|
125 | + $dst_width2 = 280; |
|
126 | + $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
127 | 127 | |
128 | - //proses perubahan ukuran |
|
129 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
130 | - imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
128 | + //proses perubahan ukuran |
|
129 | + $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
130 | + imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
131 | 131 | |
132 | - //Simpan gambar |
|
133 | - //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
134 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
132 | + //Simpan gambar |
|
133 | + //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
134 | + imagejpeg($im2,$vdir_upload . $fupload_name); |
|
135 | 135 | |
136 | - //Hapus gambar di memori komputer |
|
137 | - imagedestroy($im_src); |
|
138 | - imagedestroy($im); |
|
139 | - imagedestroy($im2); |
|
136 | + //Hapus gambar di memori komputer |
|
137 | + imagedestroy($im_src); |
|
138 | + imagedestroy($im); |
|
139 | + imagedestroy($im2); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Upload gambar untuk product |
143 | 143 | function LogoImage($fupload_name){ |
144 | - //direktori gambar |
|
145 | - $vdir_upload = "../../images/logo/"; |
|
146 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
144 | + //direktori gambar |
|
145 | + $vdir_upload = "../../images/logo/"; |
|
146 | + $vfile_upload = $vdir_upload . $fupload_name; |
|
147 | 147 | |
148 | - //Simpan gambar dalam ukuran sebenarnya |
|
149 | - move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
148 | + //Simpan gambar dalam ukuran sebenarnya |
|
149 | + move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
|
150 | 150 | |
151 | - //identitas file asli |
|
152 | - $im_src = imagecreatefromjpeg($vfile_upload); |
|
153 | - $src_width = imageSX($im_src); |
|
154 | - $src_height = imageSY($im_src); |
|
151 | + //identitas file asli |
|
152 | + $im_src = imagecreatefromjpeg($vfile_upload); |
|
153 | + $src_width = imageSX($im_src); |
|
154 | + $src_height = imageSY($im_src); |
|
155 | 155 | |
156 | - //Simpan dalam versi small 110 pixel |
|
157 | - //Set ukuran gambar hasil perubahan |
|
158 | - $dst_width = 180; |
|
159 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
156 | + //Simpan dalam versi small 110 pixel |
|
157 | + //Set ukuran gambar hasil perubahan |
|
158 | + $dst_width = 180; |
|
159 | + $dst_height = ($dst_width/$src_width)*$src_height; |
|
160 | 160 | |
161 | - //proses perubahan ukuran |
|
162 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
163 | - imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
161 | + //proses perubahan ukuran |
|
162 | + $im = imagecreatetruecolor($dst_width,$dst_height); |
|
163 | + imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
164 | 164 | |
165 | - //Simpan gambar |
|
166 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
165 | + //Simpan gambar |
|
166 | + imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
167 | 167 | |
168 | 168 | |
169 | - //Simpan dalam versi medium 360 pixel |
|
170 | - //Set ukuran gambar hasil perubahan |
|
171 | - $dst_width2 = 280; |
|
172 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
169 | + //Simpan dalam versi medium 360 pixel |
|
170 | + //Set ukuran gambar hasil perubahan |
|
171 | + $dst_width2 = 280; |
|
172 | + $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
173 | 173 | |
174 | - //proses perubahan ukuran |
|
175 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
176 | - imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
174 | + //proses perubahan ukuran |
|
175 | + $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
176 | + imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
|
177 | 177 | |
178 | - //Simpan gambar |
|
179 | - //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
180 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
178 | + //Simpan gambar |
|
179 | + //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
|
180 | + imagejpeg($im2,$vdir_upload . $fupload_name); |
|
181 | 181 | |
182 | - //Hapus gambar di memori komputer |
|
183 | - imagedestroy($im_src); |
|
184 | - imagedestroy($im); |
|
185 | - imagedestroy($im2); |
|
182 | + //Hapus gambar di memori komputer |
|
183 | + imagedestroy($im_src); |
|
184 | + imagedestroy($im); |
|
185 | + imagedestroy($im2); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Upload gambar untuk product |
4 | -function BarangImage($fupload_name){ |
|
4 | +function BarangImage($fupload_name) { |
|
5 | 5 | //direktori gambar |
6 | 6 | $vdir_upload = "../../images/barang/"; |
7 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
7 | + $vfile_upload = $vdir_upload.$fupload_name; |
|
8 | 8 | |
9 | 9 | //Simpan gambar dalam ukuran sebenarnya |
10 | 10 | move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
@@ -17,28 +17,28 @@ discard block |
||
17 | 17 | //Simpan dalam versi small 110 pixel |
18 | 18 | //Set ukuran gambar hasil perubahan |
19 | 19 | $dst_width = 220; |
20 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
20 | + $dst_height = ($dst_width / $src_width) * $src_height; |
|
21 | 21 | |
22 | 22 | //proses perubahan ukuran |
23 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
23 | + $im = imagecreatetruecolor($dst_width, $dst_height); |
|
24 | 24 | imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
25 | 25 | |
26 | 26 | //Simpan gambar |
27 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
27 | + imagejpeg($im, $vdir_upload."t_".$fupload_name); |
|
28 | 28 | |
29 | 29 | |
30 | 30 | //Simpan dalam versi medium 360 pixel |
31 | 31 | //Set ukuran gambar hasil perubahan |
32 | 32 | $dst_width2 = 280; |
33 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
33 | + $dst_height2 = ($dst_width2 / $src_width) * $src_height; |
|
34 | 34 | |
35 | 35 | //proses perubahan ukuran |
36 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
36 | + $im2 = imagecreatetruecolor($dst_width2, $dst_height2); |
|
37 | 37 | imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
38 | 38 | |
39 | 39 | //Simpan gambar |
40 | 40 | //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
41 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
41 | + imagejpeg($im2, $vdir_upload.$fupload_name); |
|
42 | 42 | |
43 | 43 | //Hapus gambar di memori komputer |
44 | 44 | imagedestroy($im_src); |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | // Upload gambar untuk news |
50 | -function ProfileImage($fupload_name){ |
|
50 | +function ProfileImage($fupload_name) { |
|
51 | 51 | //direktori gambar |
52 | 52 | $vdir_upload = "../../images/profile/"; |
53 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
53 | + $vfile_upload = $vdir_upload.$fupload_name; |
|
54 | 54 | |
55 | 55 | //Simpan gambar dalam ukuran sebenarnya |
56 | 56 | move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
@@ -63,28 +63,28 @@ discard block |
||
63 | 63 | //Simpan dalam versi small 110 pixel |
64 | 64 | //Set ukuran gambar hasil perubahan |
65 | 65 | $dst_width = 280; |
66 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
66 | + $dst_height = ($dst_width / $src_width) * $src_height; |
|
67 | 67 | |
68 | 68 | //proses perubahan ukuran |
69 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
69 | + $im = imagecreatetruecolor($dst_width, $dst_height); |
|
70 | 70 | imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
71 | 71 | |
72 | 72 | //Simpan gambar |
73 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
73 | + imagejpeg($im, $vdir_upload."t_".$fupload_name); |
|
74 | 74 | |
75 | 75 | |
76 | 76 | //Simpan dalam versi medium 360 pixel |
77 | 77 | //Set ukuran gambar hasil perubahan |
78 | 78 | $dst_width2 = 480; |
79 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
79 | + $dst_height2 = ($dst_width2 / $src_width) * $src_height; |
|
80 | 80 | |
81 | 81 | //proses perubahan ukuran |
82 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
82 | + $im2 = imagecreatetruecolor($dst_width2, $dst_height2); |
|
83 | 83 | imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
84 | 84 | |
85 | 85 | //Simpan gambar |
86 | 86 | //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
87 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
87 | + imagejpeg($im2, $vdir_upload.$fupload_name); |
|
88 | 88 | |
89 | 89 | //Hapus gambar di memori komputer |
90 | 90 | imagedestroy($im_src); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | |
95 | 95 | |
96 | 96 | // Upload gambar untuk product |
97 | -function GuestImage($fupload_name){ |
|
97 | +function GuestImage($fupload_name) { |
|
98 | 98 | //direktori gambar |
99 | 99 | $vdir_upload = "../../images/guest/"; |
100 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
100 | + $vfile_upload = $vdir_upload.$fupload_name; |
|
101 | 101 | |
102 | 102 | //Simpan gambar dalam ukuran sebenarnya |
103 | 103 | move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
@@ -110,28 +110,28 @@ discard block |
||
110 | 110 | //Simpan dalam versi small 110 pixel |
111 | 111 | //Set ukuran gambar hasil perubahan |
112 | 112 | $dst_width = 180; |
113 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
113 | + $dst_height = ($dst_width / $src_width) * $src_height; |
|
114 | 114 | |
115 | 115 | //proses perubahan ukuran |
116 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
116 | + $im = imagecreatetruecolor($dst_width, $dst_height); |
|
117 | 117 | imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
118 | 118 | |
119 | 119 | //Simpan gambar |
120 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
120 | + imagejpeg($im, $vdir_upload."t_".$fupload_name); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | //Simpan dalam versi medium 360 pixel |
124 | 124 | //Set ukuran gambar hasil perubahan |
125 | 125 | $dst_width2 = 280; |
126 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
126 | + $dst_height2 = ($dst_width2 / $src_width) * $src_height; |
|
127 | 127 | |
128 | 128 | //proses perubahan ukuran |
129 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
129 | + $im2 = imagecreatetruecolor($dst_width2, $dst_height2); |
|
130 | 130 | imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
131 | 131 | |
132 | 132 | //Simpan gambar |
133 | 133 | //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
134 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
134 | + imagejpeg($im2, $vdir_upload.$fupload_name); |
|
135 | 135 | |
136 | 136 | //Hapus gambar di memori komputer |
137 | 137 | imagedestroy($im_src); |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // Upload gambar untuk product |
143 | -function LogoImage($fupload_name){ |
|
143 | +function LogoImage($fupload_name) { |
|
144 | 144 | //direktori gambar |
145 | 145 | $vdir_upload = "../../images/logo/"; |
146 | - $vfile_upload = $vdir_upload . $fupload_name; |
|
146 | + $vfile_upload = $vdir_upload.$fupload_name; |
|
147 | 147 | |
148 | 148 | //Simpan gambar dalam ukuran sebenarnya |
149 | 149 | move_uploaded_file($_FILES["fupload"]["tmp_name"], $vfile_upload); |
@@ -156,28 +156,28 @@ discard block |
||
156 | 156 | //Simpan dalam versi small 110 pixel |
157 | 157 | //Set ukuran gambar hasil perubahan |
158 | 158 | $dst_width = 180; |
159 | - $dst_height = ($dst_width/$src_width)*$src_height; |
|
159 | + $dst_height = ($dst_width / $src_width) * $src_height; |
|
160 | 160 | |
161 | 161 | //proses perubahan ukuran |
162 | - $im = imagecreatetruecolor($dst_width,$dst_height); |
|
162 | + $im = imagecreatetruecolor($dst_width, $dst_height); |
|
163 | 163 | imagecopyresampled($im, $im_src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
164 | 164 | |
165 | 165 | //Simpan gambar |
166 | - imagejpeg($im,$vdir_upload . "t_" . $fupload_name); |
|
166 | + imagejpeg($im, $vdir_upload."t_".$fupload_name); |
|
167 | 167 | |
168 | 168 | |
169 | 169 | //Simpan dalam versi medium 360 pixel |
170 | 170 | //Set ukuran gambar hasil perubahan |
171 | 171 | $dst_width2 = 280; |
172 | - $dst_height2 = ($dst_width2/$src_width)*$src_height; |
|
172 | + $dst_height2 = ($dst_width2 / $src_width) * $src_height; |
|
173 | 173 | |
174 | 174 | //proses perubahan ukuran |
175 | - $im2 = imagecreatetruecolor($dst_width2,$dst_height2); |
|
175 | + $im2 = imagecreatetruecolor($dst_width2, $dst_height2); |
|
176 | 176 | imagecopyresampled($im2, $im_src, 0, 0, 0, 0, $dst_width2, $dst_height2, $src_width, $src_height); |
177 | 177 | |
178 | 178 | //Simpan gambar |
179 | 179 | //imagejpeg($im2,$vdir_upload . "medium_" . $fupload_name); |
180 | - imagejpeg($im2,$vdir_upload . $fupload_name); |
|
180 | + imagejpeg($im2, $vdir_upload.$fupload_name); |
|
181 | 181 | |
182 | 182 | //Hapus gambar di memori komputer |
183 | 183 | imagedestroy($im_src); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | //$con = mysqli_connect('103.11.74.20','k7398289_elite','5uperman','k7398289_three'); |
4 | 4 | $con = mysqli_connect('localhost','root','','koperasi'); |
5 | 5 | if (!$con) { |
6 | - die('Could not connect: ' . mysqli_error($con)); |
|
6 | + die('Could not connect: ' . mysqli_error($con)); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | mysqli_select_db($con,"koperasi"); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | //$con = mysqli_connect('103.11.74.20','k7398289_elite','5uperman','k7398289_three'); |
4 | -$con = mysqli_connect('localhost','root','','koperasi'); |
|
4 | +$con = mysqli_connect('localhost', 'root', '', 'koperasi'); |
|
5 | 5 | if (!$con) { |
6 | - die('Could not connect: ' . mysqli_error($con)); |
|
6 | + die('Could not connect: '.mysqli_error($con)); |
|
7 | 7 | } |
8 | 8 | |
9 | -mysqli_select_db($con,"koperasi"); |
|
9 | +mysqli_select_db($con, "koperasi"); |
|
10 | 10 | |
11 | 11 | ?> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <? |
2 | -$useragent=$_SERVER['HTTP_USER_AGENT']; |
|
3 | -if(preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))) { |
|
2 | +$useragent = $_SERVER['HTTP_USER_AGENT']; |
|
3 | +if (preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr($useragent, 0, 4))) { |
|
4 | 4 | |
5 | 5 | $agent = 'mobile'; |
6 | 6 |
@@ -20,33 +20,33 @@ |
||
20 | 20 | global $char128asc,$char128charWidth; |
21 | 21 | $char128asc=' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; |
22 | 22 | $char128wid = array( |
23 | - '212222','222122','222221','121223','121322','131222','122213','122312','132212','221213', // 0-9 |
|
24 | - '221312','231212','112232','122132','122231','113222','123122','123221','223211','221132', // 10-19 |
|
25 | - '221231','213212','223112','312131','311222','321122','321221','312212','322112','322211', // 20-29 |
|
26 | - '212123','212321','232121','111323','131123','131321','112313','132113','132311','211313', // 30-39 |
|
27 | - '231113','231311','112133','112331','132131','113123','113321','133121','313121','211331', // 40-49 |
|
28 | - '231131','213113','213311','213131','311123','311321','331121','312113','312311','332111', // 50-59 |
|
29 | - '314111','221411','431111','111224','111422','121124','121421','141122','141221','112214', // 60-69 |
|
30 | - '112412','122114','122411','142112','142211','241211','221114','413111','241112','134111', // 70-79 |
|
31 | - '111242','121142','121241','114212','124112','124211','411212','421112','421211','212141', // 80-89 |
|
32 | - '214121','412121','111143','111341','131141','114113','114311','411113','411311','113141', // 90-99 |
|
33 | - '114131','311141','411131','211412','211214','211232','23311120' ); // 100-106 |
|
23 | + '212222','222122','222221','121223','121322','131222','122213','122312','132212','221213', // 0-9 |
|
24 | + '221312','231212','112232','122132','122231','113222','123122','123221','223211','221132', // 10-19 |
|
25 | + '221231','213212','223112','312131','311222','321122','321221','312212','322112','322211', // 20-29 |
|
26 | + '212123','212321','232121','111323','131123','131321','112313','132113','132311','211313', // 30-39 |
|
27 | + '231113','231311','112133','112331','132131','113123','113321','133121','313121','211331', // 40-49 |
|
28 | + '231131','213113','213311','213131','311123','311321','331121','312113','312311','332111', // 50-59 |
|
29 | + '314111','221411','431111','111224','111422','121124','121421','141122','141221','112214', // 60-69 |
|
30 | + '112412','122114','122411','142112','142211','241211','221114','413111','241112','134111', // 70-79 |
|
31 | + '111242','121142','121241','114212','124112','124211','411212','421112','421211','212141', // 80-89 |
|
32 | + '214121','412121','111143','111341','131141','114113','114311','411113','411311','113141', // 90-99 |
|
33 | + '114131','311141','411131','211412','211214','211232','23311120' ); // 100-106 |
|
34 | 34 | |
35 | 35 | ////Define Function |
36 | 36 | function bar128($text) { // Part 1, make list of widths |
37 | - global $char128asc,$char128wid; |
|
38 | - $w = $char128wid[$sum = 104]; // START symbol |
|
39 | - $onChar=1; |
|
40 | - for($x=0;$x<strlen($text);$x++) // GO THRU TEXT GET LETTERS |
|
37 | + global $char128asc,$char128wid; |
|
38 | + $w = $char128wid[$sum = 104]; // START symbol |
|
39 | + $onChar=1; |
|
40 | + for($x=0;$x<strlen($text);$x++) // GO THRU TEXT GET LETTERS |
|
41 | 41 | if (!( ($pos = strpos($char128asc,$text[$x])) === false )){ // SKIP NOT FOUND CHARS |
42 | - $w.= $char128wid[$pos]; |
|
43 | - $sum += $onChar++ * $pos; |
|
44 | - } |
|
45 | - $w.= $char128wid[ $sum % 103 ].$char128wid[106]; //Check Code, then END |
|
46 | - //Part 2, Write rows |
|
47 | - $html="<table cellpadding=0 cellspacing=0><tr>"; |
|
48 | - for($x=0;$x<strlen($w);$x+=2) // code 128 widths: black border, then white space |
|
49 | - $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x+1]}\"></div>"; |
|
50 | - return "$html</table>"; |
|
42 | + $w.= $char128wid[$pos]; |
|
43 | + $sum += $onChar++ * $pos; |
|
44 | + } |
|
45 | + $w.= $char128wid[ $sum % 103 ].$char128wid[106]; //Check Code, then END |
|
46 | + //Part 2, Write rows |
|
47 | + $html="<table cellpadding=0 cellspacing=0><tr>"; |
|
48 | + for($x=0;$x<strlen($w);$x+=2) // code 128 widths: black border, then white space |
|
49 | + $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x+1]}\"></div>"; |
|
50 | + return "$html</table>"; |
|
51 | 51 | } |
52 | 52 | ?> |
53 | 53 | \ No newline at end of file |
@@ -17,36 +17,36 @@ |
||
17 | 17 | </style> |
18 | 18 | |
19 | 19 | <?php |
20 | -global $char128asc,$char128charWidth; |
|
21 | -$char128asc=' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; |
|
20 | +global $char128asc, $char128charWidth; |
|
21 | +$char128asc = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; |
|
22 | 22 | $char128wid = array( |
23 | - '212222','222122','222221','121223','121322','131222','122213','122312','132212','221213', // 0-9 |
|
24 | - '221312','231212','112232','122132','122231','113222','123122','123221','223211','221132', // 10-19 |
|
25 | - '221231','213212','223112','312131','311222','321122','321221','312212','322112','322211', // 20-29 |
|
26 | - '212123','212321','232121','111323','131123','131321','112313','132113','132311','211313', // 30-39 |
|
27 | - '231113','231311','112133','112331','132131','113123','113321','133121','313121','211331', // 40-49 |
|
28 | - '231131','213113','213311','213131','311123','311321','331121','312113','312311','332111', // 50-59 |
|
29 | - '314111','221411','431111','111224','111422','121124','121421','141122','141221','112214', // 60-69 |
|
30 | - '112412','122114','122411','142112','142211','241211','221114','413111','241112','134111', // 70-79 |
|
31 | - '111242','121142','121241','114212','124112','124211','411212','421112','421211','212141', // 80-89 |
|
32 | - '214121','412121','111143','111341','131141','114113','114311','411113','411311','113141', // 90-99 |
|
33 | - '114131','311141','411131','211412','211214','211232','23311120' ); // 100-106 |
|
23 | + '212222', '222122', '222221', '121223', '121322', '131222', '122213', '122312', '132212', '221213', // 0-9 |
|
24 | + '221312', '231212', '112232', '122132', '122231', '113222', '123122', '123221', '223211', '221132', // 10-19 |
|
25 | + '221231', '213212', '223112', '312131', '311222', '321122', '321221', '312212', '322112', '322211', // 20-29 |
|
26 | + '212123', '212321', '232121', '111323', '131123', '131321', '112313', '132113', '132311', '211313', // 30-39 |
|
27 | + '231113', '231311', '112133', '112331', '132131', '113123', '113321', '133121', '313121', '211331', // 40-49 |
|
28 | + '231131', '213113', '213311', '213131', '311123', '311321', '331121', '312113', '312311', '332111', // 50-59 |
|
29 | + '314111', '221411', '431111', '111224', '111422', '121124', '121421', '141122', '141221', '112214', // 60-69 |
|
30 | + '112412', '122114', '122411', '142112', '142211', '241211', '221114', '413111', '241112', '134111', // 70-79 |
|
31 | + '111242', '121142', '121241', '114212', '124112', '124211', '411212', '421112', '421211', '212141', // 80-89 |
|
32 | + '214121', '412121', '111143', '111341', '131141', '114113', '114311', '411113', '411311', '113141', // 90-99 |
|
33 | + '114131', '311141', '411131', '211412', '211214', '211232', '23311120' ); // 100-106 |
|
34 | 34 | |
35 | 35 | ////Define Function |
36 | 36 | function bar128($text) { // Part 1, make list of widths |
37 | - global $char128asc,$char128wid; |
|
38 | - $w = $char128wid[$sum = 104]; // START symbol |
|
39 | - $onChar=1; |
|
40 | - for($x=0;$x<strlen($text);$x++) // GO THRU TEXT GET LETTERS |
|
41 | - if (!( ($pos = strpos($char128asc,$text[$x])) === false )){ // SKIP NOT FOUND CHARS |
|
42 | - $w.= $char128wid[$pos]; |
|
37 | + global $char128asc, $char128wid; |
|
38 | + $w = $char128wid[$sum = 104]; // START symbol |
|
39 | + $onChar = 1; |
|
40 | + for ($x = 0; $x<strlen($text); $x++) // GO THRU TEXT GET LETTERS |
|
41 | + if (!(($pos = strpos($char128asc, $text[$x]))===false)) { // SKIP NOT FOUND CHARS |
|
42 | + $w .= $char128wid[$pos]; |
|
43 | 43 | $sum += $onChar++ * $pos; |
44 | 44 | } |
45 | - $w.= $char128wid[ $sum % 103 ].$char128wid[106]; //Check Code, then END |
|
45 | + $w .= $char128wid[$sum % 103].$char128wid[106]; //Check Code, then END |
|
46 | 46 | //Part 2, Write rows |
47 | - $html="<table cellpadding=0 cellspacing=0><tr>"; |
|
48 | - for($x=0;$x<strlen($w);$x+=2) // code 128 widths: black border, then white space |
|
49 | - $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x+1]}\"></div>"; |
|
47 | + $html = "<table cellpadding=0 cellspacing=0><tr>"; |
|
48 | + for ($x = 0; $x<strlen($w); $x += 2) // code 128 widths: black border, then white space |
|
49 | + $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x + 1]}\"></div>"; |
|
50 | 50 | return "$html</table>"; |
51 | 51 | } |
52 | 52 | ?> |
53 | 53 | \ No newline at end of file |
@@ -37,16 +37,20 @@ |
||
37 | 37 | global $char128asc,$char128wid; |
38 | 38 | $w = $char128wid[$sum = 104]; // START symbol |
39 | 39 | $onChar=1; |
40 | - for($x=0;$x<strlen($text);$x++) // GO THRU TEXT GET LETTERS |
|
40 | + for($x=0;$x<strlen($text);$x++) { |
|
41 | + // GO THRU TEXT GET LETTERS |
|
41 | 42 | if (!( ($pos = strpos($char128asc,$text[$x])) === false )){ // SKIP NOT FOUND CHARS |
42 | 43 | $w.= $char128wid[$pos]; |
44 | + } |
|
43 | 45 | $sum += $onChar++ * $pos; |
44 | 46 | } |
45 | 47 | $w.= $char128wid[ $sum % 103 ].$char128wid[106]; //Check Code, then END |
46 | 48 | //Part 2, Write rows |
47 | 49 | $html="<table cellpadding=0 cellspacing=0><tr>"; |
48 | - for($x=0;$x<strlen($w);$x+=2) // code 128 widths: black border, then white space |
|
49 | - $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x+1]}\"></div>"; |
|
50 | + for($x=0;$x<strlen($w);$x+=2) { |
|
51 | + // code 128 widths: black border, then white space |
|
52 | + $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x+1]}\"></div>"; |
|
53 | + } |
|
50 | 54 | return "$html</table>"; |
51 | 55 | } |
52 | 56 | ?> |
53 | 57 | \ No newline at end of file |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | echo "<select name=$var>"; |
4 | 4 | echo "<option value=0 selected>$default</option>"; |
5 | 5 | for ($i=$awal; $i<=$akhir; $i++){ |
6 | - echo "<option value=$i>$i</option>"; |
|
6 | + echo "<option value=$i>$i</option>"; |
|
7 | 7 | } |
8 | 8 | echo "</select> "; |
9 | 9 | } |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | echo "<select name=$var class='tselect_tgl'>"; |
23 | 23 | for ($i=$awal; $i<=$akhir; $i++){ |
24 | 24 | if ($i==$terpilih) |
25 | - echo "<option value=$i selected>$i</option>"; |
|
25 | + echo "<option value=$i selected>$i</option>"; |
|
26 | 26 | else |
27 | - echo "<option value=$i>$i</option>"; |
|
27 | + echo "<option value=$i>$i</option>"; |
|
28 | 28 | } |
29 | 29 | echo "</select> "; |
30 | 30 | } |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | include "../config/library.php"; |
34 | 34 | echo "<select name=$var class='tselect_bln'>"; |
35 | 35 | for ($bln=$awal; $bln<=$akhir; $bln++){ |
36 | - if ($bln==$terpilih) |
|
37 | - echo "<option value=$bln selected>$nama_bln[$bln]</option>"; |
|
38 | - else |
|
36 | + if ($bln==$terpilih) |
|
37 | + echo "<option value=$bln selected>$nama_bln[$bln]</option>"; |
|
38 | + else |
|
39 | 39 | echo "<option value=$bln>$nama_bln[$bln]</option>"; |
40 | 40 | } |
41 | 41 | echo "</select> "; |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | echo "<select name=$var class='tselect_thn'>"; |
46 | 46 | for ($i=$awal; $i<=$akhir; $i++){ |
47 | 47 | if ($i==$terpilih) |
48 | - echo "<option value=$i selected>$i</option>"; |
|
48 | + echo "<option value=$i selected>$i</option>"; |
|
49 | 49 | else |
50 | - echo "<option value=$i>$i</option>"; |
|
50 | + echo "<option value=$i>$i</option>"; |
|
51 | 51 | } |
52 | 52 | echo "</select> "; |
53 | 53 | } |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php |
2 | -function combotgl($awal, $akhir, $var, $default){ |
|
2 | +function combotgl($awal, $akhir, $var, $default) { |
|
3 | 3 | echo "<select name=$var>"; |
4 | 4 | echo "<option value=0 selected>$default</option>"; |
5 | -for ($i=$awal; $i<=$akhir; $i++){ |
|
5 | +for ($i = $awal; $i<=$akhir; $i++) { |
|
6 | 6 | echo "<option value=$i>$i</option>"; |
7 | 7 | } |
8 | 8 | echo "</select> "; |
9 | 9 | } |
10 | 10 | |
11 | -function combobln($awal, $akhir, $var, $default){ |
|
11 | +function combobln($awal, $akhir, $var, $default) { |
|
12 | 12 | include "../config/library.php"; |
13 | 13 | echo "<select name=$var>"; |
14 | 14 | echo "<option value=0 selected>$default</option>"; |
15 | -for ($bln=$awal; $bln<=$akhir; $bln++){ |
|
15 | +for ($bln = $awal; $bln<=$akhir; $bln++) { |
|
16 | 16 | echo "<option value=$bln>$nama_bln[$bln]</option>"; |
17 | 17 | } |
18 | 18 | echo "</select> "; |
19 | 19 | } |
20 | 20 | |
21 | -function combotgl2($awal, $akhir, $var, $terpilih){ |
|
21 | +function combotgl2($awal, $akhir, $var, $terpilih) { |
|
22 | 22 | echo "<select name=$var class='tselect_tgl'>"; |
23 | -for ($i=$awal; $i<=$akhir; $i++){ |
|
23 | +for ($i = $awal; $i<=$akhir; $i++) { |
|
24 | 24 | if ($i==$terpilih) |
25 | 25 | echo "<option value=$i selected>$i</option>"; |
26 | 26 | else |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | echo "</select> "; |
30 | 30 | } |
31 | 31 | |
32 | -function combobln2($awal, $akhir, $var, $terpilih){ |
|
32 | +function combobln2($awal, $akhir, $var, $terpilih) { |
|
33 | 33 | include "../config/library.php"; |
34 | 34 | echo "<select name=$var class='tselect_bln'>"; |
35 | -for ($bln=$awal; $bln<=$akhir; $bln++){ |
|
35 | +for ($bln = $awal; $bln<=$akhir; $bln++) { |
|
36 | 36 | if ($bln==$terpilih) |
37 | 37 | echo "<option value=$bln selected>$nama_bln[$bln]</option>"; |
38 | 38 | else |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | echo "</select> "; |
42 | 42 | } |
43 | 43 | |
44 | -function combothn($awal, $akhir, $var, $terpilih){ |
|
44 | +function combothn($awal, $akhir, $var, $terpilih) { |
|
45 | 45 | echo "<select name=$var class='tselect_thn'>"; |
46 | -for ($i=$awal; $i<=$akhir; $i++){ |
|
46 | +for ($i = $awal; $i<=$akhir; $i++) { |
|
47 | 47 | if ($i==$terpilih) |
48 | 48 | echo "<option value=$i selected>$i</option>"; |
49 | 49 | else |
@@ -21,10 +21,11 @@ discard block |
||
21 | 21 | function combotgl2($awal, $akhir, $var, $terpilih){ |
22 | 22 | echo "<select name=$var class='tselect_tgl'>"; |
23 | 23 | for ($i=$awal; $i<=$akhir; $i++){ |
24 | -if ($i==$terpilih) |
|
25 | - echo "<option value=$i selected>$i</option>"; |
|
26 | -else |
|
27 | - echo "<option value=$i>$i</option>"; |
|
24 | +if ($i==$terpilih) { |
|
25 | + echo "<option value=$i selected>$i</option>"; |
|
26 | +} else { |
|
27 | + echo "<option value=$i>$i</option>"; |
|
28 | +} |
|
28 | 29 | } |
29 | 30 | echo "</select> "; |
30 | 31 | } |
@@ -33,21 +34,23 @@ discard block |
||
33 | 34 | include "../config/library.php"; |
34 | 35 | echo "<select name=$var class='tselect_bln'>"; |
35 | 36 | for ($bln=$awal; $bln<=$akhir; $bln++){ |
36 | - if ($bln==$terpilih) |
|
37 | - echo "<option value=$bln selected>$nama_bln[$bln]</option>"; |
|
38 | - else |
|
39 | - echo "<option value=$bln>$nama_bln[$bln]</option>"; |
|
40 | -} |
|
37 | + if ($bln==$terpilih) { |
|
38 | + echo "<option value=$bln selected>$nama_bln[$bln]</option>"; |
|
39 | + } else { |
|
40 | + echo "<option value=$bln>$nama_bln[$bln]</option>"; |
|
41 | + } |
|
42 | + } |
|
41 | 43 | echo "</select> "; |
42 | 44 | } |
43 | 45 | |
44 | 46 | function combothn($awal, $akhir, $var, $terpilih){ |
45 | 47 | echo "<select name=$var class='tselect_thn'>"; |
46 | 48 | for ($i=$awal; $i<=$akhir; $i++){ |
47 | -if ($i==$terpilih) |
|
48 | - echo "<option value=$i selected>$i</option>"; |
|
49 | -else |
|
50 | - echo "<option value=$i>$i</option>"; |
|
49 | +if ($i==$terpilih) { |
|
50 | + echo "<option value=$i selected>$i</option>"; |
|
51 | +} else { |
|
52 | + echo "<option value=$i>$i</option>"; |
|
53 | +} |
|
51 | 54 | } |
52 | 55 | echo "</select> "; |
53 | 56 | } |