• Tidak ada hasil yang ditemukan

BAB IV IMPLEMENTASI

4.4 Implementasi Modul Program

4.4.3 Modul Program untuk Pengunjung

1. Modul Pengunjung

Modul ini menampilkan keterangan bahwa apakah anda setuju website anda diikut sertakan dalam perhitungan web_counter ini dan apakah ip_number dan nama computer sudah benar. Skrip dari modul tersebut adalah sebagai berikut: <html>

<style> .tabelz1 {

BORDER-RIGHT: black 1px outset; BORDER-TOP: white 1px outset; BACKGROUND: #0099CC; BORDER-LEFT: white 1px outset; BORDER-BOTTOM: black 1px outset

}

.tabelz2 {

BORDER-RIGHT: black 1px outset; BORDER-TOP: white 1px outset; BACKGROUND: #ffffff; BORDER-LEFT: white 1px outset; BORDER-BOTTOM: black 1px outset

}

</STYLE>

<div align="center"><img src="jarot.gif" width="750" height="150"></div><br><br><br><br> <? function GetVar($name,$default) { global $HTTP_SERVER_VARS; $ret = ""; if(@$_SERVER["$name"]) { $ret = $_SERVER["$name"]; } elseif(@$HTTP_SERVER_VARS["$name"]){ $ret = $HTTP_SERVER_VARS["$name"]; } elseif(@$_GET["$name"]){ $ret = $_GET["$name"]; } elseif(@$_POST["$name"]){ $ret = $_POST["$name"]; } else { $ret = $default; }

//Clean up for security!

return trim(htmlspecialchars(stripslashes($ret))); }//eob GetVar $remote = ""; if(!$remote = GetVar("HTTP_X_FORWARDED_FOR",false)) { $remote = gethostbyaddr(GetVar("REMOTE_ADDR", "127.0.0.1")); }

if(!$remote_host = GetVar("REMOTE_HOST", false)) {

$remote_host = GetVar("REMOTE_ADDR", "-"); }

//==================================buat tampilan pendaftaran

/*echo("<table border=0 cellpadding=0 cellspacing=0 style='position: absolute; left:15; top:10' width=100% >");

echo(" <tr>");

echo(" <td width=100% >");

echo("<img border='0' src='jarotcom.bmp' width='750' height='72'>"); echo(" </td>");

echo(" </tr>");

echo("</table>");*/

echo ("<form method='POST' action='simpan_tambah_data.php?remote=$remote &amp remote_host=$remote_host'>");

//echo ("<form method='POST' action='$php_self'>");

echo("<table border=1 cellpadding=0 cellspacing=0 align=center width=75% class=tabelz2>");

//baris ke 1

echo("<tr>");

echo("<td width=100% align=center bgcolor=#0099CC colspan=2>"); echo("<font color=#FFFFFF size=4px face=Arial, Helvetica, sans-serif><b>IDENTITAS ANDA</b><br></td>");

echo("</tr>"); //baris ke 2 echo("<tr>"); // cek nama server

echo("<td width=20%>&nbsp;&nbsp;<b>Nama Server</b></td>"); echo("<td>");

echo $remote ;echo("</td>"); echo("</tr>");

echo("<tr>"); //baris ke 3 //cek nomor ip

echo("<td width=20%>&nbsp;&nbsp;<b>Nomor IP</b></td>"); echo("<td>");

echo $remote_host;echo("</td>"); echo("</tr>");

//baris ke 4 echo("<tr>");

echo("<td width=80% colspan=2>");

