3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); Class login { //protected $mod_id; //protected $mod_name; //protected $mod_password; //protected $mod_type; private $logged_status = false; //private $con = $this->db_connect(); public $status_message = ""; function __construct() { $this->runApplication(); //$this->mod_id = null; //$this->mod_name = null; //$this->mod_password = null; //$this->mod_type = null; } private function validate_inputs() { if (!empty($_POST['user_name']) && !empty($_POST['user_password'])) { return true; } elseif (empty($_POST['user_name'])) { $this->status_message = "Username field was empty."; } elseif (empty($_POST['user_password'])) { $this->status_message = "Password field was empty."; } // default return return false; } private function page_login_form() { if ($this->status_message) { echo $this->status_message . "<br/><br/>"; } echo '<h2>Login</h2>'; echo '<form method="post" action="' . $_SERVER['SCRIPT_NAME'] . '" name="loginform">'; echo '<label for="login_input_username">Username</label> '; echo '<input id="login_input_username" type="text" name="user_name" required /> '; echo '<label for="login_input_password">Password</label> '; echo '<input id="login_input_password" type="password" name="user_password" required /> '; echo '<input type="submit" name="login" value="Log in" />'; echo '</form>'; } public function get_login_status() { return $this->logged_status; } private function verify_password_and_login() { return true; } public function runApplication() { session_start(); $this->page_login_form(); } private function logout() { $_SESSION = array(); session_destroy(); $this->logged_in = false; $this->status_message= "You were just logged out."; } } $application = new login(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/papAH
function name:  (null)
number of ops:  11
compiled vars:  !0 = $application
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    3     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 'On'
          6        DO_ICALL                                                 
   73     7        NEW                                              $3      'login'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !0, $3
   77    10      > RETURN                                                   1

Class login:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/papAH
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_METHOD_CALL                                         'runApplication'
          1        DO_FCALL                                      0          
   22     2      > RETURN                                                   null

End of function __construct

Function validate_inputs:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 8
filename:       /in/papAH
function name:  validate_inputs
number of ops:  24
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_IS                                         ~0      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         1  ~1      ~0, 'user_name'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ_EX                                          ~2      ~2, ->8
          4    >   FETCH_IS                                         ~3      '_POST'
          5        ISSET_ISEMPTY_DIM_OBJ                         1  ~4      ~3, 'user_password'
          6        BOOL_NOT                                         ~5      ~4
          7        BOOL                                             ~2      ~5
          8    > > JMPZ                                                     ~2, ->11
   26     9    > > RETURN                                                   <true>
         10*       JMP                                                      ->22
   27    11    >   FETCH_IS                                         ~6      '_POST'
         12        ISSET_ISEMPTY_DIM_OBJ                         1          ~6, 'user_name'
         13      > JMPZ                                                     ~7, ->17
   28    14    >   ASSIGN_OBJ                                               'status_message'
         15        OP_DATA                                                  'Username+field+was+empty.'
         16      > JMP                                                      ->22
   29    17    >   FETCH_IS                                         ~9      '_POST'
         18        ISSET_ISEMPTY_DIM_OBJ                         1          ~9, 'user_password'
         19      > JMPZ                                                     ~10, ->22
   30    20    >   ASSIGN_OBJ                                               'status_message'
         21        OP_DATA                                                  'Password+field+was+empty.'
   33    22    > > RETURN                                                   <false>
   34    23*     > RETURN                                                   null

End of function validate_inputs

Function page_login_form:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/papAH
function name:  page_login_form
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   FETCH_OBJ_R                                      ~0      'status_message'
          1      > JMPZ                                                     ~0, ->5
   38     2    >   FETCH_OBJ_R                                      ~1      'status_message'
          3        CONCAT                                           ~2      ~1, '%3Cbr%2F%3E%3Cbr%2F%3E'
          4        ECHO                                                     ~2
   40     5    >   ECHO                                                     '%3Ch2%3ELogin%3C%2Fh2%3E'
   42     6        FETCH_R                      global              ~3      '_SERVER'
          7        FETCH_DIM_R                                      ~4      ~3, 'SCRIPT_NAME'
          8        CONCAT                                           ~5      '%3Cform+method%3D%22post%22+action%3D%22', ~4
          9        CONCAT                                           ~6      ~5, '%22+name%3D%22loginform%22%3E'
         10        ECHO                                                     ~6
   43    11        ECHO                                                     '%3Clabel+for%3D%22login_input_username%22%3EUsername%3C%2Flabel%3E+'
   44    12        ECHO                                                     '%3Cinput+id%3D%22login_input_username%22+type%3D%22text%22+name%3D%22user_name%22+required+%2F%3E+'
   45    13        ECHO                                                     '%3Clabel+for%3D%22login_input_password%22%3EPassword%3C%2Flabel%3E+'
   46    14        ECHO                                                     '%3Cinput+id%3D%22login_input_password%22+type%3D%22password%22+name%3D%22user_password%22+required+%2F%3E+'
   47    15        ECHO                                                     '%3Cinput+type%3D%22submit%22+name%3D%22login%22+value%3D%22Log+in%22+%2F%3E'
   48    16        ECHO                                                     '%3C%2Fform%3E'
   49    17      > RETURN                                                   null

End of function page_login_form

Function get_login_status:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/papAH
function name:  get_login_status
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   FETCH_OBJ_R                                      ~0      'logged_status'
          1      > RETURN                                                   ~0
   54     2*     > RETURN                                                   null

End of function get_login_status

Function verify_password_and_login:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/papAH
function name:  verify_password_and_login
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E > > RETURN                                                   <true>
   58     1*     > RETURN                                                   null

End of function verify_password_and_login

Function runapplication:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/papAH
function name:  runApplication
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   INIT_FCALL                                               'session_start'
          1        DO_ICALL                                                 
   62     2        INIT_METHOD_CALL                                         'page_login_form'
          3        DO_FCALL                                      0          
   63     4      > RETURN                                                   null

End of function runapplication

Function logout:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/papAH
function name:  logout
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   66     0  E >   FETCH_W                      global              $0      '_SESSION'
          1        ASSIGN                                                   $0, <array>
   67     2        INIT_FCALL                                               'session_destroy'
          3        DO_ICALL                                                 
   68     4        ASSIGN_OBJ                                               'logged_in'
          5        OP_DATA                                                  <false>
   69     6        ASSIGN_OBJ                                               'status_message'
          7        OP_DATA                                                  'You+were+just+logged+out.'
   70     8      > RETURN                                                   null

End of function logout

End of class login.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.75 ms | 1404 KiB | 21 Q