<?php
//Mysql connection made here

mysql_connect ("dbserver", "dbuser", "dbpassword") or die(mysql_error());

mysql_select_db("dbname") or die(mysql_error());

//Useful functions comes here

function filter ($text) {
	return mysql_escape_string($text);

}

function sendmessage($number, $text) {

	$footer = "\nPowered by Spider.";  //Footer text
	$text = $text.$footer; 						//Remove this line to not add footer text.

	mysql_query("INSERT INTO `outbox`  (`id` ,`number` ,`processed_date` ,`insertdate` ,`text` ,`phone` ,`processed` ,`error` ,`dreport`) VALUES (NULL , '".filter($number)."', NOW( ) , '0000-00-00 00:00:00', '".filter($text)."', NULL , '0', '-1', '0');");

}

$c = file("contacts.txt"); //A file named "contacts.txt" should have one mobile number per line.

$message = "Hellooooooooooooooo :)";
for ($i=0; $i<count($c); $i++) {

	sendmessage(trim($c[$i]), $message);

}

?>