<?
/***
* pLiMa - php List Manager
* Copyright (C) 2003 Jinn Koriech (hide@address.com)
*
* This file is part of pLiMa.
*
* pLiMa is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* pLiMa is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with pLiMa; if not, visit http://www.gnu.org or write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*
*/
require("./inc/init.inc.php");
require("./inc/head.inc.php");
?>
<h1>Add Subscribers</h1>
<?
if ($addresses) {
// Get some information about the list we're working with
$fields = getFields($_SESSION['MALI']);
$field_list = implode(", ", $fields);
$sql_init = "REPLACE INTO ".$_SESSION['MALI']." ($field_list) VALUES ('###VALUES###');";
echo "<p>Please wait while the data is added...</p>";
// Clean up the data that we've received
$addresses = stripslashes($addresses);
$addresses = fix_cr($addresses);
// Begine the string tokenizing
$line = strtok($addresses, "\n");
while ( strlen(trim($line)) != 0 ) {
$columns = explode(",", addslashes($line));
for ( $idx = 0; $idx < count($columns); $idx++ ) {
$columns[$idx] = addslashes(trim($columns[$idx]));
}
$values = implode("', '", $columns);
$sql = str_replace("###VALUES###", $values, $sql_init);
db_query($sql, "AFF10");
$done++;
// Get the next line
$line = strtok("\n");
}
echo "<p>Done. $done entries were added to the list.</p>";
echo "<p>Return to the <a href='list-home.phtml'>list home page</a>.</p>";
} else {
echo "<p>There was a problem receiving the data. Please go back and try again.</p>";
}
?>
<?
require("./inc/foot.inc.php");
?>