3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "lkintrea@yahoo.com"; $email_subject = "Your email subject line"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_last']) || !isset($_POST['office_phone']) || !isset($_POST['cell']) || !isset($_POST['email']) || !isset($_POST['company']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_last = $_POST['first_last']; // required $office_phone = $_POST['office_phone']; // required $cell = $_POST['cell']; // required $email = $_POST['email']; // not required $email = $_POST['company']; // not required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$office_phone)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_first)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Last Name: ".clean_string($first_last)."\n"; $email_message .= "Office Phone: ".clean_string($office_phone)."\n"; $email_message .= "Cell: ".clean_string($cell)."\n"; $email_message .= "Email: ".clean_string($email)."\n"; $email_message .= "Company: ".clean_string($company)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 147
Branch analysis from position: 3
2 jumps found. (Code = 47) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
2 jumps found. (Code = 47) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 47) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
2 jumps found. (Code = 47) Position 1 = 30, Position 2 = 34
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 65
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 73
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 80
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 84
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 90
Branch analysis from position: 87
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 90
Branch analysis from position: 84
Branch analysis from position: 80
Branch analysis from position: 73
Branch analysis from position: 65
Branch analysis from position: 38
Branch analysis from position: 34
Branch analysis from position: 29
Branch analysis from position: 24
Branch analysis from position: 19
Branch analysis from position: 14
Branch analysis from position: 147
filename:       /in/hPFnj
function name:  (null)
number of ops:  148
compiled vars:  !0 = $email_to, !1 = $email_subject, !2 = $first_last, !3 = $office_phone, !4 = $cell, !5 = $email, !6 = $comments, !7 = $error_message, !8 = $email_exp, !9 = $string_exp, !10 = $last_first, !11 = $email_message, !12 = $company, !13 = $headers, !14 = $email_from
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_IS                                         ~15     '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~15, 'email'
          2      > JMPZ                                                     ~16, ->147
    9     3    >   ASSIGN                                                   !0, 'lkintrea%40yahoo.com'
   11     4        ASSIGN                                                   !1, 'Your+email+subject+line'
   17     5        DECLARE_FUNCTION                                         'died'
   37     6        FETCH_IS                                         ~19     '_POST'
          7        ISSET_ISEMPTY_DIM_OBJ                         0  ~20     ~19, 'first_last'
          8        BOOL_NOT                                         ~21     ~20
          9      > JMPNZ_EX                                         ~21     ~21, ->14
   39    10    >   FETCH_IS                                         ~22     '_POST'
         11        ISSET_ISEMPTY_DIM_OBJ                         0  ~23     ~22, 'office_phone'
         12        BOOL_NOT                                         ~24     ~23
         13        BOOL                                             ~21     ~24
         14    > > JMPNZ_EX                                         ~21     ~21, ->19
   41    15    >   FETCH_IS                                         ~25     '_POST'
         16        ISSET_ISEMPTY_DIM_OBJ                         0  ~26     ~25, 'cell'
         17        BOOL_NOT                                         ~27     ~26
         18        BOOL                                             ~21     ~27
         19    > > JMPNZ_EX                                         ~21     ~21, ->24
   43    20    >   FETCH_IS                                         ~28     '_POST'
         21        ISSET_ISEMPTY_DIM_OBJ                         0  ~29     ~28, 'email'
         22        BOOL_NOT                                         ~30     ~29
         23        BOOL                                             ~21     ~30
         24    > > JMPNZ_EX                                         ~21     ~21, ->29
   45    25    >   FETCH_IS                                         ~31     '_POST'
         26        ISSET_ISEMPTY_DIM_OBJ                         0  ~32     ~31, 'company'
         27        BOOL_NOT                                         ~33     ~32
         28        BOOL                                             ~21     ~33
         29    > > JMPNZ_EX                                         ~21     ~21, ->34
   47    30    >   FETCH_IS                                         ~34     '_POST'
         31        ISSET_ISEMPTY_DIM_OBJ                         0  ~35     ~34, 'comments'
         32        BOOL_NOT                                         ~36     ~35
         33        BOOL                                             ~21     ~36
         34    > > JMPZ                                                     ~21, ->38
   50    35    >   INIT_FCALL_BY_NAME                                       'died'
         36        SEND_VAL_EX                                              'We+are+sorry%2C+but+there+appears+to+be+a+problem+with+the+form+you+submitted.'
         37        DO_FCALL                                      0          
   56    38    >   FETCH_R                      global              ~38     '_POST'
         39        FETCH_DIM_R                                      ~39     ~38, 'first_last'
         40        ASSIGN                                                   !2, ~39
   58    41        FETCH_R                      global              ~41     '_POST'
         42        FETCH_DIM_R                                      ~42     ~41, 'office_phone'
         43        ASSIGN                                                   !3, ~42
   60    44        FETCH_R                      global              ~44     '_POST'
         45        FETCH_DIM_R                                      ~45     ~44, 'cell'
         46        ASSIGN                                                   !4, ~45
   62    47        FETCH_R                      global              ~47     '_POST'
         48        FETCH_DIM_R                                      ~48     ~47, 'email'
         49        ASSIGN                                                   !5, ~48
   64    50        FETCH_R                      global              ~50     '_POST'
         51        FETCH_DIM_R                                      ~51     ~50, 'company'
         52        ASSIGN                                                   !5, ~51
   66    53        FETCH_R                      global              ~53     '_POST'
         54        FETCH_DIM_R                                      ~54     ~53, 'comments'
         55        ASSIGN                                                   !6, ~54
   70    56        ASSIGN                                                   !7, ''
   72    57        ASSIGN                                                   !8, '%2F%5E%5BA-Za-z0-9._%25-%5D%2B%40%5BA-Za-z0-9.-%5D%2B%5C.%5BA-Za-z%5D%7B2%2C4%7D%24%2F'
   74    58        INIT_FCALL                                               'preg_match'
         59        SEND_VAR                                                 !8
         60        SEND_VAR                                                 !5
         61        DO_ICALL                                         $58     
         62        BOOL_NOT                                         ~59     $58
         63      > JMPZ                                                     ~59, ->65
   76    64    >   ASSIGN_OP                                     8          !7, 'The+Email+Address+you+entered+does+not+appear+to+be+valid.%3Cbr+%2F%3E'
   80    65    >   ASSIGN                                                   !9, '%2F%5E%5BA-Za-z+.%27-%5D%2B%24%2F'
   82    66        INIT_FCALL                                               'preg_match'
         67        SEND_VAR                                                 !9
         68        SEND_VAR                                                 !3
         69        DO_ICALL                                         $62     
         70        BOOL_NOT                                         ~63     $62
         71      > JMPZ                                                     ~63, ->73
   84    72    >   ASSIGN_OP                                     8          !7, 'The+First+Name+you+entered+does+not+appear+to+be+valid.%3Cbr+%2F%3E'
   88    73    >   INIT_FCALL                                               'preg_match'
         74        SEND_VAR                                                 !9
         75        SEND_VAR                                                 !10
         76        DO_ICALL                                         $65     
         77        BOOL_NOT                                         ~66     $65
         78      > JMPZ                                                     ~66, ->80
   90    79    >   ASSIGN_OP                                     8          !7, 'The+Last+Name+you+entered+does+not+appear+to+be+valid.%3Cbr+%2F%3E'
   94    80    >   STRLEN                                           ~68     !6
         81        IS_SMALLER                                               ~68, 2
         82      > JMPZ                                                     ~69, ->84
   96    83    >   ASSIGN_OP                                     8          !7, 'The+Comments+you+entered+do+not+appear+to+be+valid.%3Cbr+%2F%3E'
  100    84    >   STRLEN                                           ~71     !7
         85        IS_SMALLER                                               0, ~71
         86      > JMPZ                                                     ~72, ->90
  102    87    >   INIT_FCALL_BY_NAME                                       'died'
         88        SEND_VAR_EX                                              !7
         89        DO_FCALL                                      0          
  106    90    >   ASSIGN                                                   !5, 'Form+details+below.%0A%0A'
  110    91        DECLARE_FUNCTION                                         'clean_string'
  120    92        INIT_FCALL_BY_NAME                                       'clean_string'
         93        SEND_VAR_EX                                              !2
         94        DO_FCALL                                      0  $75     
         95        CONCAT                                           ~76     'First+Last+Name%3A+', $75
         96        CONCAT                                           ~77     ~76, '%0A'
         97        ASSIGN_OP                                     8          !11, ~77
  122    98        INIT_FCALL_BY_NAME                                       'clean_string'
         99        SEND_VAR_EX                                              !3
        100        DO_FCALL                                      0  $79     
        101        CONCAT                                           ~80     'Office+Phone%3A+', $79
        102        CONCAT                                           ~81     ~80, '%0A'
        103        ASSIGN_OP                                     8          !11, ~81
  124   104        INIT_FCALL_BY_NAME                                       'clean_string'
        105        SEND_VAR_EX                                              !4
        106        DO_FCALL                                      0  $83     
        107        CONCAT                                           ~84     'Cell%3A+', $83
        108        CONCAT                                           ~85     ~84, '%0A'
        109        ASSIGN_OP                                     8          !11, ~85
  126   110        INIT_FCALL_BY_NAME                                       'clean_string'
        111        SEND_VAR_EX                                              !5
        112        DO_FCALL                                      0  $87     
        113        CONCAT                                           ~88     'Email%3A+', $87
        114        CONCAT                                           ~89     ~88, '%0A'
        115        ASSIGN_OP                                     8          !11, ~89
  128   116        INIT_FCALL_BY_NAME                                       'clean_string'
        117        SEND_VAR_EX                                              !12
        118        DO_FCALL                                      0  $91     
        119        CONCAT                                           ~92     'Company%3A+', $91
        120        CONCAT                                           ~93     ~92, '%0A'
        121        ASSIGN_OP                                     8          !11, ~93
  130   122        INIT_FCALL_BY_NAME                                       'clean_string'
        123        SEND_VAR_EX                                              !6
        124        DO_FCALL                                      0  $95     
        125        CONCAT                                           ~96     'Comments%3A+', $95
        126        CONCAT                                           ~97     ~96, '%0A'
        127        ASSIGN_OP                                     8          !11, ~97
  138   128        CONCAT                                           ~99     'From%3A+', !14
        129        CONCAT                                           ~100    ~99, '%0D%0A'
  140   130        CONCAT                                           ~101    ~100, 'Reply-To%3A+'
        131        CONCAT                                           ~102    ~101, !14
        132        CONCAT                                           ~103    ~102, '%0D%0A'
  142   133        CONCAT                                           ~104    ~103, 'X-Mailer%3A+PHP%2F'
        134        INIT_FCALL                                               'phpversion'
        135        DO_ICALL                                         $105    
        136        CONCAT                                           ~106    ~104, $105
  138   137        ASSIGN                                                   !13, ~106
  144   138        BEGIN_SILENCE                                    ~108    
        139        INIT_FCALL                                               'mail'
        140        SEND_VAR                                                 !0
        141        SEND_VAR                                                 !1
        142        SEND_VAR                                                 !11
        143        SEND_VAR                                                 !13
        144        DO_ICALL                                                 
        145        END_SILENCE                                              ~108
  147   146        ECHO                                                     '+%0A+%0A+%0A%3C%21--+include+your+own+success+html+here+--%3E%0A+%0A+%0A+%0AThank+you+for+contacting+us.+We+will+be+in+touch+with+you+very+soon.%0A%0A'
  160   147    > > RETURN                                                   1

