Advertisement
Guest User

Untitled

a guest
Jun 14th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.35 KB | None | 0 0
  1. <?php
  2. /*
  3.  * Script for BMX_ATVMAN14 to allow users to text his phone, without them knowing his number, and without spaming his text's
  4.  *
  5.  * You can find a full chart of all the emails to use for sending a text via email at FIX THIS URL. say if my phone number was 555-666-7239, and it was on AT&T
  6.  * I would set the $to to 5556667239@txt.att.net
  7.  *
  8.  * i have fully tested this script, and it seems to work exactly how it should work, feel free to edit this code however you like.
  9.  *
  10.  * Hope this helps, please give some credit to me if you decide to use my script!
  11.  *
  12.  *By Jacob Nordquist
  13.  *
  14.  */
  15.  
  16. //config
  17. $to = "your_email@gmail.com";  //email it will be sent to
  18. $from = "someonelse@myminecraftserver.com";  //email it will come from
  19.  
  20. //starting session
  21. session_start();
  22.  
  23. //vars needed to run the script properly
  24. $timestamp = date_timestamp_get(date_create());
  25.  
  26.  
  27.  
  28. //gather POST request 'exe' to see if it is going to execute the message, or display the form
  29. $exe = $_POST['exe'];
  30. if ($exe == 'true'){
  31.    
  32.     //gathering post requests to exe into a text message
  33.     $message = $_POST['message'];
  34.     $type = $_POST['type'];
  35.    
  36.     //check and see if they have sent a message in the past 15 min
  37.     //if they did, it blocks them from sending another one
  38.    
  39.     if($_SESSION['msgtime'] > $timestamp){
  40.         echo 'You must wait 15 min before sending another message!';  //block message
  41.     }
  42.    
  43.     //if they haven't sent a message in the past 15 min, it sends the message
  44.     else{
  45.        
  46.         //sending email
  47.         $subject = $type;
  48.         $message = $message;
  49.         $headers = "From:" . $from;
  50.         mail($to,$subject,$message,$headers);
  51.         echo "Thanks for your input!";  //sent successfully message
  52.        
  53.         //setting a session with there timestamp
  54.         $_SESSION['msgtime']=$timestamp + '900';
  55.     }
  56. }
  57.  
  58. // if there was nothing in the POST request, it displays the form
  59. else{
  60. ?>
  61. <form action='' method='post'>
  62.             <input type="hidden" name="exe" value="true">
  63.             <br />
  64.     Help:   <input type="radio" name="type" value="help">
  65.             <br />
  66.     Bug:    <input type="radio" name="type" value="bug">
  67.             <br />
  68.             <textarea name='message' cols='20' rows='4'>Enter text here...</textarea>
  69.             <br />
  70.             <input type="submit">
  71. </form>
  72. <?php
  73. }
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement