Guest User

Untitled

a guest
Jun 19th, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | None | 0 0
  1. <?php
  2. /*
  3. _____ __ __ _____ _____ _
  4. / ____| \/ |/ ____|/ ____| |
  5. | (___ | \ / | (___ | | | | __ _ ___ ___
  6. \___ \| |\/| |\___ \| | | |/ _` / __/ __|
  7. ____) | | | |____) | |____| | (_| \__ \__ \
  8. |_____/|_| |_|_____/ \_____|_|\__,_|___/___/
  9. SMS Class created by Kevin Considine, Donated to the users of Facepunch.
  10. */
  11.  
  12. /* =============- Settings -=========================================================================================================== */
  13. // Unix
  14. //ini_set("sendmail_path", "/usr/sbin/sendmail -t -i -f kevin@sillydomain.com");
  15. // ^ You'll have to change the path depending on your server.
  16.  
  17. // Windows
  18. ini_set("sendmail_from", "kevin@sillydomain.com");
  19. $GLOBALS['SendFrom'] = 'kevin@sillydomain.com'; // this won't work but why the hell not.
  20.  
  21. /* ==- I wouldn't edit below this line at all ========================================================================================= */
  22.  
  23. class SMSMessage {
  24. private $_Providers = array(
  25. /* ======================================================================================================
  26. Phone provider SMS forward emails, if what you're looking for isn't here then check out the Read Me.
  27. ====================================================================================================== */
  28. "verizon" => "vtext.com", // Verizon Wireless
  29. "t-mobile" => "tmomail.net", // T-Mobile
  30. "sprint" => "sprintpaging.com", // Sprint
  31. "sprintpcs" => "messaging.sprintpcs.com", // Sprint PCS
  32. "qwest" => "qwestmp.com", // Qwest
  33. "nextel" => "messaging.nextel.com", // Nextel
  34. "metropcs" => "mymetropcs.com", // Metro PCS
  35. "edgewireless" => "sms.edgewireless.com", // Edge Wireless
  36. "cingular" => "mobile.mycingular.com", // Cingular
  37. "cellularone" => "mobile.celloneusa.com", // Cellular One USA
  38. "boost" => "myboostmobile.com", // Boost Mobile
  39. "bellsouth" => "bellsouth.cl", // Bell South
  40. "att" => "txt.att.net", // AT&T
  41. "ameritech" => "paging.acswireless.com", // Ameritech
  42. "alltel" => "message.alltel.com", // Alltel
  43. "virginUSA" => "vmobl.com", // Virgin Mobile USA
  44. "virgin" => "vxtras.com", // Virgin Mobile ( non USA )
  45. "tracfone" => "cingularme.com", // Tracfone
  46. "helio" => "myhelio.com", // Helio
  47. "uscellular" => "email.uscc.net" // US Cellular
  48. );
  49.  
  50. private $_Message = "ns";
  51. private $_Provider = "ns";
  52. private $_Number = "ns";
  53. public function Message($Text) {
  54. if(strlen($Text) > 255) {
  55. /* ==================================================================================
  56. Message is too long! We're gonna limit it to the SMS standard of 255 characters.
  57. ================================================================================== */
  58. throw new Exception('Message is too long. (LIMIT 255 CHARS)', 1);
  59. } else {
  60. $this->_Message = $Text;
  61. }
  62. }
  63. public function Send($Text='') {
  64. if($this->_Message == "ns" && $Text=='') {
  65. /* ====================
  66. Message isn't set.
  67. ==================== */
  68. throw new Exception('Message is not set', 2);
  69. }
  70. if($Text != '') {
  71. if(strlen($Text) > 255) {
  72. /* =========================================================================================
  73. Message is too long! We're gonna limit it to the SMS standard of 255 characters, again.
  74. ========================================================================================= */
  75. throw new Exception('Message is too long. (LIMIT 255 CHARS)', 1);
  76. } else {
  77. $this->_Message = $Text;
  78. }
  79. }
  80. if($this->_Provider == "ns") {
  81. /* ====================
  82. Provider isn't set.
  83. ==================== */
  84. throw new Exception('Provider is not set', 3);
  85. }
  86. if($this->_Number == "ns") {
  87. /* ====================
  88. Provider isn't set.
  89. ==================== */
  90. throw new Exception('Number is not set', 4);
  91. }
  92. $headers = 'From: '.$GLOBALS['SendFrom']. "\r\n";
  93. /* =====================================================================================================
  94. This is where the mail() function is used, if you know what you're doing you can screw with this...
  95. ===================================================================================================== */
  96. mail($this->_Number."@".$this->_Provider, "", $this->_Message, $headers);
  97. }
  98. public function __construct($Number, $Provider, $Message=false) {
  99. if(array_key_exists(strtolower($Provider), $this->_Providers)) {
  100. if(!$Message) {
  101. /* ========================
  102. Can't send right away!
  103. ======================== */
  104. $this->_Provider = $this->Providers[$Provider];
  105. $this->_Number = $Number;
  106. } else {
  107. /* ==================
  108. Send right away!
  109. ================== */
  110. $this->_Message = $Message;
  111. $this->_Number = $Number;
  112. $this->_Provider = $this->_Providers[strtolower($Provider)];
  113. $this->Send();
  114. }
  115. } else {
  116. throw new Exception('Provider does not exist or is not supported', 5);
  117. }
  118. }
  119.  
  120. }
  121. ?>
Add Comment
Please, Sign In to add comment