fork download
  1. <?php
  2. function h($text){
  3. return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  4. }
  5. function check($d, $message, $message2){
  6. if (strlen($d) <= 0){
  7. echo $message;
  8. exit();
  9. }
  10. elseif (strlen($d) > 13){
  11. echo $message2;
  12. exit();
  13. }
  14. }
  15.  
  16. $name = h($_POST['name']);
  17. $phone = h($_POST['phone']);
  18.  
  19. check($name, 'Вы не представились', 'Имя слишком длинное (до 13 символов');
  20. check($phone, 'Вы не ввели номер', 'Номер слишком длинный (до 13 символов)');
  21.  
  22. if (!preg_match('/^\d+$/i', $phone)) {
  23. echo 'В поле номера недопустимые символы (вводите только числа)';
  24. exit();
  25. }
  26.  
  27. $send_to = 'zalupa@ya.ru'; //Куда шлем
  28. $sender = 'callback'; //От имени кого
  29. $header = 'Обратный звонок'; //Заголовок письма
  30.  
  31. /* Формируем письмо */
  32. $message = "Заказ обратного звонка,
  33. Имя отправителя: $name
  34. Номер телефона: $phone";
  35.  
  36.  
  37. $from = "From: $sender";
  38. mail($send_to, $header, $message, $from);
  39. header('Location: site.ru');
  40.  
  41. ?>
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
<?php
^
Main.java:1: error: class, interface, or enum expected
<?php
 ^
Main.java:1: error: class, interface, or enum expected
<?php
  ^
Main.java:3: error: unclosed character literal
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
                                               ^
Main.java:3: error: unclosed character literal
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
                                                     ^
Main.java:4: error: class, interface, or enum expected
}
^
Main.java:8: error: class, interface, or enum expected
        exit();
        ^
Main.java:9: error: class, interface, or enum expected
    }
    ^
Main.java:12: error: class, interface, or enum expected
            exit();
            ^
Main.java:13: error: class, interface, or enum expected
        }
        ^
Main.java:16: error: unclosed character literal
$name = h($_POST['name']);
                 ^
Main.java:16: error: unclosed character literal
$name = h($_POST['name']);
                      ^
Main.java:17: error: class, interface, or enum expected
$phone = h($_POST['phone']);
^
Main.java:17: error: unclosed character literal
$phone = h($_POST['phone']);
                  ^
Main.java:17: error: unclosed character literal
$phone = h($_POST['phone']);
                        ^
Main.java:19: error: class, interface, or enum expected
check($name, '?? ?? ?????????????', '??? ??????? ??????? (?? 13 ????????');
^
Main.java:19: error: unclosed character literal
check($name, '?? ?? ?????????????', '??? ??????? ??????? (?? 13 ????????');
             ^
Main.java:19: error: unclosed character literal
check($name, '?? ?? ?????????????', '??? ??????? ??????? (?? 13 ????????');
                                 ^
Main.java:19: error: unclosed character literal
check($name, '?? ?? ?????????????', '??? ??????? ??????? (?? 13 ????????');
                                    ^
Main.java:19: error: unclosed character literal
check($name, '?? ?? ?????????????', '??? ??????? ??????? (?? 13 ????????');
                                                                        ^
Main.java:20: error: class, interface, or enum expected
check($phone, '?? ?? ????? ?????', '????? ??????? ??????? (?? 13 ????????)');
^
Main.java:20: error: unclosed character literal
check($phone, '?? ?? ????? ?????', '????? ??????? ??????? (?? 13 ????????)');
              ^
Main.java:20: error: unclosed character literal
check($phone, '?? ?? ????? ?????', '????? ??????? ??????? (?? 13 ????????)');
                                ^
Main.java:20: error: unclosed character literal
check($phone, '?? ?? ????? ?????', '????? ??????? ??????? (?? 13 ????????)');
                                   ^
Main.java:20: error: unclosed character literal
check($phone, '?? ?? ????? ?????', '????? ??????? ??????? (?? 13 ????????)');
                                                                          ^
Main.java:22: error: class, interface, or enum expected
if (!preg_match('/^\d+$/i', $phone)) {
^
Main.java:22: error: unclosed character literal
if (!preg_match('/^\d+$/i', $phone)) {
                ^
Main.java:22: error: illegal character: '\'
if (!preg_match('/^\d+$/i', $phone)) {
                   ^
Main.java:22: error: unclosed character literal
if (!preg_match('/^\d+$/i', $phone)) {
                         ^
Main.java:23: error: unclosed character literal
    echo '? ???? ?????? ???????????? ??????? (??????? ?????? ?????)';
         ^
Main.java:23: error: unclosed character literal
    echo '? ???? ?????? ???????????? ??????? (??????? ?????? ?????)';
                                                                   ^
Main.java:25: error: class, interface, or enum expected
}
^
Main.java:27: error: unclosed character literal
$send_to = 'zalupa@ya.ru'; //???? ????
           ^
Main.java:27: error: unclosed character literal
$send_to = 'zalupa@ya.ru'; //???? ????
                        ^
Main.java:28: error: class, interface, or enum expected
$sender = 'callback'; //?? ????? ????
        ^
Main.java:28: error: unclosed character literal
$sender = 'callback'; //?? ????? ????
          ^
Main.java:28: error: unclosed character literal
$sender = 'callback'; //?? ????? ????
                   ^
Main.java:29: error: unclosed character literal
$header = '???????? ??????'; //????????? ??????
          ^
Main.java:29: error: unclosed character literal
$header = '???????? ??????'; //????????? ??????
                          ^
Main.java:32: error: unclosed string literal
$message = "????? ????????? ??????,
           ^
Main.java:34: error: unclosed string literal
????? ????????: $phone";
                      ^
Main.java:38: error: class, interface, or enum expected
mail($send_to, $header, $message, $from);
^
Main.java:39: error: class, interface, or enum expected
header('Location: site.ru');
^
Main.java:39: error: unclosed character literal
header('Location: site.ru');
       ^
Main.java:39: error: unclosed character literal
header('Location: site.ru');
                         ^
Main.java:41: error: class, interface, or enum expected
?>
^
46 errors
stdout
Standard output is empty