Ejemplo n.º 1
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']);
}
}
$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!");
}
$oldprivkey[hash] = $userhash;
Ejemplo n.º 3
0
       <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'];
            }
        }
    }
    ?>
        </td>
       </tr>
	   <!-- End Nodi connessi -->
       <tr>
Ejemplo n.º 4
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");
Ejemplo n.º 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;
}
    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";
    unset($coreresp, $corereq);
Ejemplo n.º 7
0
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;
//è la prima sezione
$secreq[TMPVAR][ADDVAR][session_id()][EditSez][1] = $sez;
$core->Send($secreq);
Ejemplo n.º 8
0
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'];
    }
    if (!empty($_REQUEST['MIN_DATE'])) {