All pastes #897823 Raw Edit

Anonym

public text v1 · immutable
·published 2008-02-09 21:34 UTC
rendered paste body
<?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'])));

foreach($aryLinks as $strSingleLine) {
if(!(sizeof($aryLinks) == 1 && trim($aryLinks[0]) == "")) {
        $strLink = trim($strSingleLine);
        $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 {
//        if (isset($strLinks)) {
//                echo "a";
//        } else {
//                echo "b";
//        }

                $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";
?>