Function %00died%2Fin%2FhPFnj%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/hPFnj
function name:  died
number of ops:  8
compiled vars:  !0 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   21     1        ECHO                                                     'We+are+very+sorry%2C+but+there+were+error%28s%29+found+with+the+form+you+submitted.+'
   23     2        ECHO                                                     'These+errors+appear+below.%3Cbr+%2F%3E%3Cbr+%2F%3E'
   25     3        CONCAT                                           ~1      !0, '%3Cbr+%2F%3E%3Cbr+%2F%3E'
          4        ECHO                                                     ~1
   27     5        ECHO                                                     'Please+go+back+and+fix+these+errors.%3Cbr+%2F%3E%3Cbr+%2F%3E'
   29     6      > EXIT                                                     
   31     7*     > RETURN                                                   null

End of function %00died%2Fin%2FhPFnj%3A17%240

Function %00clean_string%2Fin%2FhPFnj%3A110%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hPFnj
function name:  clean_string
number of ops:  9
compiled vars:  !0 = $string, !1 = $bad
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   RECV                                             !0      
  112     1        ASSIGN                                                   !1, <array>
  114     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
  116     8*     > RETURN                                                   null

End of function %00clean_string%2Fin%2FhPFnj%3A110%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.67 ms | 1404 KiB | 21 Q