echo("Program ini hanya berfungsi untuk menghitung jumlah pengunjung yang mengakses Web Anda,<br>

Syarat : Web anda harus berjalan di Protocol PHP <br> apabila anda berminat dan setuju maka anda <b><font color=ff0000>diharuskan</font></b>

untuk mendownload Script Program yang berfungsi untuk menghubungkan Server anda dengan server

counter dan menambahkan perintah <b><font color=ff0000>include (pengunjung.php)</b></font> pada website anda yang akan dihitung counter pengunjungnya

<a class=link1 href='lihat_anggota.php'><b>Lihat Data anggota </b></a>

</td>"); echo("</tr>"); echo("<tr>");

echo("<td align=center colspan=2>");

echo("<br><input type=submit value=Setuju name=submit>"); echo("</td>"); echo("</tr>"); echo(" </form>"); echo("</table>"); if ($status_daftar=="0") {

echo("<table border=0 cellpadding=0 cellspacing=0 style='position: absolute; left:134; top:480' width=75% class=tabelz2>");

echo("<tr>");

echo("<td width=100% align=center colspan=2>"); echo("<b><font color=ff0000> SELAMAT WEB ANDA SUDAH TERDAFTAR DI COUNTER KAMI</b></td>");

echo("</tr>");

echo("<td width=100% align=center colspan=2>");

echo("<a href='download.php?namafile=counter.zip'><b>Download</b> </td>"); echo("</tr>"); echo("</table>"); } if ($status_daftar=="1") {

echo("<table border=0 cellpadding=0 cellspacing=0 style='position: absolute; left:134; top:480' width=75% class=tabelz2>");

echo("<tr>");

echo("<td width=100% align=center colspan=2>"); echo("<b><font color=ff0000> DATA WEB ANDA SUDAH TERDAFTAR DI COUNTER KAMI</b></td>");

echo("</tr>"); echo("</table>"); } echo("</body>"); ?> </html>

2. Modul Lihat Anggota (lihat_anggota.php)

Modul ini digunakan untuk melihat daftar anggota yang sudah ikut dalm web counter ini.Skrip dari modul tersebut adalah sebagai berikut:

<html> <head>

<base target="_self">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<style type="text/css"> <!--

A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} -->

</style>

<style type="text/css"> A:link {color: white;} A:visited {color: darkblue;} A:hover {color: yellow;} </style>

</head> <style> .link1:hover {

FONT-SIZE: 12px; COLOR: yellow; FONT-FAMILY: Verdana,Arial; TEXT-DECORATION: none }

FONT-SIZE: 12px; COLOR: white; FONT-FAMILY: Verdana,Arial; TEXT-DECORATION: none }

.tabelz1 {

BORDER-RIGHT: black 1px outset; BORDER-TOP: white 1px outset; BACKGROUND: #0099CC; BORDER-LEFT: white 1px outset; BORDER-BOTTOM: black 1px outset

}

.tabelz2 {

BORDER-RIGHT: black 1px outset; BORDER-TOP: white 1px outset; BACKGROUND: #FF0000; BORDER-LEFT: white 1px outset; BORDER-BOTTOM: black 1px outset

} </STYLE> <? if ($hal==""){$hal="1";} $urut="0"; include("koneksi.php"); mysql_select_db($db,$link); $batas = ($hal - 1) * 10;

$strSQL1 = "SELECT * FROM tabel_hitung limit $batas,10"; $strSQL2 = "SELECT * FROM tabel_hitung ";

$qry = @mysql_query($strSQL1,$link) or die("query-1 salah");

$tot = @mysql_query($strSQL2,$link) or die ("Query-2 salah");

$jml = mysql_num_rows($tot); $kel = $jml/10; if ($kel==floor($jml/10)){ $page = $kel; } else { $page = floor($jml/10)+1; } $pct = 100/($page+9); $x=$batas+1; ?>

<? // <body background="latar.bmp" align="center"> ?>

<? /*

echo("<table border=0 cellpadding=0 cellspacing=0 style='position: absolute; center:40; top:10' width=75% >");

echo(" <tr>");

echo(" <td width=100% >");

echo("<center><img border='0' src='jarotcom.bmp' width='800' height='72'>"); echo(" </td>");

echo(" </tr>"); echo("</table>");

echo("<table border=1 cellpadding=0 cellspacing=0 style='position: absolute; left:160; top:100' width=75% class=tabelz2>");

echo(" <tr>");

echo(" <td width=100% >");

echo("<font size=6px><font color=#FFFFFF><b><center>INFORMASI JUMLAH PENGUNJUNG</font><br>");

echo(" </tr>"); echo("</table><br>"); */

