global $site;
$site = $_GET['page'];
global $tg;
$tg = $_GET['tags'];
$rad = rand(2,-1);
if ($rad == 2)
{
$dba = mysql_connect ("localhost", "lookup_main", "marty33");
}
if ($rad == 1)
{
$dba = mysql_connect ("localhost", "lookup_second", "j084a4ta");
}
if (!$dba)
die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("lookup_hbase");
$haku = mysql_query("SELECT * FROM sites WHERE (url = '$site')", $dba);
$hakub = mysql_query("SELECT * FROM sites WHERE (url LIKE '%$site%')", $dba);
$loyty = mysql_num_rows($haku); // onko kannassa?
$mar = mysql_num_rows($hakub); //alasivut
//haetaan nimi, hinta ja määrä muuttujiin
// (`keywords`, `otsikko`, `kuvaus`, `url`, `lisayspwm`, `indexpwm`, `extra`, `keynum`)
if ($mar)
{
?>
$row = mysql_fetch_assoc($haku);
$ur = str_replace("www.", '', $site);
$jaos = explode("/", $ur);
$ur = $jaos[0];
echo '
';
echo " |
Sivu lisätty tietokantaamme: ".$row['lisayspwm']." ";
if (empty($row['indexpwm']) OR $row['indexpwm'] == "hyväksyn")
{
echo "Viimeksi indeksoitu: ".$row['lisayspwm']." ";
}
else
echo "Viimeksi indeksoitu: ".$row['indexpwm']." ";
echo "".$row['otsikko']."
|
";
if ($tg == "text")
{
echo '
(Näytä tagit)';
echo "
".$row['kuvaus']."";
}
else
{
echo '
(Piilota tagit)
';
$tagit = str_replace(".", " ", $row['kuvaus']);
$tagit = str_replace(",", " ", $tagit);
$tagit = str_replace(":", " ", $tagit);
$tagit = str_replace("?", " ", $tagit);
$tagit = str_replace("!", " ", $tagit);
$merkit = array("-", "@", "%", "?", "+", "[", "]", "¤", "#", "!", "=");
function clean ($string) {
//tässä luetellaan sallitut merkit vaikka ei
$merkit = "abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÅ_1234567890 ";
for($u = 0; $u <= strlen($string); $u++){
if(@strstr($merkit, $string[$u])){
$stringi .= $string[$u];
}
}
$string = preg_replace("/[\\<\\>\\/\\\?;()|]/", "", $stringi);
$string = strip_tags($string);
$string = ereg_replace("\n", "", $string);
return $string;
}
$tagit = str_replace($merkit, " ", $tagit);
$tagit = clean($tagit);
$linkit = preg_split("/[\040]+/", $tagit, -1, PREG_SPLIT_OFFSET_CAPTURE);
foreach ($linkit as $val) {
echo ''. $val[0] . '';
echo "\n";
$kpp++;
}
echo "
Sanoja:
$kpp";
}
echo "
".$row['url']."
";
echo " - Alasivuja indeksissämme yhteensä:
$mar
";
mysql_close($dba);
?>
Powered by LookUp.fi
}
else
echo "";
?>