<?php
/********************************************************/
/* NSN Your Account                                     */
/* By: NukeScripts Network (webmaster@nukescripts.fr)   */
/* http://www.nukescripts.fr                            */
/* Copyright  2000-2004 by NukeScripts Network         */
/* ==================================================== */
/* Based from:                                          */
/* NSN YAT 320 from www.nukescripts.net                 */
/* Based from:                                          */
/* PHP-NUKE: Web Portal System                          */
/********************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
global $prefix, $db, $admin_file;
if (!stristr($_SERVER['SCRIPT_NAME'], "".$admin_file.".php")) { die ("Access Denied"); }
$row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".TABLE_MODULES." WHERE title='Your_Account'"));
$row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".TABLE_AUTHORS." WHERE aid='$aid'"));
$admins = explode(",", $row['admins']);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
    if ($row2['name'] == "$admins[$i]" AND $row['admins'] != "") {
        $auth_user = 1;
    }
}
if ($row2['radminsuper'] == 1 ) {


    $num = $db->sql_numrows($db->sql_query("SELECT * FROM ".TABLE_AUTHORS." WHERE aid='$add_aid'"));
    if ($num > 0) {
        $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
        incoh();
        title(_USERADMIN." - "._PROMOTEUSER);
        amain();
        br('1');
        Max_OpenTable();
        echo "<center><b>"._NAMEERROR."<b></center><br />";
        Max_CloseTable();
        incof();
    } else {
        $result = $db->sql_query("INSERT INTO ".TABLE_AUTHORS." (aid, name, url, email, pwd, counter, radminsuper, admlanguage) VALUES ('$add_aid', '$add_name', '$add_url', '$add_email', '$add_password', '0', '0', '')");
        if (!$result) {
            $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
            incoh();
            title(_USERADMIN." - "._PROMOTEUSER);
            amain();
            br('1');
            Max_OpenTable();
            echo "<center><b>"._ADDERROR."<b></center><br />";
            Max_CloseTable();
            incof();
        } else {
            $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
            incoh();
            title(_USERADMIN." - "._PROMOTEUSER);
            amain();
            br('1');
            Max_OpenTable();
            echo "<center><b>"._USERPROMOTED."<b></center>";
            Max_CloseTable();
            incof();
            if ($ya_config['servermail'] == 0) {
                $message = _SORRYTO." $sitename "._HASPROMOTE;
                $subject = _ACCTPROMOTE;
                $from  = "From: $adminmail\r\n";
                $from .= "Reply-To: $adminmail\r\n";
                $from .= "Return-Path: $adminmail\r\n";
                mail($add_email, $subject, $message, $from);
            }
        }
        if ($add_radminforum == "1") { $db->sql_query("UPDATE ".TABLE_USERS." SET user_level='2' WHERE user_id='$chng_uid'"); }
    }
}