3v4l.org

run code in 300+ PHP versions simultaneously
<?php //create short variable names $phonee=$_POST['Phone']; $nn="[a-zA-Z]"; $honda=1; $name = check_input($_POST['FirstName']); //run check_input function all all incoming data $fromEmail = check_input($_POST['Email']); $toaddress = "kcambridge@est-static.com"; //INITIAL VALIDATION //Function checks input and strips potential dangerous characters so injection code cannot be //interpereted correctly function check_input($data) { $data = trim($data); // strips any quotes escaped with slashes $data = stripslashes($data); //strips slashes $data = htmlspecialchars($data); //replaces HTML characters like > with HTML version &lt; return $data; } function isEmailValid($fromEmail) { $pattern = "^[_a-z0-9.-]+(\._a-z0-9.-+)*@[a-z0-9.-]+(\.[a-z0-9.-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern,$fromEmail)) { //eregi - case insensitive regular expression match return true; } else { return false; } } //FORM SUBMISSION VALIDATION //Scipt checks for new line characters like "\r" or "\n" which allows spam to create a new line //in email headers. If these characters are found return ERROR if (((!isEmailValid($fromEmail)) || ($fromEmail == "")|| (strlen($_POST["Phone"]) < 10 ) || preg_match("/$nn/",$phonee))) { echo "Error - From email address is Invalid or has been left blank or Phone number is not valid." . "<br/><br/>" . "Please return to form and re-enter a valid Email Address or phone number." . "<br/><br/>"; } else { $to = "kcambridge@est-static.com"; $subject = "Aegis Newsletter Signup"; $from = $_POST['Email']; $message =''. " \n"; foreach($_POST as $name => $data) { if(is_array($data)) { foreach($data as $datum) $message .= $name . ": " . $datum . " \n"; } else $message .= $name . ": " . $data . " \n"; } # Attempt to send email if(mail($to, $subject, $message, "From: $fromEmail")) header('location:thanks.htm'); else echo "Mail send failure - message not sent";} ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 47) Position 1 = 28, Position 2 = 33
Branch analysis from position: 28
2 jumps found. (Code = 47) Position 1 = 34, Position 2 = 42
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 45
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
2 jumps found. (Code = 77) Position 1 = 53, Position 2 = 71
Branch analysis from position: 53
2 jumps found. (Code = 78) Position 1 = 54, Position 2 = 71
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 66
Branch analysis from position: 57
2 jumps found. (Code = 77) Position 1 = 58, Position 2 = 64
Branch analysis from position: 58
2 jumps found. (Code = 78) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 64
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 85
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 85
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
Branch analysis from position: 42
Branch analysis from position: 33
Branch analysis from position: 27
filename:       /in/cn9nN
function name:  (null)
number of ops:  87
compiled vars:  !0 = $phonee, !1 = $nn, !2 = $honda, !3 = $name, !4 = $fromEmail, !5 = $toaddress, !6 = $to, !7 = $subject, !8 = $from, !9 = $message, !10 = $data, !11 = $datum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_R                      global              ~12     '_POST'
          1        FETCH_DIM_R                                      ~13     ~12, 'Phone'
          2        ASSIGN                                                   !0, ~13
    4     3        ASSIGN                                                   !1, '%5Ba-zA-Z%5D'
    5     4        ASSIGN                                                   !2, 1
    6     5        INIT_FCALL_BY_NAME                                       'check_input'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_FUNC_ARG               global              $17     '_POST'
          8        FETCH_DIM_FUNC_ARG                               $18     $17, 'FirstName'
          9        SEND_FUNC_ARG                                            $18
         10        DO_FCALL                                      0  $19     
         11        ASSIGN                                                   !3, $19
    7    12        INIT_FCALL_BY_NAME                                       'check_input'
         13        CHECK_FUNC_ARG                                           
         14        FETCH_FUNC_ARG               global              $21     '_POST'
         15        FETCH_DIM_FUNC_ARG                               $22     $21, 'Email'
         16        SEND_FUNC_ARG                                            $22
         17        DO_FCALL                                      0  $23     
         18        ASSIGN                                                   !4, $23
    8    19        ASSIGN                                                   !5, 'kcambridge%40est-static.com'
   36    20        INIT_FCALL                                               'isemailvalid'
         21        SEND_VAR                                                 !4
         22        DO_FCALL                                      0  $26     
         23        BOOL_NOT                                         ~27     $26
         24      > JMPNZ_EX                                         ~27     ~27, ->27
         25    >   IS_EQUAL                                         ~28     !4, ''
         26        BOOL                                             ~27     ~28
         27    > > JMPNZ_EX                                         ~27     ~27, ->33
         28    >   FETCH_R                      global              ~29     '_POST'
         29        FETCH_DIM_R                                      ~30     ~29, 'Phone'
         30        STRLEN                                           ~31     ~30
         31        IS_SMALLER                                       ~32     ~31, 10
         32        BOOL                                             ~27     ~32
         33    > > JMPNZ_EX                                         ~27     ~27, ->42
         34    >   INIT_FCALL                                               'preg_match'
         35        ROPE_INIT                                     3  ~34     '%2F'
         36        ROPE_ADD                                      1  ~34     ~34, !1
         37        ROPE_END                                      2  ~33     ~34, '%2F'
         38        SEND_VAL                                                 ~33
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                         $36     
         41        BOOL                                             ~27     $36
         42    > > JMPZ                                                     ~27, ->45
   37    43    >   ECHO                                                     'Error+-+From+email+address+is+Invalid+or+has+been+left+blank+or+Phone+number+is+not+valid.%3Cbr%2F%3E%3Cbr%2F%3EPlease+return+to+form+and+re-enter+a+valid+Email+Address+or+phone+number.%3Cbr%2F%3E%3Cbr%2F%3E'
         44      > JMP                                                      ->86
   42    45    >   ASSIGN                                                   !6, 'kcambridge%40est-static.com'
   43    46        ASSIGN                                                   !7, 'Aegis+Newsletter+Signup'
   44    47        FETCH_R                      global              ~39     '_POST'
         48        FETCH_DIM_R                                      ~40     ~39, 'Email'
         49        ASSIGN                                                   !8, ~40
   45    50        ASSIGN                                                   !9, '+%0A'
   47    51        FETCH_R                      global              ~43     '_POST'
         52      > FE_RESET_R                                       $44     ~43, ->71
         53    > > FE_FETCH_R                                       ~45     $44, !10, ->71
         54    >   ASSIGN                                                   !3, ~45
   49    55        TYPE_CHECK                                  128          !10
         56      > JMPZ                                                     ~47, ->66
   51    57    > > FE_RESET_R                                       $48     !10, ->64
         58    > > FE_FETCH_R                                               $48, !11, ->64
   52    59    >   CONCAT                                           ~49     !3, '%3A+'
         60        CONCAT                                           ~50     ~49, !11
         61        CONCAT                                           ~51     ~50, '+%0A'
         62        ASSIGN_OP                                     8          !9, ~51
   51    63      > JMP                                                      ->58
         64    >   FE_FREE                                                  $48
         65      > JMP                                                      ->70
   55    66    >   CONCAT                                           ~53     !3, '%3A+'
         67        CONCAT                                           ~54     ~53, !10
         68        CONCAT                                           ~55     ~54, '+%0A'
         69        ASSIGN_OP                                     8          !9, ~55
   47    70    > > JMP                                                      ->53
         71    >   FE_FREE                                                  $44
   59    72        INIT_FCALL                                               'mail'
         73        SEND_VAR                                                 !6
         74        SEND_VAR                                                 !7
         75        SEND_VAR                                                 !9
         76        NOP                                                      
         77        FAST_CONCAT                                      ~57     'From%3A+', !4
         78        SEND_VAL                                                 ~57
         79        DO_ICALL                                         $58     
         80      > JMPZ                                                     $58, ->85
   60    81    >   INIT_FCALL                                               'header'
         82        SEND_VAL                                                 'location%3Athanks.htm'
         83        DO_ICALL                                                 
         84      > JMP                                                      ->86
   62    85    >   ECHO                                                     'Mail+send+failure+-+message+not+sent'
   63    86    > > RETURN                                                   1

