Input dari notepad
Download Source Code [Google]
Source Code :
<html>
<body>
<form action="index.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<h3>Program Association Ruler<br></h3>
<font size = "2 pt">
Upload File :<br>
<input type="file" name="fupload" />
<input type="submit" name="upload" value="Upload" /><br><br>
Record Penjualan : <br>
<textarea name="inputdata" rows="5" cols="30">
<?php
$file_name = $_FILES['fupload']['name'];
$file_type = $_FILES['fupload']['type'];
if(strlen($file_name)<>0) {
$file = fopen($file_name, "r");
$in1 = str_replace("\n","", file_get_contents($file_name));
echo $in1;
fclose($file);}
$inputdata = $_POST['inputdata'];
echo $inputdata;
?>
</textarea><br>
Masukan Nilai K <input type="text" size="2" name="NilaiK"> <br><br>
<input type="submit" value="Proses"><br><br>
<?php
$k = $_POST['NilaiK'];
$rata = str_replace(",","\n",$inputdata);
$rata2 = str_replace("\r","",$rata);
$rata3 = str_replace(", ",",",$rata2);
$rata4 = explode("\n",$rata3);
$judulkoma = (array_unique($rata4));
sort($judulkoma);
$jmlkolom = count ($judulkoma);
$jmlkolomarr = $jmlkolom - 1;
$input = str_replace("\r","",$inputdata);
$pisahenter = explode("\n",$input);
$jmlbaris = count ($pisahenter);
$jmlbarisarr = $jmlbaris - 1;?>
<table border = "1" width = "30%" height="80px"><tr><td></td>
<?php
for ($aa=0; $aa<=$jmlkolomarr; $aa++){
echo"<td>$judulkoma[$aa]</td>";}
echo "</tr>";
for ($a=0; $a<=$jmlbarisarr; $a++){
echo "<tr><td>",$a+1,"</td>";
for ($b=0; $b<=$jmlkolomarr; $b++){
$pisahkoma = explode(",",$pisahenter[$a]);
$jmldata = count ($pisahkoma);
$jmldataarr = $jmldata - 1;
$selb = array_search($judulkoma[$b], $pisahkoma);
if (strlen($selb)<>0){
echo"<td>1</td>";}
else{
echo"<td>0</td>";}
} echo "</tr>";
}
?>
</table>
<?php
if ($jmlkolom >= 1){
echo "<br> <u>F1</u><br><br>";}
for ($a=0; $a<=$jmlkolomarr; $a++){
$F1 = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$pisahkoma = explode(",",$pisahenter[$b]);
$jmldata = count ($pisahkoma);
$jmldataarr = $jmldata - 1;
$sela = array_search($judulkoma[$a], $pisahkoma);
if (strlen($sela)<> 0){
$F1++;}
}echo $judulkoma[$a]," = ",$F1,"<br>";
}
if ($jmlkolom >= 2){
echo "<br> <u>F2</u><br><br>";}
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
$F2 = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldataarr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0){
$F2++;}
}
if ($c > $a && $F2 >= $k){
echo $judulkoma[$a],",",$judulkoma[$c]," = ",$F2,"<br>";
}}
}
if ($jmlkolom >= 3){
echo "<br> <u>F3</u><br><br>";}
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
for ($d=0; $d<=$jmlkolomarr; $d++){
$F3 = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldataarr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
$dpisahkoma = explode(",",$pisahenter[$b]);
$djmldata = count ($dpisahkoma);
$djmldataarr = $djmldata - 1;
$seld = array_search($judulkoma[$d], $dpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0 && strlen($seld)<>0){
$F3++;}
}
if ($c > $a && $d > $c && $F3 >= $k){
echo $judulkoma[$a],",",$judulkoma[$c],",",$judulkoma[$d],"= ",$F3,"<br>";
}}
}
}
?>
<br><br><table border = "1"><tr><td>Statement</td><td>Support</td><td>Confidence</td></tr>
<?php
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
$F2 = 0;
$F1a = 0;
$F1b = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldataarr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0){
$F2++;}
if (strlen($sela)<>0){
$F1a++;}
if (strlen($selc)<>0){
$F1b++;}
}
if ($c > $a && $F2 >= $k){
echo "<tr><td>If buy $judulkoma[$a] then buy $judulkoma[$c] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F2/$F1a*100,"%</td></tr>";}
if ($c > $a && $F2 >= $k){
echo "<tr><td>If buy $judulkoma[$c] then buy $judulkoma[$a] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F2/$F1b*100,"%</td></tr>";}
}
}
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
for ($d=0; $d<=$jmlkolomarr; $d++){
$F3 = 0;
$F2a = 0;
$F2b = 0;
$F2c = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldata1arr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
$dpisahkoma = explode(",",$pisahenter[$b]);
$djmldata = count ($dpisahkoma);
$djmldataarr = $djmldata - 1;
$seld = array_search($judulkoma[$d], $dpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0 && strlen($seld)<>0){
$F3++;}
if (strlen($sela)<>0 && strlen($selc)<>0){
$F2a++;}
if (strlen($sela)<>0 && strlen($seld)<>0){
$F2b++;}
if (strlen($selc)<>0 && strlen($seld)<>0){
$F2c++;}
}
if ($c > $a && $d > $c && $F3 >= $k){
echo "<tr><td>If buy $judulkoma[$a] and buy $judulkoma[$c] then buy $judulkoma[$d] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F3/$F2a*100,"%</td></tr>";}
if ($c > $a && $d > $c && $F3 >= $k){
echo "<tr><td>If buy $judulkoma[$a] and buy $judulkoma[$d] then buy $judulkoma[$c] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F3/$F2b*100,"%</td></tr>";}
if ($c > $a && $d > $c && $F3 >= $k){
echo "<tr><td>If buy $judulkoma[$c] and buy $judulkoma[$d] then buy $judulkoma[$a] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F3/$F2c*100,"%</td></tr>";}
}
}
}
?>
</table>
</form>
</font>
<br><br><br>
<div id="footer">
<p>©Ferdo Eko Christanto, 23113421</p>
</div>
</body>
</html><html>
<body>
<form action="index.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<h3>Program Association Ruler<br></h3>
<font size = "2 pt">
Upload File :<br>
<input type="file" name="fupload" />
<input type="submit" name="upload" value="Upload" /><br><br>
Record Penjualan : <br>
<textarea name="inputdata" rows="5" cols="30">
<?php
$file_name = $_FILES['fupload']['name'];
$file_type = $_FILES['fupload']['type'];
if(strlen($file_name)<>0) {
$file = fopen($file_name, "r");
$in1 = str_replace("\n","", file_get_contents($file_name));
echo $in1;
fclose($file);}
$inputdata = $_POST['inputdata'];
echo $inputdata;
?>
</textarea><br>
Masukan Nilai K <input type="text" size="2" name="NilaiK"> <br><br>
<input type="submit" value="Proses"><br><br>
<?php
$k = $_POST['NilaiK'];
$rata = str_replace(",","\n",$inputdata);
$rata2 = str_replace("\r","",$rata);
$rata3 = str_replace(", ",",",$rata2);
$rata4 = explode("\n",$rata3);
$judulkoma = (array_unique($rata4));
sort($judulkoma);
$jmlkolom = count ($judulkoma);
$jmlkolomarr = $jmlkolom - 1;
$input = str_replace("\r","",$inputdata);
$pisahenter = explode("\n",$input);
$jmlbaris = count ($pisahenter);
$jmlbarisarr = $jmlbaris - 1;?>
<table border = "1" width = "30%" height="80px"><tr><td></td>
<?php
for ($aa=0; $aa<=$jmlkolomarr; $aa++){
echo"<td>$judulkoma[$aa]</td>";}
echo "</tr>";
for ($a=0; $a<=$jmlbarisarr; $a++){
echo "<tr><td>",$a+1,"</td>";
for ($b=0; $b<=$jmlkolomarr; $b++){
$pisahkoma = explode(",",$pisahenter[$a]);
$jmldata = count ($pisahkoma);
$jmldataarr = $jmldata - 1;
$selb = array_search($judulkoma[$b], $pisahkoma);
if (strlen($selb)<>0){
echo"<td>1</td>";}
else{
echo"<td>0</td>";}
} echo "</tr>";
}
?>
</table>
<?php
if ($jmlkolom >= 1){
echo "<br> <u>F1</u><br><br>";}
for ($a=0; $a<=$jmlkolomarr; $a++){
$F1 = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$pisahkoma = explode(",",$pisahenter[$b]);
$jmldata = count ($pisahkoma);
$jmldataarr = $jmldata - 1;
$sela = array_search($judulkoma[$a], $pisahkoma);
if (strlen($sela)<> 0){
$F1++;}
}echo $judulkoma[$a]," = ",$F1,"<br>";
}
if ($jmlkolom >= 2){
echo "<br> <u>F2</u><br><br>";}
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
$F2 = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldataarr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0){
$F2++;}
}
if ($c > $a && $F2 >= $k){
echo $judulkoma[$a],",",$judulkoma[$c]," = ",$F2,"<br>";
}}
}
if ($jmlkolom >= 3){
echo "<br> <u>F3</u><br><br>";}
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
for ($d=0; $d<=$jmlkolomarr; $d++){
$F3 = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldataarr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
$dpisahkoma = explode(",",$pisahenter[$b]);
$djmldata = count ($dpisahkoma);
$djmldataarr = $djmldata - 1;
$seld = array_search($judulkoma[$d], $dpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0 && strlen($seld)<>0){
$F3++;}
}
if ($c > $a && $d > $c && $F3 >= $k){
echo $judulkoma[$a],",",$judulkoma[$c],",",$judulkoma[$d],"= ",$F3,"<br>";
}}
}
}
?>
<br><br><table border = "1"><tr><td>Statement</td><td>Support</td><td>Confidence</td></tr>
<?php
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
$F2 = 0;
$F1a = 0;
$F1b = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldataarr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0){
$F2++;}
if (strlen($sela)<>0){
$F1a++;}
if (strlen($selc)<>0){
$F1b++;}
}
if ($c > $a && $F2 >= $k){
echo "<tr><td>If buy $judulkoma[$a] then buy $judulkoma[$c] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F2/$F1a*100,"%</td></tr>";}
if ($c > $a && $F2 >= $k){
echo "<tr><td>If buy $judulkoma[$c] then buy $judulkoma[$a] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F2/$F1b*100,"%</td></tr>";}
}
}
for ($a=0; $a<=$jmlkolomarr; $a++){
for ($c=0; $c<=$jmlkolomarr; $c++){
for ($d=0; $d<=$jmlkolomarr; $d++){
$F3 = 0;
$F2a = 0;
$F2b = 0;
$F2c = 0;
for ($b=0; $b<=$jmlbarisarr; $b++){
$apisahkoma = explode(",",$pisahenter[$b]);
$ajmldata = count ($apisahkoma);
$ajmldata1arr = $ajmldata - 1;
$sela = array_search($judulkoma[$a], $apisahkoma);
$cpisahkoma = explode(",",$pisahenter[$b]);
$cjmldata = count ($cpisahkoma);
$cjmldataarr = $cjmldata - 1;
$selc = array_search($judulkoma[$c], $cpisahkoma);
$dpisahkoma = explode(",",$pisahenter[$b]);
$djmldata = count ($dpisahkoma);
$djmldataarr = $djmldata - 1;
$seld = array_search($judulkoma[$d], $dpisahkoma);
if (strlen($sela)<>0 && strlen($selc)<>0 && strlen($seld)<>0){
$F3++;}
if (strlen($sela)<>0 && strlen($selc)<>0){
$F2a++;}
if (strlen($sela)<>0 && strlen($seld)<>0){
$F2b++;}
if (strlen($selc)<>0 && strlen($seld)<>0){
$F2c++;}
}
if ($c > $a && $d > $c && $F3 >= $k){
echo "<tr><td>If buy $judulkoma[$a] and buy $judulkoma[$c] then buy $judulkoma[$d] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F3/$F2a*100,"%</td></tr>";}
if ($c > $a && $d > $c && $F3 >= $k){
echo "<tr><td>If buy $judulkoma[$a] and buy $judulkoma[$d] then buy $judulkoma[$c] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F3/$F2b*100,"%</td></tr>";}
if ($c > $a && $d > $c && $F3 >= $k){
echo "<tr><td>If buy $judulkoma[$c] and buy $judulkoma[$d] then buy $judulkoma[$a] </td><td>",$k/$jmlkolom*100,"%</td><td>",$F3/$F2c*100,"%</td></tr>";}
}
}
}
?>
</table>
</form>
</font>
<br><br><br>
<div id="footer">
<p>©Ferdo Eko Christanto, 23113421</p>
</div>
</body>
</html>