fork(2) download
  1. <?php
  2. require 'smsOrange.class.php';
  3. $box=new smsOrange;
  4.  
  5. if(count($_POST)>0){
  6. if(!isset($_POST['sender']) or !isset($_POST['recipient']) or !isset($_POST['message']) or !isset($_POST['captcha']) or !isset($_POST['token']))
  7. header('Location: ?status=5');
  8. $box->setSender($_POST['sender'])
  9. or header('Location: ?status=6');
  10. $box->setRecipient($_POST['recipient'])
  11. or header('Location: ?status=2');
  12. $box->setMessage($_POST['message'])
  13. or header('Location: ?status=7');
  14.  
  15. $box->setCurlOpt( //opcjonalne dane do curl_setopt_array()
  16. CURLOPT_HTTPHEADER=>array(
  17. 'HTTP_CONNECTION: keep-alive',
  18. 'HTTP_CACHE_CONTROL: max-age=0',
  19. 'HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  20. 'HTTP_ACCEPT_ENCODING: gzip,deflate,sdch',
  21. 'HTTP_ACCEPT_LANGUAGE: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4',
  22. 'HTTP_ACCEPT_CHARSET: ISO-8859-2,utf-8;q=0.7,*;q=0.3',
  23. 'HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1'
  24. )
  25. )
  26. );
  27. $e=$box->sendMessage($_POST['captcha'],$_POST['token']);
  28. header('Location: ?status='.$e);
  29. exit(var_dump($e));
  30. }
  31. $token=$box->getToken() or die('Nie mozna pobrac Tokenu!');
  32. $captcha=$box->getCAPTCHA($token) or die('Nie mozna pobrac obrazka CAPTCHE!');
  33. ?>
  34. <!DOCTYPE html>
  35. <html>
  36. <head>
  37. <title>Bramka SMS</title>
  38. <style>
  39. form {
  40. width:300px;
  41. }
  42. label,
  43. img {
  44. display:block;
  45. }
  46. label,
  47. textarea {
  48. width:100%;
  49. }
  50. textarea {
  51. min-height:100px;
  52. }
  53. input[type=submit] {
  54. float:right;
  55. }
  56. .status {
  57. display:block;
  58. width:270px;
  59. text-align:center;
  60. font-weight:bold;
  61. background:#eaeaea;
  62. padding:10px;
  63. margin:5px;
  64. }
  65. .success {
  66. color:green;
  67. }
  68. .error {
  69. color:red;
  70. }
  71. </style>
  72. </head>
  73. <body>
  74. <?php
  75. if(isset($_GET['status'])){
  76. echo '<span id="status" class="'.(($_GET['status']==1)?'success':'error').'">Wiadmo¶ć ';
  77. if($_GET['status']==1)
  78. echo 'została wysłana.';
  79. else {
  80. echo 'nie została wysłana. ';
  81. switch($_GET['status']){
  82. case 2:
  83. echo 'Numer odbiorcy jest niepoprawny.';
  84. break;
  85. case 3:
  86. echo 'Adresat nie wyraził zgody na otrzymywanie wiadomo¶ci SMS z internetu.';
  87. break;
  88. case 4:
  89. case 5:
  90. echo 'Nie wszystkie pola zostały uzupełnione.';
  91. break;
  92. case 6:
  93. echo 'Nazwa nadawcy jest zbyt długa.';
  94. break;
  95. case 7:
  96. echo 'Wiadmo¶ć jest zbyt długa.';
  97. }
  98. }
  99. echo '</span>';
  100. }
  101. ?>
  102. <form method="POST" action="">
  103. <label>
  104. Odbiorca:
  105. <input type="numeric" name="recipient" />
  106. </label>
  107. <label>
  108. Nadawca:
  109. <input type="text" name="sender" />
  110. </label>
  111. <textarea name="message"></textarea>
  112. <label>
  113. Przepisz kod z obrazka:
  114. <input type="hidden" name="token" value="<?=$token?>" />
  115. <img src="<?=$captcha?>" alt="" title="Przepisz kod z obrazka" />
  116. <input type="text" name="captcha" />
  117. </label>
  118. <input type="submit" value="Wy¶lij" />
  119. </form>
  120. </body>
  121. </html>
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty