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

This script handles reflecting in the database the fact that the user has requested for the admin rights. More...

Functions

 terminateARRWithError ($errorParam)
 

Variables

if(isset($error) && $error==="db_access_failed") try
 
 $userExists = $stmt->fetchColumn()
 
if(! $userExists) $stmt
 

Detailed Description

This script handles reflecting in the database the fact that the user has requested for the admin rights.

Connects to the database. Checks if there exists a record in 'users' table with id equal to the one set in $_SESSION['user_id']. If true, updates the value of 'admin_requested' column to 'true' and redirects back user profile page. Terminates and redirects to the main page in case of error with error context provided as a parameter of the redirecting GET request.

Function Documentation

◆ terminateARRWithError()

terminateARRWithError ( $errorParam)

Redirects to the index page with a specified error parameter and terminates the script.

Parameters
string$errorParamThe error parameter to be appended to the URL.

Variable Documentation

◆ $stmt

if (! $userExists) $stmt
Initial value:
= $pdo->prepare("
UPDATE users
SET
admin_requested = :admin_requested
WHERE id = :id
")
if(! $user) catch(PDOException $e) $pdo
Definition myprofile.php:59

◆ $userExists

$userExists = $stmt->fetchColumn()

◆ try

if (isset( $error) &&$error==="db_access_failed") try
Initial value:
{
$stmt = $pdo->prepare("SELECT COUNT(*) FROM users WHERE id = :user_id")
if(! $userExists) $stmt
Definition process-accountDelete.php:48

Check if there was a database access error and terminate the request if so.