Function check_input:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cn9nN
function name:  check_input
number of ops:  15
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   14     5        INIT_FCALL                                               'stripslashes'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        ASSIGN                                                   !0, $3
   15     9        INIT_FCALL                                               'htmlspecialchars'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $5      
         12        ASSIGN                                                   !0, $5
   16    13      > RETURN                                                   !0
   17    14*     > RETURN                                                   null

End of function check_input

Function isemailvalid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cn9nN
function name:  isEmailValid
number of ops:  11
compiled vars:  !0 = $fromEmail, !1 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        ASSIGN                                                   !1, '%5E%5B_a-z0-9.-%5D%2B%28%5C._a-z0-9.-%2B%29%2A%40%5Ba-z0-9.-%5D%2B%28%5C.%5Ba-z0-9.-%5D%2B%29%2A%28%5C.%5Ba-z%5D%7B2%2C3%7D%29%24'
   22     2        INIT_FCALL_BY_NAME                                       'eregi'
          3        SEND_VAR_EX                                              !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6      > JMPZ                                                     $3, ->9
   23     7    > > RETURN                                                   <true>
          8*       JMP                                                      ->10
   26     9    > > RETURN                                                   <false>
   28    10*     > RETURN                                                   null

End of function isemailvalid

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.02 ms | 1411 KiB | 26 Q