?>

<body marginheight="0">

<div align="center"> <img src="jarot.gif" width="800" height="120"> <body bgcolor="#FFFFFF">

<table width="77%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" class=tabelz1>

<tr bgcolor="#003399">

<td colspan="6" align="center"> <table width="100%" border="0"> <tr>

<td bgcolor="#003399"><div align="center"><strong><font color="#CCCCCC" size="5" face="Arial, Helvetica, sans-serif">INFORMASI

JUMLAH PENGUNJUNG</font></strong></div></td> </tr>

<tr>

<td bgcolor="#003399"><div align="center"><b> <font color="#CCCCCC" size="4px" face="Arial, Helvetica, sans-serif">DATA

JUMLAH PENGUNJUNG</font></b></div></td> </tr>

</table></td> </tr>

<tr>

<td width="11%" > <p align="center"><b> <font size="2" face="Arial, Helvetica, sans-serif">No.Urut</font></b></td>

<td width="36%" > <p align="center"><b> <font size="2" face="Arial, Helvetica, sans-serif">NAMA WEB</font></b></td>

<td width="18%" > <p align="center"><font size="2"><b> <font face="Arial, Helvetica, sans-serif">IP

NUMBER</font></b></font></td>

<td width="13%" > <p align="center"><b> <font size="2" face="Arial, Helvetica, sans-serif">JUMLAH</font></b></td> <? //===========================baca tabel_hitung================================ while($row=mysql_fetch_array($qry)) { ?> <tr>

<td align="right" bgcolor="#FFFFCC"> <b> <font size="2px"> &nbsp; <? echo $x ; ?>. &nbsp; &nbsp; </font></b> </td>

<td align="left" bgcolor="#FFFFCC"> <b> <font size="2px"> &nbsp;&nbsp; <? echo strtoupper($row[nama_web]) ; ?> </font></b> </td>

<td align="left" bgcolor="#FFFFCC"> <b> <font size="2px"> &nbsp;&nbsp; <? echo $row[ip_web] ; ?> </font></b> </td>

<td align="center" bgcolor="#FFFFCC"> <b> <font size="2px"> &nbsp;&nbsp; <? echo $row[jumlah] ; ?> </font></b> </td>

<?

$x++; }

//===========================baca tabel_hitung================================

//===========================Tampilkan 10 nomor per halaman======================

echo("</tr>"); echo("<tr>");

echo("<td align='center' colspan=6 width=100%>");

$lebar=$pct*1; $prev=$hal-1; $next=$hal+1;

echo("<table>"); echo("<tr>");

echo "<TD WIDTH=$lebar"."%>"; if ($hal!=1) {

echo "<A HREF='info_web.php?hal=$prev'> Prev </A>"; } else { echo "Prev"; } echo "</TD>"; for ($i=1;$i<=$page;$i++) { if ($i==$hal) { echo "<TD WIDTH=$pct"."%>"; echo "$i"; echo "</TD>"; } else { echo "<TD WIDTH=$pct"."%>";

echo "<A HREF='info_web.php?hal=$i'> $i </A>"; echo "</TD>";

} }

echo "<TD WIDTH=$lebar"."%>"; if ($hal!=$page) {

echo "<A HREF='info_web.php?hal=$next'> Next </A>"; } else { echo "Next"; echo "</td>"; } ?> </div> </body> </html>

3. Modul download (download.php)

Modul ini digunakan untuk download potongan program yang diperlukan dalam menjalankan perhitungan ini.Skrip dari modul tersebut adalah sebagai berikut:

<?

$total="C:/apache/htdocs/".$namafile; Header("Content-Type:application/zip"); Header("Content-Length:".filesize($total));

Header("Content-Disposition: attachment; filename=$namafile"); readfile($namafile);

Dokumen terkait