Forum Moderators: coopster
--------------------------------------------------------------
<?php
//include(utsi_config.php);
$uinput=$_GET['uinput'];
$path="./serials";
$ext='csv';
$filename=($path.'/'.$uinput.'.'.$ext);
if (file_exists($filename))
{
function AddMerchant($name,$number,$outstanding,$duedate,$instalment)
{
global $db_host,$db_user,$db_pwd,$db_name;
$db_host = "localhost";
$db_user = "root";
$db_pwd = "";
$db_name = "sms_db";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
mysql_connect("$db_host","$db_user","$pdb_pwd")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="INSERT IGNORE INTO `outgoingsms` (`msisdn`, `message`, `timelog`, `status`, `sendoption`, `deleted`, `retries`) VALUES ('$number', 'Dear $name,your current arrears are $outstanding.your next instalment of $instalment is due on $duedate Please make arrngments to clear your dues', current_timestamp, '0', '1', '0', '0')";
mysql_query($sql) or die("cannot query");
}
$file=file_get_contents($filename);
$rows=explode("\n", $file);
foreach($rows as $row)
{
$items=explode(",", $row);
AddMerchant($items[0],$items[1],$items[2],$items[3],$items[4]);
echo "complete";
}
}
else
{
echo "wrong file!";
}
?>