Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / var / www / html / sman1baleendah_sch_id-1111111111111 / functions / | server ip : 172.67.156.115 your ip : 172.69.214.34 H O M E |
Filename | /var/www/html/sman1baleendah_sch_id-1111111111111/functions/fungsi_utama.php |
Size | 3.9 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 06-May-2025 08:13 |
Last modified | 05-May-2025 16:21 |
Last accessed | 08-Jun-2025 07:33 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
if(!defined("CMSBalitbang")) {
die("<h1>Permission Denied</h1>You don't have permission to access the this page.");
}
include "voting_conf.php";
include "../lib/config.php";
/**************************************************** Voting ************************************/
function lih_voting() {
include "koneksi.php";
$kd = $_GET['kd'];
$sql="select ifnull(count(ip),0),jawaban,pertanyaan from t_voting_pole p,t_voting_jawab j,t_voting_tanya t
where t.id_tanya='".mysql_real_escape_string($kd)."' and p.id_jawab=j.id_jawab and j.id_tanya=t.id_tanya group by jawaban,pertanyaan order by pertanyaan, id desc";
if (!$result=mysql_query($sql)) die ("gagal database");
$i=0;
while($myrow=mysql_fetch_array($result)) {
$question[$i]=$myrow[2];
$anwser[$i]=$myrow[1];
$count[$i]=$myrow[0];
$i++;
}
for($n=0;$n<$i;$n++) {
if (($question[$n]==$question[$n-1])&&($n!=0)) {
$total[$g]+=$count[$n];
}
else {
$g++;
$total[$g]+=$count[$n];
}
}
$g=0;
$lih_voting .= "<center>
<table width=95% border=0 cellspacing=0 >
<tr> <td align=Center>
<table border=0 cellspacing=0 width=100%>";
for($n=0;$n<$i;$n++) {
if (($question[$n]==$question[$n-1])&&($n!=0)) {
if ($total[$g]!=0) {
$hold=number_format(($count[$n] / $total[$g])*100,0);
$col=get_color($hold);
$lih_voting .= "<tr><td align=left width=25%><FONT class='ver10'>$anwser[$n]($count[$n]) </font></td>
<td align=left colspan=2 width=100%>
<TABLE BORDER=0 align=left CELLSPACING=0 CELLPADDING=0 width=$hold%>
<tr><td align=right bgcolor='$col' width=$hold%><FONT class='ver10'>$hold%</font> <td></tr>
</table>
</td> </tr>";
}
else {
$lih_voting .= "<tr><td align=center><FONT class='ver10'>$anwser[$n]($count[$n])</font></td>
<td align=center></td>
<td align=center><FONT class='ver10'>No results</font></td></tr>";
}
}
else {
$lih_voting .= "<TR><TD colspan=3><br></TD></TR>";
$g++;
if ($total[$g]!=0) {
$hold=number_format(($count[$n] / $total[$g])*100,0);
$col=get_color($hold);
$lih_voting .= "<tr><td colspan=3><FONT class='ver10'><b>$question[$n]</b></font></td>
</tr><tr><td align=left><FONT class='ver10'>$anwser[$n]($count[$n])</font></td>
<td align=left colspan=2 width=100%>
<TABLE BORDER=0 align=left CELLSPACING=0 CELLPADDING=0 width=$hold%>
<tr><td align=right bgcolor=$col width=$hold%><FONT class='ver10'>$hold%</font> <td></tr>
</table>
</td> </tr>";
}
else {
$lih_voting .= "<tr><td align=center>
<FONT class='ver10'>$anwser[$n]</font></td>
<td align=center><FONT class='ver10'>$count[$n]</td><td align=center><FONT class='ver10'>No results</font></td></tr>";
}
}
}
$lih_voting .= "</table></td></tr></table></center><br><br>";
return $lih_voting;
}
function tam_vot() {
$guest = $_POST['guest'];
$am_id = $_POST['am_id'];
$tgl = date("dmy");
$sql="select * from t_voting_pole p,t_voting_jawab j where j.id_jawab=p.id_jawab and j.id_tanya='".mysql_real_escape_string($am_id)."' and ip='".$_SERVER['REMOTE_ADDR']."' and tanggal='$tgl' ";
$result=mysql_query($sql);
$myrow=mysql_num_rows($result);
if (isset($guest)) {
if ($myrow > 0 ) {
$tam_vot .="<br><br><center>Mohon Maaf, Anda telah melakukan Jajak Pendapat sebelumnya.<br><br>
| <a href='index.php?id=lih_voting&kd=$am_id' style='color:000000;text-decoration:underline'>lihat Hasil</a> |</center></font><br><br><br>";
}
else {
$sql="insert into t_voting_pole (id_jawab,ip,tanggal) values ('".mysql_real_escape_string($guest)."','".$_SERVER['REMOTE_ADDR']."','$tgl')";
$result=mysql_query($sql);
$tam_vot .="<br><br><center>Terima Kasih, Anda telah menggunakan fasilitas Jajak Pendapat.<br><br>
| <a href='index.php?id=lih_voting&kd=$am_id' style='color:000000;text-decoration:underline'>lihat Hasil</a> |</center></font><br><br><br>";
}
}
return $tam_vot;
}
?>
if(!defined("CMSBalitbang")) {
die("<h1>Permission Denied</h1>You don't have permission to access the this page.");
}
include "voting_conf.php";
include "../lib/config.php";
/**************************************************** Voting ************************************/
function lih_voting() {
include "koneksi.php";
$kd = $_GET['kd'];
$sql="select ifnull(count(ip),0),jawaban,pertanyaan from t_voting_pole p,t_voting_jawab j,t_voting_tanya t
where t.id_tanya='".mysql_real_escape_string($kd)."' and p.id_jawab=j.id_jawab and j.id_tanya=t.id_tanya group by jawaban,pertanyaan order by pertanyaan, id desc";
if (!$result=mysql_query($sql)) die ("gagal database");
$i=0;
while($myrow=mysql_fetch_array($result)) {
$question[$i]=$myrow[2];
$anwser[$i]=$myrow[1];
$count[$i]=$myrow[0];
$i++;
}
for($n=0;$n<$i;$n++) {
if (($question[$n]==$question[$n-1])&&($n!=0)) {
$total[$g]+=$count[$n];
}
else {
$g++;
$total[$g]+=$count[$n];
}
}
$g=0;
$lih_voting .= "<center>
<table width=95% border=0 cellspacing=0 >
<tr> <td align=Center>
<table border=0 cellspacing=0 width=100%>";
for($n=0;$n<$i;$n++) {
if (($question[$n]==$question[$n-1])&&($n!=0)) {
if ($total[$g]!=0) {
$hold=number_format(($count[$n] / $total[$g])*100,0);
$col=get_color($hold);
$lih_voting .= "<tr><td align=left width=25%><FONT class='ver10'>$anwser[$n]($count[$n]) </font></td>
<td align=left colspan=2 width=100%>
<TABLE BORDER=0 align=left CELLSPACING=0 CELLPADDING=0 width=$hold%>
<tr><td align=right bgcolor='$col' width=$hold%><FONT class='ver10'>$hold%</font> <td></tr>
</table>
</td> </tr>";
}
else {
$lih_voting .= "<tr><td align=center><FONT class='ver10'>$anwser[$n]($count[$n])</font></td>
<td align=center></td>
<td align=center><FONT class='ver10'>No results</font></td></tr>";
}
}
else {
$lih_voting .= "<TR><TD colspan=3><br></TD></TR>";
$g++;
if ($total[$g]!=0) {
$hold=number_format(($count[$n] / $total[$g])*100,0);
$col=get_color($hold);
$lih_voting .= "<tr><td colspan=3><FONT class='ver10'><b>$question[$n]</b></font></td>
</tr><tr><td align=left><FONT class='ver10'>$anwser[$n]($count[$n])</font></td>
<td align=left colspan=2 width=100%>
<TABLE BORDER=0 align=left CELLSPACING=0 CELLPADDING=0 width=$hold%>
<tr><td align=right bgcolor=$col width=$hold%><FONT class='ver10'>$hold%</font> <td></tr>
</table>
</td> </tr>";
}
else {
$lih_voting .= "<tr><td align=center>
<FONT class='ver10'>$anwser[$n]</font></td>
<td align=center><FONT class='ver10'>$count[$n]</td><td align=center><FONT class='ver10'>No results</font></td></tr>";
}
}
}
$lih_voting .= "</table></td></tr></table></center><br><br>";
return $lih_voting;
}
function tam_vot() {
$guest = $_POST['guest'];
$am_id = $_POST['am_id'];
$tgl = date("dmy");
$sql="select * from t_voting_pole p,t_voting_jawab j where j.id_jawab=p.id_jawab and j.id_tanya='".mysql_real_escape_string($am_id)."' and ip='".$_SERVER['REMOTE_ADDR']."' and tanggal='$tgl' ";
$result=mysql_query($sql);
$myrow=mysql_num_rows($result);
if (isset($guest)) {
if ($myrow > 0 ) {
$tam_vot .="<br><br><center>Mohon Maaf, Anda telah melakukan Jajak Pendapat sebelumnya.<br><br>
| <a href='index.php?id=lih_voting&kd=$am_id' style='color:000000;text-decoration:underline'>lihat Hasil</a> |</center></font><br><br><br>";
}
else {
$sql="insert into t_voting_pole (id_jawab,ip,tanggal) values ('".mysql_real_escape_string($guest)."','".$_SERVER['REMOTE_ADDR']."','$tgl')";
$result=mysql_query($sql);
$tam_vot .="<br><br><center>Terima Kasih, Anda telah menggunakan fasilitas Jajak Pendapat.<br><br>
| <a href='index.php?id=lih_voting&kd=$am_id' style='color:000000;text-decoration:underline'>lihat Hasil</a> |</center></font><br><br><br>";
}
}
return $tam_vot;
}
?>