Advertisement
Guest User

form.php

a guest
Apr 23rd, 2012
1,255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.68 KB | None | 0 0
  1. <html>
  2. <head>
  3.     <title>Mobile Number Texter</title>
  4. </head>
  5. <body>
  6. <?php
  7.  
  8. ///////////////////////////////////
  9. // Copyright 2012 Eric Heikkinen //
  10. ///////////////////////////////////
  11.  
  12. /*
  13.  
  14. This script will ATTEMPT to sent a text message to different mobile carriers by sending an email in the form of number@carrier.ext.
  15. I have based this script on reported SMS gateways from this Wikipedia page: http://en.wikipedia.org/wiki/List_of_SMS_gateways
  16. I suspect that many of these carriers are either no longer working, like in the case of Google Voice, so not all of these services are guaranteed to work.
  17. There is no validation going on for these numbers on the backend, and I have only enabled some of the numbers in an effort to save myself some time.
  18. Feel free to re-purpose or improve this script.
  19.  
  20. To customize the outgoing message and other options, please edit the first section of the text.php file.
  21.  
  22. */
  23. ?>
  24.  
  25. <script type="text/javascript">
  26. // Disable number and submit field until a carrier is selected
  27. function selected() {
  28.    if (document.mobile.mobile_carrier.value == 'none') {
  29.       document.mobile.mobile_number.disabled=true;
  30.    } else {
  31.       document.mobile.mobile_number.disabled=false;
  32.    }
  33.    if (document.mobile.mobile_carrier.value == 'none') {
  34.       document.mobile.mobile_submit.disabled=true;
  35.    } else {
  36.       document.mobile.mobile_submit.disabled=false;
  37.    }
  38. }
  39.  
  40. // Only allow numbers in the text field
  41. function numbersonly(e, decimal) {
  42.     var key;
  43.     var keychar;
  44.  
  45.     if (window.event) {
  46.        key = window.event.keyCode;
  47.     }
  48.     else if (e) {
  49.        key = e.which;
  50.     }
  51.     else {
  52.        return true;
  53.     }
  54.     keychar = String.fromCharCode(key);
  55.  
  56.     if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
  57.        return true;
  58.     }
  59.     else if ((("0123456789").indexOf(keychar) > -1)) {
  60.        return true;
  61.     }
  62.     else if (decimal && (keychar == ".")) {
  63.       return true;
  64.     }
  65.     else
  66.        return false;
  67. }
  68.  
  69. </script>
  70.  
  71. <style type="text/css">
  72. input:disabled {
  73.   opacity:0.3;
  74. }
  75. label{
  76.     width: 120px;
  77.     float: left;
  78.     text-align: right;
  79.     margin-right: 5px;
  80.     display: block
  81. }
  82. #mobile_carrier {
  83.     width: 260px;
  84.     padding: 5px;
  85.     margin-bottom:5px;
  86.     border: 1px solid #ccc;
  87. }
  88. #mobile_number {
  89. }
  90. #mobile_submit{
  91.     margin-left: 125px;
  92. }
  93. .mobile_confirmation {
  94.     width: 600px;
  95.     margin-top: 25px;
  96. }
  97. .mobile_confirmation input {
  98.     padding: 5px;
  99.     width: 260px;
  100.     margin: 0px 0px 10px 0px;
  101.     border: 1px solid #ccc;
  102. }
  103. #form_left_wrapper {
  104.     float:left;
  105.     width:400px;
  106. }
  107. #validation {
  108.     float:right;
  109.     width:200px;
  110.     margin:38px 0 0 0;
  111.     color:#CC0000;
  112.     font-weight:bold;
  113. }
  114. </style>
  115.  
  116. <div class="mobile_confirmation">
  117. <form action="text.php" method="post" id="mobile" name="mobile">
  118.     <div id="validation"></div>
  119.     <div id="form_left_wrapper">
  120.         <label for="carrier">Mobile Carrier:</label>
  121.             <select name="mobile_carrier" id="mobile_carrier" onChange="selected()">
  122.                 <option value='none'></option>
  123.                 <optgroup label="North America">
  124.                     <option value="alaskacommunications">Alaska Communications</option>
  125.                     <option value="aliant">Aliant</option>
  126.                     <option value="alltel">Alltel</option>
  127.                     <option value="ameritech">Ameritech</option>
  128.                     <option value="att">AT&amp;T</option>
  129.                     <option value="bellmobility">Bell Mobility &amp; Solo Mobile</option>
  130.                     <option value="bellsouth">BellSouth</option>
  131.                     <option value="bluegrass">Bluegrass Cellular</option>
  132.                     <option value="bluesky">Bluesky Communications</option>
  133.                     <option value="myboostmobile">Boost Mobile</option>
  134.                     <option value="cellcom">Cellcom</option>
  135.                     <option value="celloneusa">Cellular One</option>
  136.                     <option value="csouth1">Cellular South</option>
  137.                     <option value="cwemail">Centennial Wireless</option>
  138.                     <option value="cvalley">Chariton Valley Wireless</option>
  139.                     <option value="gocbw">Cincinnati Bell</option>
  140.                     <option value="cingular">Cingular</option>
  141.                     <option value="cingulartext">Cingular (GoPhone)</option>
  142.                     <option value="cleartalk">Cleartalk Wireless</option>
  143.                     <option value="mycricket">Cricket</option>
  144.                     <option value="cspire1">C Spire Wireless</option>
  145.                     <option value="edgewireless">Edge Wireless</option>
  146.                     <option value="elementmobile">Element Mobile</option>
  147.                     <option value="echoemail">Esendex</option>
  148.                     <option value="fido">Fido</option>
  149.                     <option value="gci">General Communications</option>
  150.                     <option value="gscsms">Golden State Cellular</option>
  151.                     <!-- <option value="google">Google</option> -->
  152.                     <option value="myhelio">Helio</option>
  153.                     <option value="iwirelesshometext">i-wireless (Sprint PCS)</option>
  154.                     <option value="kajeet">Kajeet</option>
  155.                     <option value="telus">Koodo Mobile</option>
  156.                     <option value="longlines">LongLines</option>
  157.                     <option value="mymetropcs">MetroPCS</option>
  158.                     <option value="mtsmobility">MTS Mobility</option>
  159.                     <option value="nextel">Nextel (Sprint)</option>
  160.                     <option value="celloneusa">O2</option>
  161.                     <option value="celloneusa">Orange</option>
  162.                     <option value="mobiletxt">PC Telecom</option>
  163.                     <option value="zsend">Pioneer Cellular</option>
  164.                     <option value="pocket">Pocket Wireless</option>
  165.                     <option value="qwestmp">Qwest Wireless</option>
  166.                     <option value="att">Red Pocket Mobile (AT&T MVNO)</option>
  167.                     <option value="rogers">Rogers Wireless</option>
  168.                     <option value="sasktel">SaskTel</option>
  169.                     <option value="smtext">Simple Mobile</option>
  170.                     <option value="rinasms">South Central Communications</option>
  171.                     <option value="sprintpcs">Sprint (PCS)</option>
  172.                     <option value="vtext">Straight Talk</option>
  173.                     <option value="rinasms">Syringa Wireless</option>
  174.                     <option value="tmomail">T-Mobile</option>
  175.                     <option value="teleflip">Teleflip</option>
  176.                     <option value="telus">Telus Mobility</option>
  177.                     <option value="tracfone">TracFone (prepaid)</option>
  178.                     <option value="utext">Unicel</option>
  179.                     <option value="uscc">US Cellular</option>
  180.                     <option value="usamobility">USA Mobility</option>
  181.                     <option value="vtext">Verizon Wireless</option>
  182.                     <option value="viaerosms">Viaero</option>
  183.                     <option value="vmobl">Virgin Mobile</option>
  184.                     <option value="vmobileca">Virgin Mobile (Canada)</option>
  185.                     <option value="">Wind Mobile</option>
  186.                     <option value="xit">XIT Communications</option>
  187.                 </optgroup>
  188.                 <optgroup label="Africa">
  189.                     <option value="emtelworld">Emtel</option>
  190.                     <option value="mtn">MTN</option>
  191.                     <option value="voda">Vodacom</option>
  192.                 </optgroup>
  193.                 <optgroup label="Asia">
  194.                     <option value="aircel">Aircel</option>
  195.                     <option value="airtela">Airtel (Andhra Pradesh, India)</option>
  196.                     <option value="airtelg">Airtel (Gujarat, India)</option>
  197.                     <option value="airtelh">Airtel (Haryana, India)</option>
  198.                     <option value="airtelk">Airtel (Karnataka, India)</option>
  199.                     <option value="andhraairtel">Andhra Pradesh AirTel</option>
  200.                     <option value="au">AU by KDDI</option>
  201.                     <option value="airtelchennai">Chennai Skycell / Airtel</option>
  202.                     <option value="rpgmail">Chennai RPG Cellular</option>
  203.                     <option value="139">China Mobile</option>
  204.                     <option value="hkcsl">CSL</option>
  205.                     <option value="airtelmail">Delhi Airtel</option>
  206.                     <option value="hutch">Delhi Hutch</option>
  207.                     <option value="airtelmail">Goa Airtel</option>
  208.                     <option value="bplmobile">Goa BPL Mobile</option>
  209.                     <option value="celforce">Gujarat Celforce / Fascel</option>
  210.                     <option value="escotelmobile">Haryana Escotel</option>
  211.                     <option value="ideacellular">Idea Cellular</option>
  212.                     <!--
  213.                     <option value=""></option>
  214.                     -->
  215.                 </optgroup>
  216.                 <!--
  217.                 <optgroup label="Australia &amp; Oceana">
  218.                     <option value=""></option>
  219.                 </optgroup>
  220.                 -->
  221.                 <optgroup label="Europe">
  222.                     <option value="aql">aql</option>
  223.                     <option value="bouyguestelecom">Bouygues Telecom</option>
  224.                     <option value="eplus">E-Plus</option>
  225.                     <option value="echoemail">Esendex (UK)</option>
  226.                     <option value="esendex">Esendex (Spain)</option>
  227.                     <option value="globul">Globul</option>
  228.                     <!--
  229.                     <option value=""></option>
  230.                     -->
  231.                 </optgroup>
  232.                 <optgroup label="South America">
  233.                     <option value="clarotorpedo">Claro (Brasil)</option>
  234.                     <option value="ideasclaro">Claro (Nicaragua)</option>
  235.                     <option value="vtexto">Claro (Puerto Rico)</option>
  236.                     <option value="comcel">Comcel</option>
  237.                     <option value="ctimovil">Claro (Argentina)</option>
  238.                     <option value="digitextdm">Digicel (Dominica)</option>
  239.                     <!--
  240.                     <option value=""></option>
  241.                 </optgroup>
  242.                 <!--
  243.                 <optgroup label="International">
  244.                     <option value="globalstarusa">Globalstar</option>
  245.                     <option value=""></option>
  246.                 </optgroup>
  247.                 -->
  248.             </select>
  249.         <br />
  250.            
  251.         <div id="mobile_number_wrapper">
  252.             <label for="number">Mobile Number:</label>
  253.             <input type="text" disabled="disabled" id="mobile_number" name="mobile_number" maxlength="20" onKeyPress="return numbersonly(event, false)" />
  254.             <br />
  255.         </div>
  256.    
  257.     <input type="submit" disabled="disabled" id="mobile_submit" name="mobile_submit" value="Submit" />
  258.     <script type="text/javascript">
  259.     /* Check that there is data in the Number Field */
  260.     function Validate(form) {
  261.             var errors = "";
  262.         if (form.mobile_number.value.length == 0) {
  263.                     form.mobile_number.style.border = "1px solid red";
  264.                     form.mobile_number.style.backgroundColor = "#FFCCCC";
  265.                     errors += "Please enter a Number";
  266.             }
  267.             if (errors.length > 0) {
  268.                     document.getElementById("validation").innerHTML = "" + errors + "";
  269.                     return false;
  270.             }
  271.         return true;
  272.     }
  273.     document.getElementById("mobile").onsubmit = function () {
  274.         return Validate(this);
  275.     };
  276.     </script>
  277. </form>
  278. </div>
  279.  
  280. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement