3v4l.org

run code in 300+ PHP versions simultaneously
<?php mysql_connect('hote','utilisateur','mot_de_passe'); mysql_select_db('base_de_donnee'); //On determine l'expression a rechercher if(isset($_GET['recherche'])) { $rec = htmlentities($_GET['recherche']); } else { $rec = 'php MYSQL'; } //On determine le type de recherche if(isset($_GET['type'])) { if($_GET['type']=='un')//Un des mots { $type = 1; } elseif($_GET['type']=='tout')//Tout les mots { $type = 2; } else//L'expression exacte { $type = 3; } } else { $type = 1;//type par defaut: L'expression exacte } //On determine si on doit surligner les mots dans les resultats if(!isset($_GET['surligner']) or $_GET['surligner']!='true') { $surligner = false; } else { $surligner = true; } //On dertermine les identifiants, les noms et les informations des utilisateur $req = 'SELECT id, nom, infos FROM utilisateurs WHERE '; if($type==1) {//ayant un des mots dans leurs informations $mots = explode(' ',$rec);//En separre lexpression en mots cles foreach($mots as $mot) { $req .= ' infos LIKE "%'.$mot.'%" OR'; } $req .= ' 1=0'; } elseif($type==2) {//ayant tout des mots dans leurs informations $mots = explode(' ',$rec);//En separre lexpression en mots cles foreach($mots as $mot) { $req .= ' infos LIKE "%'.$mot.'%" AND'; } $req .= ' 1=1'; } else {//ayant l'expression exacte dans leurs informations $req .= 'infos LIKE "%'.$rec.'%"'; } //Les utilisateur seront ranges par identifiant en ordre croissant $req .= ' order by id asc'; $requete = mysql_query($req); //Le formulaire de recherche ?> <form action="" method="get"> Expression &agrave; rechercher: <input type="text" name="recherche" value="<?php echo $rec; ?>" /><br /> Type de recherche: <input type="radio" name="type" value="un"<?php if($type==1){echo 'checked="checked"';} ?> /> Un des mots <input type="radio" name="type" value="tout"<?php if($type==2){echo 'checked="checked"';} ?> /> Tout les mots <input type="radio" name="type" value="exacte"<?php if($type==3){echo 'checked="checked"';} ?> /> Expression exacte<br /> Mettre en gras les mots recherch&eacute;s: <input type="checkbox" name="surligner" value="true" <?php if($surligner){echo 'checked="checked"';} ?> /><br /> <input type="submit" value="Rechercher" /> </form> <h2>R&eacute;sultats</h2> <table> <tr> <th>Identifiant</th> <th>Nom</th> <th>Informations</th> </tr> <?php //On affiche les resultats while($dnn = mysql_fetch_array($requete)) { ?> <tr> <td><?php echo $dnn['id']; ?></td> <td><?php echo $dnn['nom']; ?></td> <td><?php if($surligner)//Si il faut surligner les mots, on les surligne { if($type==3) { echo preg_replace('#('.preg_quote($rec).')#i', '<strong>$1</strong>', $dnn['infos']);//On surligne l'expression exacte } else { echo preg_replace('#('.str_replace(' ','|',preg_quote($rec)).')#i', '<strong>$1</strong>', $dnn['infos']);//On surligne les mots cles de la recherche } } else { echo $dnn['infos'];//On ne surligne pas } ?></td> </tr> <?php } ?> </table>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 36
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 47) Position 1 = 41, Position 2 = 45
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 66
Branch analysis from position: 52
2 jumps found. (Code = 77) Position 1 = 58, Position 2 = 63
Branch analysis from position: 58
2 jumps found. (Code = 78) Position 1 = 59, Position 2 = 63
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 96
Branch analysis from position: 95
2 jumps found. (Code = 43) Position 1 = 99, Position 2 = 100
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 103, Position 2 = 104
Branch analysis from position: 103
2 jumps found. (Code = 43) Position 1 = 106, Position 2 = 107
Branch analysis from position: 106
1 jumps found. (Code = 42) Position 1 = 153
Branch analysis from position: 153
2 jumps found. (Code = 44) Position 1 = 158, Position 2 = 109
Branch analysis from position: 158
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 109
2 jumps found. (Code = 43) Position 1 = 117, Position 2 = 150
Branch analysis from position: 117
2 jumps found. (Code = 43) Position 1 = 119, Position 2 = 132
Branch analysis from position: 119
1 jumps found. (Code = 42) Position 1 = 149
Branch analysis from position: 149
1 jumps found. (Code = 42) Position 1 = 152
Branch analysis from position: 152
2 jumps found. (Code = 44) Position 1 = 158, Position 2 = 109
Branch analysis from position: 158
Branch analysis from position: 109
Branch analysis from position: 132
1 jumps found. (Code = 42) Position 1 = 152
Branch analysis from position: 152
Branch analysis from position: 150
2 jumps found. (Code = 44) Position 1 = 158, Position 2 = 109
Branch analysis from position: 158
Branch analysis from position: 109
Branch analysis from position: 107
Branch analysis from position: 104
Branch analysis from position: 100
Branch analysis from position: 96
Branch analysis from position: 63
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 82
Branch analysis from position: 68
2 jumps found. (Code = 77) Position 1 = 74, Position 2 = 79
Branch analysis from position: 74
2 jumps found. (Code = 78) Position 1 = 75, Position 2 = 79
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
Branch analysis from position: 79
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
Branch analysis from position: 79
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 96
Branch analysis from position: 95
Branch analysis from position: 96
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 66
Branch analysis from position: 52
Branch analysis from position: 66
Branch analysis from position: 45
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 36
2 jumps found. (Code = 47) Position 1 = 41, Position 2 = 45
Branch analysis from position: 41
Branch analysis from position: 45
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 36
Branch analysis from position: 22
Branch analysis from position: 36
filename:       /in/aHluc
function name:  (null)
number of ops:  160
compiled vars:  !0 = $rec, !1 = $type, !2 = $surligner, !3 = $req, !4 = $mots, !5 = $mot, !6 = $requete, !7 = $dnn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL_BY_NAME                                       'mysql_connect'
          1        SEND_VAL_EX                                              'hote'
          2        SEND_VAL_EX                                              'utilisateur'
          3        SEND_VAL_EX                                              'mot_de_passe'
          4        DO_FCALL                                      0          
    3     5        INIT_FCALL_BY_NAME                                       'mysql_select_db'
          6        SEND_VAL_EX                                              'base_de_donnee'
          7        DO_FCALL                                      0          
    5     8        FETCH_IS                                         ~10     '_GET'
          9        ISSET_ISEMPTY_DIM_OBJ                         0          ~10, 'recherche'
         10      > JMPZ                                                     ~11, ->18
    7    11    >   INIT_FCALL                                               'htmlentities'
         12        FETCH_R                      global              ~12     '_GET'
         13        FETCH_DIM_R                                      ~13     ~12, 'recherche'
         14        SEND_VAL                                                 ~13
         15        DO_ICALL                                         $14     
         16        ASSIGN                                                   !0, $14
         17      > JMP                                                      ->19
   11    18    >   ASSIGN                                                   !0, 'php+MYSQL'
   14    19    >   FETCH_IS                                         ~17     '_GET'
         20        ISSET_ISEMPTY_DIM_OBJ                         0          ~17, 'type'
         21      > JMPZ                                                     ~18, ->36
   16    22    >   FETCH_R                      global              ~19     '_GET'
         23        FETCH_DIM_R                                      ~20     ~19, 'type'
         24        IS_EQUAL                                                 ~20, 'un'
         25      > JMPZ                                                     ~21, ->28
   18    26    >   ASSIGN                                                   !1, 1
         27      > JMP                                                      ->35
   20    28    >   FETCH_R                      global              ~23     '_GET'
         29        FETCH_DIM_R                                      ~24     ~23, 'type'
         30        IS_EQUAL                                                 ~24, 'tout'
         31      > JMPZ                                                     ~25, ->34
   22    32    >   ASSIGN                                                   !1, 2
         33      > JMP                                                      ->35
   26    34    >   ASSIGN                                                   !1, 3
         35    > > JMP                                                      ->37
   31    36    >   ASSIGN                                                   !1, 1
   34    37    >   FETCH_IS                                         ~29     '_GET'
         38        ISSET_ISEMPTY_DIM_OBJ                         0  ~30     ~29, 'surligner'
         39        BOOL_NOT                                         ~31     ~30
         40      > JMPNZ_EX                                         ~31     ~31, ->45
         41    >   FETCH_R                      global              ~32     '_GET'
         42        FETCH_DIM_R                                      ~33     ~32, 'surligner'
         43        IS_NOT_EQUAL                                     ~34     ~33, 'true'
         44        BOOL                                             ~31     ~34
         45    > > JMPZ                                                     ~31, ->48
   36    46    >   ASSIGN                                                   !2, <false>
         47      > JMP                                                      ->49
   40    48    >   ASSIGN                                                   !2, <true>
   43    49    >   ASSIGN                                                   !3, 'SELECT+id%2C+nom%2C+infos+FROM+utilisateurs+WHERE+'
   44    50        IS_EQUAL                                                 !1, 1
         51      > JMPZ                                                     ~38, ->66
   46    52    >   INIT_FCALL                                               'explode'
         53        SEND_VAL                                                 '+'
         54        SEND_VAR                                                 !0
         55        DO_ICALL                                         $39     
         56        ASSIGN                                                   !4, $39
   47    57      > FE_RESET_R                                       $41     !4, ->63
         58    > > FE_FETCH_R                                               $41, !5, ->63
   49    59    >   CONCAT                                           ~42     '+infos+LIKE+%22%25', !5
         60        CONCAT                                           ~43     ~42, '%25%22+OR'
         61        ASSIGN_OP                                     8          !3, ~43
   47    62      > JMP                                                      ->58
         63    >   FE_FREE                                                  $41
   51    64        ASSIGN_OP                                     8          !3, '+1%3D0'
         65      > JMP                                                      ->85
   53    66    >   IS_EQUAL                                                 !1, 2
         67      > JMPZ                                                     ~46, ->82
   55    68    >   INIT_FCALL                                               'explode'
         69        SEND_VAL                                                 '+'
         70        SEND_VAR                                                 !0
         71        DO_ICALL                                         $47     
         72        ASSIGN                                                   !4, $47
   56    73      > FE_RESET_R                                       $49     !4, ->79
         74    > > FE_FETCH_R                                               $49, !5, ->79
   58    75    >   CONCAT                                           ~50     '+infos+LIKE+%22%25', !5
         76        CONCAT                                           ~51     ~50, '%25%22+AND'
         77        ASSIGN_OP                                     8          !3, ~51
   56    78      > JMP                                                      ->74
         79    >   FE_FREE                                                  $49
   60    80        ASSIGN_OP                                     8          !3, '+1%3D1'
         81      > JMP                                                      ->85
   64    82    >   CONCAT                                           ~54     'infos+LIKE+%22%25', !0
         83        CONCAT                                           ~55     ~54, '%25%22'
         84        ASSIGN_OP                                     8          !3, ~55
   67    85    >   ASSIGN_OP                                     8          !3, '+order+by+id+asc'
   68    86        INIT_FCALL_BY_NAME                                       'mysql_query'
         87        SEND_VAR_EX                                              !3
         88        DO_FCALL                                      0  $58     
         89        ASSIGN                                                   !6, $58
   71    90        ECHO                                                     '%3Cform+action%3D%22%22+method%3D%22get%22%3E%0AExpression+%26agrave%3B+rechercher%3A+%3Cinput+type%3D%22text%22+name%3D%22recherche%22+value%3D%22'
   72    91        ECHO                                                     !0
         92        ECHO                                                     '%22+%2F%3E%3Cbr+%2F%3E%0AType+de+recherche%3A+%3Cinput+type%3D%22radio%22+name%3D%22type%22+value%3D%22un%22'
   73    93        IS_EQUAL                                                 !1, 1
         94      > JMPZ                                                     ~60, ->96
         95    >   ECHO                                                     'checked%3D%22checked%22'
         96    >   ECHO                                                     '+%2F%3E+Un+des+mots+%3Cinput+type%3D%22radio%22+name%3D%22type%22+value%3D%22tout%22'
         97        IS_EQUAL                                                 !1, 2
         98      > JMPZ                                                     ~61, ->100
         99    >   ECHO                                                     'checked%3D%22checked%22'
        100    >   ECHO                                                     '+%2F%3E+Tout+les+mots+%3Cinput+type%3D%22radio%22+name%3D%22type%22+value%3D%22exacte%22'
        101        IS_EQUAL                                                 !1, 3
        102      > JMPZ                                                     ~62, ->104
        103    >   ECHO                                                     'checked%3D%22checked%22'
        104    >   ECHO                                                     '+%2F%3E+Expression+exacte%3Cbr+%2F%3E%0AMettre+en+gras+les+mots+recherch%26eacute%3Bs%3A+%3Cinput+type%3D%22checkbox%22+name%3D%22surligner%22+value%3D%22true%22+'
   74   105      > JMPZ                                                     !2, ->107
        106    >   ECHO                                                     'checked%3D%22checked%22'
        107    >   ECHO                                                     '+%2F%3E%3Cbr+%2F%3E%0A%3Cinput+type%3D%22submit%22+value%3D%22Rechercher%22+%2F%3E%0A%3C%2Fform%3E%0A%3Ch2%3ER%26eacute%3Bsultats%3C%2Fh2%3E%0A%3Ctable%3E%0A++++++++%3Ctr%3E%0A++++++++++++++++%3Cth%3EIdentifiant%3C%2Fth%3E%0A++++++++++++++++%3Cth%3ENom%3C%2Fth%3E%0A++++++++++++++++%3Cth%3EInformations%3C%2Fth%3E%0A++++++++%3C%2Ftr%3E%0A'
   86   108      > JMP                                                      ->153
   89   109    >   ECHO                                                     '++++++++%3Ctr%3E%0A++++++++++++++++%3Ctd%3E'
   90   110        FETCH_DIM_R                                      ~63     !7, 'id'
        111        ECHO                                                     ~63
        112        ECHO                                                     '%3C%2Ftd%3E%0A++++++++++++++++%3Ctd%3E'
   91   113        FETCH_DIM_R                                      ~64     !7, 'nom'
        114        ECHO                                                     ~64
        115        ECHO                                                     '%3C%2Ftd%3E%0A++++++++++++++++%3Ctd%3E'
   93   116      > JMPZ                                                     !2, ->150
   95   117    >   IS_EQUAL                                                 !1, 3
        118      > JMPZ                                                     ~65, ->132
   97   119    >   INIT_FCALL                                               'preg_replace'
        120        INIT_FCALL                                               'preg_quote'
        121        SEND_VAR                                                 !0
        122        DO_ICALL                                         $66     
        123        CONCAT                                           ~67     '%23%28', $66
        124        CONCAT                                           ~68     ~67, '%29%23i'
        125        SEND_VAL                                                 ~68
        126        SEND_VAL                                                 '%3Cstrong%3E%241%3C%2Fstrong%3E'
        127        FETCH_DIM_R                                      ~69     !7, 'infos'
        128        SEND_VAL                                                 ~69
        129        DO_ICALL                                         $70     
        130        ECHO                                                     $70
        131      > JMP                                                      ->149
  101   132    >   INIT_FCALL                                               'preg_replace'
        133        INIT_FCALL                                               'str_replace'
        134        SEND_VAL                                                 '+'
        135        SEND_VAL                                                 '%7C'
        136        INIT_FCALL                                               'preg_quote'
        137        SEND_VAR                                                 !0
        138        DO_ICALL                                         $71     
        139        SEND_VAR                                                 $71
        140        DO_ICALL                                         $72     
        141        CONCAT                                           ~73     '%23%28', $72
        142        CONCAT                                           ~74     ~73, '%29%23i'
        143        SEND_VAL                                                 ~74
        144        SEND_VAL                                                 '%3Cstrong%3E%241%3C%2Fstrong%3E'
        145        FETCH_DIM_R                                      ~75     !7, 'infos'
        146        SEND_VAL                                                 ~75
        147        DO_ICALL                                         $76     
        148        ECHO                                                     $76
        149    > > JMP                                                      ->152
  106   150    >   FETCH_DIM_R                                      ~77     !7, 'infos'
        151        ECHO                                                     ~77
  108   152    >   ECHO                                                     '%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A'
   86   153    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_array'
        154        SEND_VAR_EX                                              !6
        155        DO_FCALL                                      0  $78     
        156        ASSIGN                                           ~79     !7, $78
        157      > JMPNZ                                                    ~79, ->109
  113   158    >   ECHO                                                     '%3C%2Ftable%3E'
        159      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.7 ms | 1412 KiB | 23 Q