This scripts handles displaying user his profile with some account managing interface.
More...
This scripts handles displaying user his profile with some account managing interface.
Checks if the $_SESSION['user_id'] is set as this functionality is only available to the authorized users. Connects to the database. Checks if there exists a record with id equal to the one set in $_SESSION['user_id']. If true, retrieves the whole user record from the 'users' table of the database and displays them. User first_name and last_name are displayed for the users of type 'private'. User 'company_name' is displayed for the users of type 'company' instead. Displays buttons that enable users to edit their account data or delete their account. For the users of type 'private', there's also a button that enables to make a request for admin rights, which is active and clickable, if the value of 'admin_requested' column for the current user is false. Terminates and redirects to the main page in case of error with error context provided as a parameter of the redirecting GET request.