AutoPulse v 1.0.1
 
Loading...
Searching...
No Matches
C:/Users/ivans/OneDrive/Документы/ZWA/sem/approve-admin_rights.php File Reference

This script handles the approval of a user request for admin rights by updating the value of admin column in users database. More...

Functions

 terminateApproveAdminWithError ($errorParam)
 

Variables

if(isset($error)) try
 

Detailed Description

This script handles the approval of a user request for admin rights by updating the value of admin column in users database.

Connects to the database and updates the admin column value for the record of user, whose id is provided as a parameter of GET request. In case of success, redirects back to the page displaying all the user requests for admin rights. Terminates in case of connection- or update- error and redirects to the main page with an error context info as a parameter of the redirecting GET request.

Function Documentation

◆ terminateApproveAdminWithError()

terminateApproveAdminWithError ( $errorParam)

Redirects to the index page with an error parameter.

Parameters
string$errorParamThe error parameter to append to the URL.

Handle errors during the SQL execution by redirecting with an error message.

Variable Documentation

◆ try

if (isset( $error)) try
Initial value:
{
$stmt = $pdo->prepare("
UPDATE users
SET
admin = 1
WHERE id = :id
")
if(! $user) catch(PDOException $e) $pdo
Definition myprofile.php:59
if(! $userExists) $stmt
Definition process-accountDelete.php:48

Check if there is an error, and terminate with an appropriate error message.