Ini juga adalah salah satu karya Tunick Service, yaitu file handling dalam project ini Tunick Service diminta membuat web yang bisa menampilkan Mp3, Mp4, File zip, dan rar, jadi apabila ada file dengan format2 tersebut dalam folder, maka akan tampil pada halaman web sesuai dengan menunya masing-masing, dengan adanya project ini Tunick Service mulai mengerjakan project ini, Tunick Service hanya memerlukan waktu kurang dari 2 jam untuk mengerjakan project ini, project ini hampir sama dengan (Web Image Hosting Khusus Untuk Menyimpan Gambar di News.putunik.com) yang sudah Tunick Service Posting Sebelum nya.
Web nya dipasag oleh client di server local, namun kadang2 web nya juga bisa di access secara pulic berkut lini nya : http://110.139.148.152:8182/file
langsung Saja Berikut Ini Source Code yang Dipergunakan:
Pada Bgian Home (index.php)
<?php
require_once(‘functions.php’);
$title = $_GET[file];
if(!$title)
$title = “Welcome and Download”;
?>
<html>
<head>
<title><?php echo $title ?></title>
<link href=”style.css” type=”text/css” rel=”stylesheet”/>
</head>
<body><div id=”all”>
<div>
<img src=”logo2.png” alt=”” width=”445px” ><a href=”http://www.putunik.com”><img src=”http://www.putunik.com/iklan.png” alt=”” width=”445px” /></a><br /><br />
<?php echo $title ?></div>
<div><a href=”index.php”>Home</a> | <a href=”index.php?file=Download-Mp3″>Mp3</a> | <a href=”index.php?file=Download-File”>File</a> | <a href=”index.php?file=Download-Video”>Video</a></div>
<div>
<a href=”http://www.putunik.com”><img src=”logo.png” alt=”” width=”350px” align=”center” /></a>
» Web Design<br />
» Web Development<br />
» Web Programming<br />
<br />
<center style=”font-size:24″><b>Contact US</b></center>
» Putu Nick<br />
» 0819 1616 2221 / 085 333 767671<br />
» info@putunik.com<br />
» www.putunik.com<br />
<center><a href=”ymsgr:sendIM?tunick.kutuh”><img src=”http://opi.yahoo.com/yahooonline/u=tunick.kutuh/m=g/t=14/l=us/opi.jpg” width=”” height=”” /></a></center>
</div>
<div>
<?php
if($title == ‘Download-Mp3’)
mp3();
if($title == ‘Download-Video’)
video();
if($title == ‘Download-File’)
files();
?>
</div>
<div id=”clc”></div>
<div>Design By <a href=”http://www.putunik.com”>Tunick Service</a></div>
</div></body>
</html>
Pada Bagian Function (function.php)
<?php
function mp3()
{
chdir(“mp3”);
$cwd = getcwd(); // mengambil current direktory
$dirhandle = opendir($cwd);
while(FALSE !== ($file = readdir($dirhandle)))
{ if(is_file($file)){
if(is_file($file) && substr($file, -4) == “.mp3”){
$fsize = ceil(filesize($file)/1024);
echo “» <a href=\”mp3/$file\”>$file</a> | $fsize kb”;
echo”<br>”;
} }
}
}function files()
{
chdir(“file”);
$cwd = getcwd(); // mengambil current direktory
$dirhandle = opendir($cwd);
while(FALSE !== ($file = readdir($dirhandle)))
{ if(is_file($file)){
if(is_file($file) && substr($file, -4) == “.zip” || substr($file, -4) == “.rar”){
$fsize = ceil(filesize($file)/1024);
echo “» <a href=\”file/$file\”>$file</a> | $fsize kb”;
echo”<br>”;
} }
}
}function video()
{
chdir(“mp4”);
$cwd = getcwd(); // mengambil current direktory
$dirhandle = opendir($cwd);
while(FALSE !== ($file = readdir($dirhandle)))
{ if(is_file($file)){
if(is_file($file) && substr($file, -4) == “.mp4”){
$fsize = ceil(filesize($file)/1024/1024);
echo “» <a href=\”mp4/$file\”>$file</a> | $fsize mb”;
echo”<br>”;
} }
}
}
Bagian Stile CSS (style.css)
body {
background:#c0dcc0;
margin:0;
}
#all {
width:900px;
margin:auto;
background:#ffffff;
padding:10;
}
#all .header {
height:160;
color:#ff0000;
font-size:36px;
text-align:center;
font-weight:bold;
}
#all .menu {
height:30;
border-bottom: dashed 1px #800000;
font-size:18px;
margin-bottom:20px;
}
#all .menu a{
text-decoration:none;
color:#008000;
font-weight:bold;
}
#all .menu a:hover {
text-decoration:underline;
color:#800000;
}
#all .file {
min-height:600px;
float:right;
width:540px;
}
#all .file a{
text-decoration:none;
color:#008000;
}
#all .file a:hover {
text-decoration:underline;
color:#800000;
}
#all .sidebar {
width:320px;
padding-right:20px;
border-right:1px dashed #a0a0a4;
float:left;
margin-right:15px;
color:#800000;
font-size:18px;
font-family:Calibry;
}
#clc {
clear:both; line-height:0; font-size:0; width:100%
}
#all .footer {
text-align:center;
color:#804040;
font-size:10;
}
#all .footer a{
text-decoration:none;
color:#804040;
}
Demikian Artikel Tunick Service Kali ini, kuti Terus Perkembangan Dari Tunick Service.