$std->Error("Fare il login prima di convertire l'utente");
}
$IDENTIFICATORE = md5($_SESSION[$SNAME]['sess_password'] . $_SESSION[$SNAME]['sess_nick']);
// = identificatore dell'utente nella tabella localmember. easadecimale
$KEY_DECRYPT = pack('H*', md5($_SESSION[$SNAME]['sess_nick'] . $_SESSION[$SNAME]['sess_password']));
// = password per decriptare la chiave privata in localmember (16byte)
$query = "SELECT PASSWORD FROM " . $SNAME . "_localmember WHERE HASH='{$IDENTIFICATORE}';";
$password = $db->get_var($query);
if (!$password) {
    $std->Error("niente password");
} else {
    $privkey = base64_decode($password);
}
$req[FUNC][BlowDump2var][Key] = $KEY_DECRYPT;
$req[FUNC][BlowDump2var][Data] = $privkey;
$core = new CoreSock();
if (!$core->Send($req)) {
    $std->Error("Error sending data to the core");
}
if (!($risp = $core->Read())) {
    $std->Error("Error receiving data from the core");
}
$oldprivkey = $risp[FUNC][BlowDump2var];
if (!$oldprivkey) {
    $std->Error("Error receiving data from the core, aborting.");
}
$query = "SELECT hash FROM {$SNAME}_membri WHERE PKEYDEC='" . $oldprivkey['private']['_n'] . "';";
$userhash = $db->get_var($query);
if (empty($userhash)) {
    $std->Error("User not found!");
}
Example #2
0
    ?>
</p>
     </div>
     <table cellspacing="1">
       <tr>
	<th align="right" colspan="2">&nbsp;
	</th>
       </tr>
       <tr>
	   	   <!-- BEGIN Nodi connessi -->
	<td class="formsubtitle" colspan="2"><img src='img/connect.gif' alt=''>&nbsp;
        <?php 
    $idquery = "SELECT value FROM config WHERE MAIN_GROUP='SHARE' AND SUBKEY='" . $SNAME . "' AND FKEY='ID';";
    $idriga = $db->get_var($idquery);
    $req_nod[INFO][FORUM][0] = @pack("H*", $idriga);
    $core = new CoreSock();
    if (!@$core->Connect()) {
        echo "<font color=red>Core offline!</font>";
    } else {
        $core->Send($req_nod);
        if (!($risposta = $core->Read())) {
            echo "<font color=red>" . ($lang['timeout'] . "</font><br>");
        } else {
            if (!$risposta[INFO][FORUM][$req_nod[INFO][FORUM][0]][NUM_NODI]) {
                echo $lang['perl_noderror3'];
            } else {
                echo $lang['perl_node1'] . $risposta[INFO][FORUM][$req_nod[INFO][FORUM][0]][NUM_NODI] . $lang['perl_node2'];
            }
        }
    }
    ?>
Example #3
0
<?php

