<?php
include "inc/sites.php"; // die Konfigurationsdateien lesen.
include "inc/config.php"; // Configparameter für die DB einlesen
include "inc/connect_db.php"; // Zur DB Connecten
$intOldURL = 0;
$intNewURL = 0;
$aryLinks = explode("\n", str_replace("\r", "", trim($_POST['links'])));
if(!(sizeof($aryLinks) == 1 && trim($aryLinks[0]) == "")) {
foreach($aryLinks as $strSingleLine) {
$strLink = trim($strSingleLine);
if($strLink != "")
{
$sql="SELECT COUNT(link) AS COUNT FROM plaintextlinks WHERE link = '".$strLink."';";
$result = mysql_query($sql) OR die(mysql_error());
$row = mysql_fetch_assoc($result);
if ($row['COUNT'] == 0) {
$sql2 = "INSERT INTO plaintextlinks (`link`) VALUES (\"".$strLink."\");";
$intNewURL++;
mysql_query($sql2) OR die(mysql_error());
} else {
$intOldURL++;
}
}
}
}
$sql="SELECT COUNT(link) AS COUNT FROM plaintextlinks;";
$result = mysql_query($sql) OR die(mysql_error());
$row = mysql_fetch_assoc($result);
echo "You just added ".$intOldURL." Links that are allready in the DB and ".$intNewURL." New Links.<br \> I protect ".$row['COUNT']." Links.<br />If you have a Problem drop <a href=\"mailto:ben.rslinks@googlemail.com\">Ben</a> a Line.<br /><br />\n";
echo "<form action=plaintextlinks.php method=post>\n";
echo "<textarea name=\"links\" rows=\"20\" cols=\"90\"></textarea>\n";
echo "<br />\n";
echo "<input type=\"submit\" />\n";
echo "<input type=\"reset\" />\n";
echo "</form>\n";
?>