<?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;
$aid = substr("$aid", 0,25);
$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 ) {


$sql1 = "SELECT username, user_email, user_password, user_regdate FROM ".TABLE_USERS_TEMP." WHERE user_id='$apr_uid'";
if ( !($result1 = $db->sql_query($sql1)) )
{ query_die(GENERAL_ERROR, 'Could not obtain _users_temp', '', __LINE__, __FILE__, $sql1);}
$raw1 = $db->sql_fetchrow($result1);
$uname = stripslashes($raw1['username']);
$email = stripslashes($raw1['user_email']);
$upass = stripslashes($raw1['user_password']);
$ureg = $raw1['user_regdate'];


    if ($ya_config['servermail'] == 0) {
        $message = _SORRYTO." $sitename "._HASAPPROVE;
        $subject = _ACCTAPPROVE;
        $from  = "From: $adminmail\r\n";
        $from .= "Reply-To: $adminmail\r\n";
        $from .= "Return-Path: $adminmail\r\n";
        mail($email, $subject, $message, $from);
    }
    $db->sql_query("DELETE FROM ".TABLE_USERS_TEMP." WHERE user_id='$apr_uid'");
    $db->sql_query("OPTIMIZE TABLE ".TABLE_USERS_TEMP."");
    $raw2 = $db->sql_fetchrow($db->sql_query("SELECT max(user_id) AS newest_uid FROM ".TABLE_USERS.""));
    $newest_uid = $db->XMFnum($raw2['newest_uid']);
    if ($newest_uid == "-1") { $new_uid = 1; } else { $new_uid = $newest_uid+1; }
    $db->sql_query("INSERT INTO ".TABLE_USERS." (user_id, name, username, user_email, user_regdate, user_password, user_level, user_active, user_avatar, user_avatar_type, user_from) VALUES ('$new_uid', '$uname', '$uname', '$email', '$ureg', '$upass', 1, 1, 'gallery/blank.gif', 3, 'Unknown')");
    $pagetitle = ": "._USERADMIN." - "._ACCTAPPROVE;
    incoh();
    amain();
    br('1');
    Max_OpenTable();
    echo "<center><table align='center' border='0' cellpadding='2' cellspacing='2'>\n"
        ."<form action='".$admin_file.".php?op=members' method='post'>\n";
    if (isset($query)) { echo "<input type='hidden' name='query' value='$query'>\n"; }
    if (isset($min)) { echo "<input type='hidden' name='min' value='$min'>\n"; }
    if (isset($xop)) { echo "<input type='hidden' name='op' value='$xop'>\n"; }
    echo "<tr><td align='center'><b>"._ACCTAPPROVE."</b></td></tr>\n"
        ."<tr><td align='center'><input type='submit' value='"._RETURN2."'></td></tr>\n"
        ."</form>\n"
        ."</table></center>\n";
    Max_CloseTable();
    incof();

}