<?php
/*
    *****************************************************************************
    * MEGA Digital Space - by MEGA Digital Studio                               *
    * ------------------------------------------------------------------------- *
    * CMS Website:  https://megadigital.space                                   *
    * License:  https://megadigital.space/license                               *
    * Owner:  Giorgi Basharuli                                                  *
    * Contact:  online@megadigital.studio                                       *
    * MEGA Digital Studio – Official Development Studio for MEGA Digital Space  *
    * Website:  https://megadigital.studio                                      *
    * ------------------------------------------------------------------------- *
    * Description: This file is a part of the MEGA Digital Space CMS system.    *
    * Unauthorized distribution, modification, or commercial use is strictly -  *
    * prohibited without prior written permission.                              *
    * ------------------------------------------------------------------------- *
    * Copyright (c) 2023-2025 MEGA Digital Studio.                              *
    * All rights reserved.                                                      *
    *****************************************************************************
*/

require_once($_SERVER["DOCUMENT_ROOT"] . '/engine/data/config.php');
require_once($_SERVER["DOCUMENT_ROOT"] . "/engine/data/dbconfig.php");

global $db_connect;
/*
if (!empty($_POST["adminPass"]) && !empty($_POST["adminEmail"])) {
    $maxId = $db_connect->max("users", "id");
    $hashPass = password_hash($_POST["adminPass"], PASSWORD_DEFAULT);

    $existsUser = $db_connect->get("users", "email", ["email" => $_POST["adminEmail"]]);
    if (empty($existsUser)) {
        $db_connect->insert("users", [
            [
                "id" => $maxId + 1,
                "email" => $_POST["adminEmail"],
                "password" => $hashPass,
                "name" => explode("@", $_POST["adminEmail"])[0],
                "age" => 0,
                "gender" => 'Мужчина',
                "phone" => '',
                "city" => '',
                "balance" => 0.00,
                "avatar" => 'uploads/profiles/default.svg',
                "bg_image" => 'uploads/profiles/default-bg.jpg',
                "followers" => 0,
                "likes" => 0,
                "views" => 0,
                "bio" => '',
                "pay_methods" => '',
                "purchases" => 0,
                "sales" => 0,
                "lastdate" => '',
                "regdate" => date("Y-m-d H:i:s"),
                "banned" => 0,
                "allowpm" => 1,
                "allpm" => 0,
                "pmunread" => 0
            ],
        ]);

        $db_connect->insert("users_roles", [
           "user_id" => $maxId + 1,
           "role_id" => 2
        ]);
        return true;
    } else {
        echo "This admin already exists!";
    }

} else {
    echo "Admin email and password cannot be empty!";
}
*/