include "testa.php";
// carico la lingua per la index
$lang += $std->load_lang('lang_index', $blanguage);
$corereq['RSA']['GENKEY']['CONSOLE_OUTPUT'] = 0;
$coresk = new CoreSock();
if (!$coresk->Send($corereq)) {
    $std->Error("Errore in send!");
}
$coreresp = $coresk->Read(60);
if (!$coreresp) {
    $std->Error("Errore in read!");
}
echo "pub: " . $coreresp['RSA']['GENKEY']['pub'] . "<br>";
echo "priv: " . $coreresp['RSA']['GENKEY']['priv'] . "<br>";
//include("end.php");
        $std->Error("" . $lang['reg_passnotvalid'] . "");
    }
    $identif = md5(pack('H*', md5($password)) . $nick);
    $sql_insert = "INSERT INTO {$SNAME}" . "_localmember (hash, password {$optfield}) VALUES ('" . $identif . "','" . mysql_real_escape_string($privkey) . "' {$optvalue})";
    if (!$db->query($sql_insert)) {
        $std->Error("" . $lang['reg_usererr'] . "");
    } else {
        $std->Error("", "", $lang['reg_importok'] . $lang['reg_import_import']);
    }
}
//END IMPORT
if ($create_user) {
    // BEGIN CREATE
    $identif = md5(pack('H*', md5($password)) . $nick);
    $password = pack('H*', md5($nick . pack('H*', md5($password))));
    $core = new CoreSock();
    $chiavi = $core->GenRsaKey($password, 1);
    //if($privkey) $chiavi[priv] = $privkey; //Prendo la chiave privata dal form se presente altrimenti prendo quella appena generata
    echo "Adding user into the system... <br>";
    $risp = $core->NewUser($nick, $chiavi[pub], base64_decode($chiavi[priv]), $password);
    if (!empty($risp['ERRORE'])) {
        //NON TRADURRE: Si prevede una gestione migliore degli errori del core :)
        switch ($risp['ERRORE']) {
            case 11:
                $std->Error("L'username deve avere una lunghezza compresa tra 4 e 30 caratteri");
                break;
            case 28:
                $std->Error("Niente messaggi nel futuro");
                break;
            default:
                $std->Error("Errore generico in fase di registrazione");
Example #5
0
function get_my_info()
{
    /* RETURN: Array( hash - id ) */
    global $std, $SNAME, $userdata;
    if (!$_SESSION[$SNAME]['sess_nick']) {
        return "";
    }
    if (!$userdata) {
        return "";
    }
    $KEY_DECRYPT = pack('H*', md5($_SESSION[$SNAME]['sess_nick'] . $_SESSION[$SNAME]['sess_password']));
    // = password per decriptare la chiave privata in localmember (16byte)
    $privkey = base64_decode($userdata->PASSWORD);
    $PKEY = $std->getpkey($SNAME);
    $req[FUNC][Base642Dec] = $PKEY;
    $req[FUNC][BlowDump2var][Key] = $KEY_DECRYPT;
    $req[FUNC][BlowDump2var][Data] = $privkey;
    $core = new CoreSock();
    if (!$core->Send($req)) {
        return NULL;
    }
    if (!($risp = $core->Read())) {
        return NULL;
    }
    $return[0] = $risp[FUNC]["BlowDump2var"]["hash"];
    //dell'utente loggato in questo momento
    list($asd, $return[1]) = unpack('H*', $return[0]);
    return $return;
}
					<th class="darkrow2" align="center">ID</th>
					<th class="darkrow2" align="center">Hash</th>
				</tr>';
    while (list($key, $userhash) = each($_REQUEST['toauth'])) {
        if (strlen($userhash) != 32) {
            $std->Error("Selected user hash (id {$key}) has wrong lenght!");
        }
        echo "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='row1' align='center'>{$key}</td>\r\n\t\t\t\t\t<td class='row1' align='center'>\r\n\t\t\t\t\t<input type='hidden' name='toauth[{$key}]' value='{$userhash}'>\r\n\t\t\t\t\t\t{$userhash}\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\n";
    }
    echo "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='row2'>\r\n\t\t\t\t\t\tPrivate Key\r\n\t\t\t\t\t\t<p align=\"center\">\r\n\t\t\t\t\t\t\t<a href=\"javascript:KeyRingPopUp('main','privkey')\">\r\n\t\t\t\t\t\t\t\t<img border=\"0\" src=\"img/keyring.gif\" width=\"32\" height=\"32\">\r\n\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t</p>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td><textarea cols=35 rows=5 name=\"privkey\"></textarea></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='row1' align='center' colspan='2'>\r\n\t\t\t\t\t\t<input type='submit' class='button' name='submit'>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\r\n\t\t</form>";
} else {
    require_once "admin.php";
    require_once "core.php";
    $PRIVKEY = $_REQUEST['privkey'];
    $admin = new Admin(base64_decode($PRIVKEY));
    $core = new CoreSock();
    $forum_id = pack('H*', $config[SHARE][$SNAME][ID]);
    // got privkey, auth'em!
    while (list($key, $userhash) = each($_REQUEST['toauth'])) {
        if (strlen($userhash) != 32) {
            $std->Error("Selected user hash (id {$key}) has wrong lenght!");
        }
        $member = pack("H*", $userhash);
        $admin->AuthMem($member);
    }
    // TODO: return Warning("Deve essere in formato esadecimale l'HASH membro.") if $memhash=~ /[^a-fA-F0-9]/i;
    $messaggio['BODY'] = $core->Var2BinDump($admin->ReturnVar());
    $messaggio['TITLE'] = 'Valido utenti';
    $messaggio['TYPE'] = 1;
    $messaggio['_PRIVATE'] = base64_decode($PRIVKEY);
    $risp = $core->AddMsg($messaggio);
$sez_data = $sez_data[0];
//last action
$query = "\r\n(SELECT {$SNAME}_reply.date+" . GMT_TIME . " AS date, {$SNAME}_newmsg.sez, {$SNAME}_newmsg.EDIT_OF,{$SNAME}_newmsg.title\r\nFROM {$SNAME}_reply\r\nJOIN {$SNAME}_newmsg ON {$SNAME}_newmsg.EDIT_OF = {$SNAME}_reply.rep_of\r\nWHERE {$SNAME}_reply.autore = '{$hash}')\r\nUNION \r\n(SELECT {$SNAME}_newmsg.date+" . GMT_TIME . " AS date, {$SNAME}_newmsg.sez, {$SNAME}_newmsg.EDIT_OF, {$SNAME}_newmsg.title\r\nFROM {$SNAME}_newmsg\r\nWHERE {$SNAME}_newmsg.autore = '{$hash}')\r\nORDER BY date DESC \r\nLimit 1";
$last_data = $db->get_row($query);
/*
Struct User:
	NULL 	may be filled a day.............
	''   	is fileld now. Do not remove pls
*/
$user = array('id' => $_GET['MEM_ID'], 'nick' => $pdata->AUTORE, 'surnick' => '', 'reg_date' => $pdata->reg_date, 'group' => array('text' => $pdata->title, 'image' => NULL), 'msg_num' => array('tot' => $pdata->msg_num, 'daily' => '', 'perc' => ''), 'msg_sez' => array('tot' => $sez_data['num_reply'], 'perc' => '', 'sez_id' => $sez_data['sez_id'], 'sez_name' => $sez_data['SEZ_NAME']), 'home' => '', 'avatar' => $pdata->avatar, 'sign' => $pdata->firma, 'icq' => NULL, 'msn' => NULL, 'email' => $pdata->email, 'location' => $pdata->provenienza, 'compleanno' => $pdata->nascita, 'online' => array('text' => '', 'image' => ''), 'last_action' => array('title' => $last_data->title, 'data' => $last_data->date, 'sez' => $last_data->sez, 'reply_id' => $last_data->EDIT_OF), 'extra' => $pdata->extra);
unset($pdata);
unset($sez_data);
unset($last_data);
//PREPROCESSING DATA
if (!$core) {
    $core = new CoreSock();
}
$user['extra'] = $core->BinDump2Var($user['extra']);
//Securing data
$user['nick'] = secure_v($user['nick']);
$user['avatar'] = secure_v($user['avatar']);
$user['sign'] = secure_v($user['sign']);
$user['home'] = secure_v($user['home']);
$user['location'] = secure_v($user['location']);
$user['msg_sez']['sez_name'] = secure_v($user['msg_sez']['sez_name']);
$user['last_action']['title'] = $user['last_action']['title'] ? secure_v($user['last_action']['title']) : '(untitled)';
//array_walk($user,secure_v);
//Default data
$user['group']['text'] = $user['group']['text'] ? $user['group']['text'] : 'membri';
$user['avatar'] = $user['avatar'] ? "<div><img src='{$user['avatar']}' border='0' alt='avatar' /></div>" : '';
//Default avatar?::NULL
         $Fixed = 1;
     } else {
         $Fixed = 0;
     }
 }
 if ($_REQUEST['home'] xor $Home) {
     $change = 1;
     if ($_REQUEST['home']) {
         $Home = 1;
     } else {
         $Home = 0;
     }
 }
 if ($_REQUEST['lock'] xor $Lock) {
     if ($_REQUEST['lock']) {
         $core = new CoreSock();
         if (@$core->Connect()) {
             // Questa parte mi serve solo per ottenere una risposta dal core, così da leggerne il timestamp GMT
             $idquery = "SELECT value FROM config WHERE MAIN_GROUP='SHARE' AND SUBKEY='" . $SNAME . "' AND FKEY='ID';";
             $idriga = $db->get_var($idquery);
             $req_nod[INFO][FORUM][0] = @pack("H*", $idriga);
             $core->Send($req_nod);
             $risp = $core->Read();
             // Fine parte fittizia
             $Lock = $risp['CORE']['INFO']['GMT_TIME'];
             $change = 1;
         }
     } else {
         $Lock = 0;
         $change = 1;
     }
<?php

ob_start('ob_gzhandler');
include "lib.php";
include "testa.php";
require "functions.php";
include "core.php";
// le righe commentate con "funziona" significa che sono state provate
?>
<tr><td><center><h2>Aggiunta board</h2></center>
<?php 
$core = new CoreSock();
$sesname = $_POST[name];
// Copio le variabili di POST in scalari normali. funza
if (strlen($sesname) != 5) {
    die("Il nome del forum deve essere di 5 caratteri");
}
if (strlen($_POST[pkey]) > 150) {
    $pkey_dec = $_POST[pkey];
    $forum_id = sha1($pkey_dec);
    // Calcolo l'ID del forum in esadecimale, funziona
    $req['FUNC']['Dec2Base64'] = $pkey_dec;
    if (!$core->Send($req)) {
        die("Errore mentre si tentava di comunicare con il core: " . $core->errmsg);
    }
    if (!($risp = $core->Read(6))) {
        die("Errore mentre si tentava di comunicare con il core: " . $core->errmsg);
    }
    $pkey_base64 = $risp['FUNC']['Dec2Base64'];
} else {
    $req[RSA][GENKEY][GEN] = 1;
    }
    include "end.php";
    exit;
}
if (!empty($nick) and !empty($password) and empty($privkey)) {
    // create a new user
    $identif = md5(md5($password, TRUE) . $nick);
    $idforum = $std->getidforum($SNAME);
    print "l'id del forum è {$idforum}\n<br>";
    $corereq['RSA']['GENKEY']['CONSOLE_OUTPUT'] = 0;
    $corereq['RSA']['GENKEY']['PWD'] = md5($nick . md5($password, TRUE), TRUE);
    #$corereq['RSA']['GENKEY']['NICK'] = $nick;
    #$corereq['RSA']['GENKEY']['PKEY64'] = $PKEY64;
    // quando invio una richiesta GENKEY dove è presente NICK sto generando una chiave per un utente, il core mi ritorna anche la PKEY in decimale in ['pkeydec']
    // e l'hash del messaggio in ['hash'] così evito di fare richieste/conti dopo
    $coresk = new CoreSock();
    if (!$coresk->Send($corereq)) {
        die("Errore in send1!");
    }
    $coreresp = $coresk->Read(120);
    if (!$coreresp) {
        die("Errore in read1!");
    }
    $rsapub = $coreresp['RSA']['GENKEY']['pub'];
    // in decimale
    $rsapriv = $coreresp['RSA']['GENKEY']['priv'];
    // in base64
    #$PKEY = $coreresp['RSA']['GENKEY']['pkeydec'];		//pkey del forum in decimale
    #$date = $coreresp['RSA']['GENKEY']['date'];			// la prendo così perchè deve essere quella usata per creare l'hash
    #$hash = $coreresp['RSA']['GENKEY']['hash'];
    print "Chiave pubblica {$rsapub}<br>e privata:<br>{$rsapriv}<br>\n";
//POSTBACK PAGE
if ($_POST['MEM_ID']) {
    $is_post_back = 1;
    if ($user_id != $_POST['MEM_ID'] && !is_valid($_POST['privkey'])) {
        echo '<tr><td>
		<table cellspacing="0" width="100%">
		<tr>
		<td valign="top" class="nopad" width="24%">' . show_menu() . '</td>
		<td class="nopad" width="1%"><!-- --></td>
		<!-- Start main CP area -->
		<td valign="top" class="nopad" width="75%">
			<div id="ucpcontent">
			<div class="maintitle">' . $lang['optsign_welcome'] . '</div>' . show_private_form($_POST) . '</div></td></tr></table>';
    } else {
        if (!$core) {
            $core = new CoreSock();
        }
        $IDENTIFICATORE = md5($_SESSION[$SNAME]['sess_password'] . $_SESSION[$SNAME]['sess_nick']);
        // = identificatore dell'utente nella tabella localmember. easadecimale
        $KEY_DECRYPT = pack('H*', md5($_SESSION[$SNAME]['sess_nick'] . $_SESSION[$SNAME]['sess_password']));
        // = password per decriptare la chiave privata in localmember (16byte)
        $mreq['REP_OF'] = pack("H32", '39022b1483601c914c507e377f56df00');
        $mreq['AUTORE'] = $user_hash;
        # Creo un vettore qualsiasi
        $extvar = array();
        # Con questo vettore nel vettore dico che voglio fare l'update del mio avatar e firma
        $extvar[UpdateMyAvatar] = array();
        $extvar[UpdateMyAvatar][avatar] = get_avatar($user_id);
        $extvar[UpdateMyAvatar][firma] = $_REQUEST['body'];
        $mreq['TYPE'] = '4';
        $mreq['BODY'] = 'Madifico la mia firma :wacko:';
<?php

require "testa.php";
if (!session_id()) {
    print "Non hai una sessesione\n";
}
$sez[SEZID] = 10;
$sez[SEZ_NAME] = 'alfa test';
$sez[SEZ_DESC] = 'descrizione della sezione alfa test';
$sez[ORDINE] = 2;
//è la seconda sezione
$core = new CoreSock();
// Per momotizzare una variabile dobbiamo usare l'insieme delle funzione chiamate TMPVAR.
// La funzione che momorizza si chiama ADDVAR
// Visto che ci possono essere anche più sessioni memorizzate noi inseriamo la nostra variabile in una sottochiave di session_id();
// EditSez è il nome della funzione che nel core crea e modifica le sezioni.
// il vettore numero ci suggerisce che possiamo inserire un insieme di puù sezioni nello stesso comando.
$req[TMPVAR][ADDVAR][session_id()][EditSez][0] = $sez;
$core->Send($req);
$core->Read();
//buttiamo via la risposta, che ce ne frega?
/* Una volta che abbiamo inserito la variabile nel core ci possiamo anche disconnettere.
  Possiamo chiudere il browser. Possiamo andare a casa fare la doccia...etc.
  La variabile che abbiamo messo dentro resta memorizzata fino
  a quando nn viene riavviato il core o non usiam l'apposita funzione.
*/
// Deciamo di aggiungere una nuova sezione:
$sez[SEZID] = 20;
$sez[SEZ_NAME] = 'beta test';
$sez[SEZ_DESC] = 'descrizione della sezione abeta test';
$sez[ORDINE] = 1;
include "testa.php";
// massima durata in secondi dello script
$globaltimeout = 3600;
ini_set("max_execution_time", $globaltimeout);
// lingua
$lang += load_lang('lang_newboard', $blanguage);
echo "\n\n<div align=center>\n<form method=\"POST\" action=\"newboard.php\">\n  <p>" . $lang['newbrd_sesname'] . "<br>\n  <input type=\"text\" name=\"bsession\" size=\"20\"></p>\n  <p>" . $lang['newbrd_description'] . "<br>\n  <input type=\"text\" name=\"bdesc\" size=\"73\"></p>\n  <p>&nbsp;</p>\n  <p>\n  <input type=hidden name=\"submit\" value=1>\n  <input type=\"submit\" value=\"" . $lang['newbrd_create'] . "\" name=\"B1\"></p>\n</form>\n</div>\n";
?>


<?php 
if ($submit) {
    require "functions.php";
    include "core.php";
    $corereq['RSA']['GENKEY']['CONSOLE_OUTPUT'] = 0;
    $coresk = new CoreSock();
    echo "<div align=center>";
    echo $lang['newbrd_keygen'];
    flush();
    if (!$coresk->Send($corereq)) {
        $std->Error($lang['newbrd_senderr']);
    }
    $coreresp = $coresk->Read($globaltimeout);
    if (!$coreresp) {
        die($lang['newbrd_coretimeout']);
    }
    $bname = $_REQUEST['bsession'];
    $bdesc = $_REQUEST['bdesc'];
    $pubkey = $coreresp['RSA']['GENKEY']['pub'];
    $privkey = $coreresp['RSA']['GENKEY']['priv'];
    $bid = sha1($pubkey);
ini_set("max_execution_time", 3600);
// nome sessione di origine (bastano le tabelle _memberi , _newmsg , _reply, _sez )
$sesorg = "keyfo2";
// chiave privata Admin forum di destinazione
// va inserita in un file chiamato pkeytemp.php
// contenente
//$PRIVKEY=".....";
include "pkeytemp.php";
// il forum di destinazione è quello corrente...
//************************************************
$whereiam = "migrator";
include "testa.php";
require "admin.php";
// chiudo la tabella di testa.php per permettere il flush()
echo "</table>";
$core = new CoreSock();
// decodifico la chiave privata dell'admin
$PRIVKEY = base64_decode($PRIVKEY);
echo "<b>migrazione del forum {$sesorg}, attendere prego....</b><br>";
flush();
// se non esiste creo la tabella temporanea degli hash
$db->query(" \r\n\r\nCREATE TABLE IF NOT EXISTS `hash_tmp` (\r\n  `OLD_HASH` binary(16) NOT NULL,\r\n  `NEW_HASH` binary(16) NOT NULL,\r\n  PRIMARY KEY  (`OLD_HASH`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\r\n\r\n");
// svuoto la tabella temporanea, se piena
$db->query("delete from hash_tmp where 1");
// ************************************
// CONVERSIONE SEZIONI
// ************************************
echo "<br>Conversione sezioni<br>";
$admin = new Admin($PRIVKEY);
$sql = "SELECT ID,SEZ_NAME,SEZ_DESC,ORDINE,FIGLIO from {$sesorg}_sez ORDER BY ID ASC";
$res = $db->get_results($sql);
    $std->UpdateUserData($SNAME, $userdata);
}
if (!$_SESSION[$SNAME]['sess_auth']) {
    $std->Error($lang['reply_login'], $_REQUEST['body']);
}
$IDENTIFICATORE = md5($_SESSION[$SNAME]['sess_password'] . $_SESSION[$SNAME]['sess_nick']);
// = identificatore dell'utente nella tabella localmember. easadecimale
$KEY_DECRYPT = pack('H*', md5($_SESSION[$SNAME]['sess_nick'] . $_SESSION[$SNAME]['sess_password']));
// = password per decriptare la chiave privata in localmember (16byte)
$query = "SELECT PASSWORD FROM " . $SNAME . "_localmember WHERE HASH='" . $IDENTIFICATORE . "';";
$privkey = base64_decode($db->get_var($query));
$PKEY = $std->getpkey($SNAME);
//$req[FUNC][Base642Dec]=$PKEY;
$req[FUNC][BlowDump2var][Key] = $KEY_DECRYPT;
$req[FUNC][BlowDump2var][Data] = $privkey;
$core = new CoreSock();
if (!$core->Send($req)) {
    $std->Error($lang['reply_core'], $_REQUEST['body']);
}
// timeout ?
if (!($risp = $core->Read())) {
    $std->Error($lang['reply_timeout'], $_REQUEST['body']);
}
//$PKEY=$risp[FUNC][Base642Dec];
if (strlen($PKEY) < 120) {
    $std->Error($lang['reply_admin'], $_REQUEST['body']);
}
if (strlen($risp[FUNC][BlowDump2var][hash]) != 16) {
    $std->Error($lang['reply_pdata'], $_REQUEST['body']);
}
$userhash = $risp[FUNC][BlowDump2var][hash];
Example #16
0
<?php

include "testa.php";
// creo il file restart.txt
$curdir = getcwd();
list($phpdir, $installdir) = spliti('\\\\WEBSERVER\\\\HTTPD', $curdir);
$filename = "{$phpdir}/restart.txt";
$handle = fopen($filename, 'w');
fwrite($handle, "keyforum restarts if this file exist");
fclose($handle);
$lang += $std->load_lang('lang_close', $blanguage);
if ($std->Multiutenza($SNAME)) {
    $std->Notice($lang[close_disabled_body], $lang[close_disabled_title]);
    include 'end.php';
    die;
}
$corereq = new CoreSock();
$req[CHIUDI] = 1;
if (!$corereq->Send($req)) {
    $std->Notice($lang['close_info1']);
} else {
    $std->Notice($lang['restart']);
}
$ORDER = $_REQUEST['ORDER'];
$LIMIT = $_REQUEST['LIMIT'];
if (empty($MODO) or ($MODO > 4 or $MODO < 1)) {
    $std->Error("Invalid HashReq MODE!");
}
if (empty($ORDER)) {
    $ORDER = "DESC";
}
if (empty($LIMIT)) {
    $LIMIT = 200;
}
$PKEY = $std->getpkey($_SERVER['sesname']);
if (empty($MODO) or empty($PKEY)) {
    $std->Error("Error on request!\n");
} else {
    $coreconn = new CoreSock();
    $convreq['FUNC']['Base642Dec'] = $PKEY;
    if (!$coreconn->Send($convreq)) {
        $std->Error("Error sending request to core!\n");
    }
    $pkeydec = $coreconn->Read();
    if (!$pkeydec) {
        $std->Error("Error receiving core data!\n");
    }
    $pkeysha1 = sha1($pkeydec['FUNC']['Base642Dec']);
    $forumid = pack("H*", $pkeysha1);
    $hashreq['HASHREQ'][$forumid]['MODO'] = $MODO;
    $hashreq['HASHREQ'][$forumid]['LIMIT'] = $LIMIT;
    $hashreq['HASHREQ'][$forumid]['ORDER'] = $ORDER;
    if (!empty($_REQUEST['MAX_DATE'])) {
        $hashreq['HASHREQ'][$forumid]['MAX_DATE'] = $_REQUEST['MAX_DATE'];