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

This script handles the decline of user requests for admin rights by updating the value of admin column in users database. More...

Functions

 terminateDeclineAdminWithError ($errorParam)
 

Variables

if(isset($error)) try
 

Detailed Description

This script handles the decline of user requests for admin rights by updating the value of admin column in users database.

Connects to the database and updates the value of 'admin_requested' column of 'users' table of the database back 0, thus giving back the ability to the user to make another request for the admin rights. The 'admin' column value (0) stays unchanged, as the request for the admin rights is declined in this case. 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

◆ terminateDeclineAdminWithError()

terminateDeclineAdminWithError ( $errorParam)

Redirects the user to a specified location with an error parameter.

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

Handles PDO exceptions by redirecting with an error parameter.

Variable Documentation

◆ try

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

Checks if an error occurred during database connection and redirects with an error parameter.