<?php
/*
--- Please Leave for Your Information ---
Name - KeyGold
Version - 1.0
WebSite - http://www.iklanpromo.com/script
Writer - Usnada (hide@address.com)
File : keywodgen.php
--- Thank you ---
*/
if ($from=="" ){
echo <<<EOF
<html>
<head>
<title>Keyword Generator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Ketut usnada">
<meta name="Email" content="hide@address.com">
<meta name="description" content="Usnada - Keyword Generator">
<meta name="keywords" content="search engine, keyword generator">
<meta http-equiv=Expires content='Juli 2001'>
<meta http-equiv=Pragma content='No-Cache'>
</head>
<body bgcolor = "#FF9900">
<table align="center">
<form method=post action="$PHP_SELF">
<tr align="center">
<td>
<textarea name=sitecontents rows=10 cols=70 wrap></textarea>
</td>
</tr>
<tr align="center">
<td>
<input type=submit value="Proses Content">
<input type=reset value="Reset">
<input type="hidden" name="from" value="text">
</td>
</tr>
</form>
<form method=post action="$PHP_SELF" enctype="multipart/form-data">
<tr align="center">
<td>
<br>
<input type="file" name="userfile" size="40">
<br>
<input type="submit" value="Proses Upload">
<input type=reset value="Reset">
<input type="hidden" name="from" value="file">
</td>
</tr>
</form>
<form method=post action="$PHP_SELF">
<tr align="center">
<td>
<br>
<input type="text" name="address" size="50">
<br>
<input type="submit" value="Proses Address">
<input type=reset value="Reset">
<input type="hidden" name="from" value="web">
</td>
</tr>
</form>
</table>
<!-- Note : Please don't remove this line. Let's others know where this script is. -->
<center><font size="1" color="#3333FF" face = "tahoma"><a href="http://www.iklanpromo.com">iklan promo 1.0</a></font></center>
<!-- End note -->
</body>
</html>
EOF;
exit;
} elseif ($from=="text"){
$sitecontents = trim($sitecontents);
$sitecontents = chop($sitecontents);
if ($sitecontents=="" ) die("Input Salah !!");
} elseif ($from=="file"){
if (trim($userfile_name)=="" ) die("Filenya mana ?!!");
if ($userfile_name <> "" and !file_exists($userfile)) die("Upload gagal !!");
$isi = @file($userfile);
for ($a=0; $a<count($isi); $a++ ):
if (trim($isi[$a]) <> "" ) $sitecontents.= $isi[$a];
endfor;
if ($sitecontents=="" ) die("File Kosong !!");
} elseif ($from=="web"){
$address = trim($address);
if ($address=="") die("Input Salah");
$isi = @file($address);
if (!$isi) die("File tidak bisa dibuka");
for ($a=0; $a<count($isi); $a++ ):
if (trim($isi[$a]) <> "" ) $sitecontents.= $isi[$a];
endfor;
if ($sitecontents=="" ) die("File Kosong !!");
} else{
die("Apa ini!");
}
while( !(strpos(strtolower($sitecontents),"<script",0)===false) ){
$awal=strpos(strtolower($sitecontents),"<script",0);
$akhir = strpos(strtolower($sitecontents),"</script>",$awal);
$sitecontents = substr($sitecontents,0,$awal)." ".substr($sitecontents,$akhir);
}
$sitecontents = strip_tags($sitecontents);
if ($sitecontents=="" ) die("Content Kosong");
$sitecontents = str_replace (" ", " ", $sitecontents);
$sitecontents = str_replace ("\t", " ", $sitecontents);
$sitecontents = str_replace ("\r\n", " ", $sitecontents);
$sitecontents = str_replace ("\r", " ", $sitecontents);
$sitecontents = str_replace ("\n", " ", $sitecontents);
$sitecontents = str_replace ('"', "", $sitecontents);
while( !(strpos($sitecontents," ",0)===false) ){
$sitecontents = str_replace (" ", " ", $sitecontents);
}
$sitecontents = ucfirst(trim($sitecontents));
$parsearray[] = $sitecontents;
$parsestring = " ".strtolower(join($parsearray," "))." ";
$parsestring = str_replace (",", "", $parsestring);
$parsestring = str_replace (".", "", $parsestring);
$parsestring = str_replace (";", "", $parsestring);
$parsestring = str_replace (":", "", $parsestring);
$parsestring = str_replace (")", "", $parsestring);
$parsestring = str_replace ("(", "", $parsestring);
// satu baris dibawah bisa di remark lho
//$parsestring = str_replace ("'", "", $parsestring);
$parsestring = str_replace ('"', "", $parsestring);
$parsestring = str_replace ('?', "", $parsestring);
$parsestring = str_replace ('!', "", $parsestring);
$parsestring = str_replace ('{', "", $parsestring);
$parsestring = str_replace ('}', "", $parsestring);
$parsestring = str_replace ('[', "", $parsestring);
$parsestring = str_replace (']', "", $parsestring);
require "commonwords.php";
$commonarray = split(" ",$commonwords);
for ($i=0; $i<count($commonarray); $i++) {
$parsestring = str_replace (" ".$commonarray[$i]." ", " ", $parsestring);
}
$wordsarray = split(" ",$parsestring);
for ($i=0; $i<count($wordsarray); $i++) {
$wordsarray[$i] = trim(chop($wordsarray[$i]));
if( $wordsarray[$i]<>"" ){
$word = $wordsarray[$i];
if ($freqarray[$word]) {
$freqarray[$word] += 1;
} else {
$freqarray[$word]=1;
}
}
}
@arsort($freqarray);
require "expectedwords.php";
$expectarray = split(" ",$expectwords);
for ($A=0; $a<count($expectarray); $a++) {
if( $freqarray[$expectarray[$a]] > 0 ){
$goldwords[] = $expectarray[$a];
}
}
@reset($freqarray);
$i=0;
while (list($key, $val) = @each($freqarray)) {
$i++;
$freqall[$key] = $val;
if ($i==15) {
break;
}
}
for ($i=0; $i<count($wordsarray)-1; $i++) {
$j = $i+1;
$word2 = $wordsarray[$i]." ".$wordsarray[$j];
if ($freqarray2[$word2]) {
$freqarray2[$word2] += 1;
} else {
$freqarray2[$word2]=1;
}
}
@arsort($freqarray2);
$i=0;
while (list($key, $val) = @each($freqarray2)) {
$i++;
$freqall[$key] = $val;
if ($i==4) {
break;
}
}
for ($i=0; $i<count($wordsarray)-2; $i++) {
$j = $i+1;
$word3 = $wordsarray[$i]." ".$wordsarray[$j]." ".$wordsarray[$j+1];
if ($freqarray3[$word3]) {
$freqarray3[$word3] += 1;
} else {
$freqarray3[$word3]=1;
}
}
@arsort($freqarray3);
$i=0;
while (list($key, $val) = @each($freqarray3)) {
$i++;
$freqall[$key] = $val;
if ($i==1) {
break;
}
}
// penambahan bobot pada gold word
for ($a=0; $a<count($goldwords); $a++) {
$freqall[$goldwords[$a]] = $freqall[$goldwords[$a]] + 1;
}
@arsort($freqall);
while (list($key, $val) = @each($freqall)) {
$anal .= "$key = $val\r\n";
$keys .= $key.",";
}
$panjang = strlen($keys);
$keys = stripslashes(substr($keys,0,$panjang-1));
$keys = chop($keys);
$desc = stripslashes(substr($sitecontents,0,160));
$descnya = "<META NAME=\"Description\" CONTENT=\"$desc\">";
$keynya = "<META NAME=\"Keywords\" CONTENT=\"$keys\">";
echo <<<EOF
<html>
<head>
<title>Keyword Generator - Result</title>
</head>
<body bgcolor = "#FF9900">
<table align="center">
<form name=hasil>
<tr align="center">
<td>
<textarea name=result rows=9 cols=70 wrap>\r\n$descnya\r\n$keynya\r\n</textarea>
</td>
</tr>
<tr align="center">
<td>
<input type="button" value="< back" onclick="Javascript: window.history.back();">
<input type="button" value="copy <>" onclick="Javascript: document.hasil.result.select();">
</td>
</tr>
<tr align="center">
<td>
<br><textarea name=anal rows=10 cols=40 wrap>$anal</textarea>
</td>
</tr>
<tr align="center">
<td>
<input type="button" value="< back" onclick="Javascript: window.history.back();">
<input type="button" value="copy <>" onclick="Javascript: document.hasil.anal.select();">
</td>
</tr>
</form>
</table>
<!-- Note : Please don't remove this line. Let's others know where this script is. -->
<center><font size="1" color="#3333FF" face = "tahoma"><a href="http://www.iklanpromo.com">iklan promo 1.0</a></font></center>
<!-- End note -->
</body>
</html>
EOF;
?>