Exemple #1
0
function transfer_postviews_data()
{
    global $wpdb;
    $table_name = $wpdb->prefix . 'postmeta';
    $pviews = $wpdb->get_results("SELECT post_id, meta_value FROM {$table_name} WHERE meta_key = 'views' ORDER BY post_id ASC");
    foreach ($pviews as $pview) {
        update_tracker($type = 'single', $pview->post_id, $pview->meta_value);
    }
}
Exemple #2
0
 //Create variables for all the fields
 $Username = $_POST['Username'];
 $Email = $_POST['Email'];
 $Password = $_POST['Password'];
 //Make sure all the fields are filled in
 if (!empty($Username) && !empty($Email) && !empty($Password)) {
     //Create hashes...
     $Secret = make_secret();
     $torrent_pass = make_secret();
     //Create the account
     $DB->query("INSERT INTO users_main (Username,Email,PassHash,Secret,torrent_pass,Enabled,PermissionID, Language) VALUES ('" . db_string($Username) . "','" . db_string($Email) . "','" . db_string(make_hash($Password, $Secret)) . "','" . db_string($Secret) . "','" . db_string($torrent_pass) . "','1','" . USER . "', 'en')");
     //Increment site user count
     $Cache->increment('stats_user_count');
     //Grab the userid
     $UserID = $DB->inserted_id();
     update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));
     //Default stylesheet
     $DB->query("SELECT ID FROM stylesheets");
     list($StyleID) = $DB->next_record();
     //Auth key
     $AuthKey = make_secret();
     //Give them a row in users_info
     $DB->query("INSERT INTO users_info \n\t\t(UserID,StyleID,AuthKey,JoinDate) VALUES \n\t\t('" . db_string($UserID) . "','" . db_string($StyleID) . "','" . db_string($AuthKey) . "', '" . sqltime() . "')");
     //Redirect to users profile
     header("Location: user.php?id=" . $UserID);
     //What to do if we don't have a username, email, or password
 } elseif (empty($Username)) {
     //Give the Error -- We do not have a username
     error("Please supply a username");
 } elseif (empty($Email)) {
     //Give the Error -- We do not have an email address
Exemple #3
0
    $DB->query("SELECT peer_id FROM xbt_client_whitelist WHERE id = " . $_POST['id']);
    list($PeerID) = $DB->next_record();
    $DB->query('DELETE FROM xbt_client_whitelist WHERE id=' . $_POST['id']);
    update_tracker('remove_whitelist', array('peer_id' => $PeerID));
} else {
    //Edit & Create, Shared Validation
    if (empty($_POST['client']) || empty($_POST['peer_id'])) {
        print_r($_POST);
        die;
    }
    $Client = db_string($_POST['client']);
    $PeerID = db_string($_POST['peer_id']);
    if ($_POST['submit'] == 'Edit') {
        //Edit
        if (empty($_POST['id']) || !is_number($_POST['id'])) {
            error("3");
        } else {
            $DB->query("SELECT peer_id FROM xbt_client_whitelist WHERE id = " . $_POST['id']);
            list($OldPeerID) = $DB->next_record();
            $DB->query("UPDATE xbt_client_whitelist SET\n\t\t\t\tvstring='" . $Client . "',\n\t\t\t\tpeer_id='" . $PeerID . "'\n\t\t\t\tWHERE ID=" . $_POST['id']);
            update_tracker('edit_whitelist', array('old_peer_id' => $OldPeerID, 'new_peer_id' => $PeerID));
        }
    } else {
        //Create
        $DB->query("INSERT INTO xbt_client_whitelist\n\t\t\t(vstring, peer_id) \n\t\tVALUES\n\t\t\t('" . $Client . "','" . $PeerID . "')");
        update_tracker('add_whitelist', array('peer_id' => $PeerID));
    }
}
$Cache->delete('whitelisted_clients');
// Go back
header('Location: tools.php?action=whitelist');
Exemple #4
0
            update_tracker('update_user', array('passkey' => $Cur['torrent_pass'], 'can_leech' => '0'));
        }
        $UpdateSet[] = "Enabled='1'";
        $LightUpdates['Enabled'] = 1;
    }
    $EditSummary[] = $EnableStr;
    $Cache->replace_value('enabled_' . $UserID, $EnableUser, 0);
}
if ($ResetPasskey == 1 && check_perms('users_edit_reset_keys')) {
    $Passkey = db_string(make_secret());
    $UpdateSet[] = "torrent_pass='******'";
    $EditSummary[] = "passkey reset";
    $HeavyUpdates['torrent_pass'] = $Passkey;
    $Cache->delete_value('user_' . $Cur['torrent_pass']);
    //MUST come after the case for updating can_leech.
    update_tracker('change_passkey', array('oldpasskey' => $Cur['torrent_pass'], 'newpasskey' => $Passkey));
}
if ($ResetAuthkey == 1 && check_perms('users_edit_reset_keys')) {
    $Authkey = db_string(make_secret());
    $UpdateSet[] = "AuthKey='{$Authkey}'";
    $EditSummary[] = "authkey reset";
    $HeavyUpdates['AuthKey'] = $Authkey;
}
if ($SendHackedMail && check_perms('users_disable_any')) {
    $EditSummary[] = "hacked email sent to " . $HackedEmail;
    send_email($HackedEmail, "Your " . SITE_NAME . " account.", "Your " . SITE_NAME . " account appears to have been compromised. As a security measure we have disabled your account. To resolve this please visit us on IRC.\n\nThis is the information to connect to our server:\nIRC Server: " . BOT_SERVER . "\nPort: " . BOT_PORT . " (6697 SSL)\n\nOnce you are connected to our server you'll need to join our disabled channel.\nType: /join " . BOT_DISABLED_CHAN . "\n\nPlease visit us soon so we can help you resolve this matter.");
}
if ($MergeStatsFrom && check_perms('users_edit_ratio')) {
    $DB->query("SELECT ID, Uploaded, Downloaded FROM users_main WHERE Username LIKE '" . $MergeStatsFrom . "'");
    if ($DB->record_count() > 0) {
        list($MergeID, $MergeUploaded, $MergeDownloaded) = $DB->next_record();
Exemple #5
0
$Cache->commit_transaction(0);
$SQL = "UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET\n\ti.StyleID='" . db_string($_POST['stylesheet']) . "',\n\ti.StyleURL='" . db_string($_POST['styleurl']) . "',\n\ti.Avatar='" . db_string($_POST['avatar']) . "',\n\ti.SiteOptions='" . db_string(serialize($Options)) . "',\n\ti.Info='" . db_string($_POST['info']) . "',\n\ti.DownloadAlt='{$DownloadAlt}',\n\tm.Email='" . db_string($_POST['email']) . "',\n\tm.IRCKey='" . db_string($_POST['irckey']) . "',\n    i.Country='" . $Country . "',\n\ti.Timezone='" . $Timezone . "',";
if (check_perms('anonymous')) {
    $SQL .= "m.Anonymous='" . db_string($Anonymous) . "',";
}
$SQL .= "m.Paranoia='" . db_string(serialize($Paranoia)) . "'";
if ($ResetPassword) {
    $ChangerIP = db_string($LoggedUser['IP']);
    $Secret = make_secret();
    $PassHash = make_hash($_POST['new_pass_1'], $Secret);
    $SQL .= ",m.Secret='" . db_string($Secret) . "',m.PassHash='" . db_string($PassHash) . "'";
    $DB->query("INSERT INTO users_history_passwords\n\t\t(UserID, ChangerIP, ChangeTime) VALUES\n\t\t('{$UserID}', '{$ChangerIP}', '" . sqltime() . "')");
}
if (isset($_POST['resetpasskey'])) {
    $OldPassKey = db_string($LoggedUser['torrent_pass']);
    $NewPassKey = db_string(make_secret());
    $ChangerIP = db_string($LoggedUser['IP']);
    $SQL .= ",m.torrent_pass='******'";
    $DB->query("INSERT INTO users_history_passkeys\n\t\t\t(UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime) VALUES\n\t\t\t('{$UserID}', '{$OldPassKey}', '{$NewPassKey}', '{$ChangerIP}', '" . sqltime() . "')");
    $Cache->begin_transaction('user_info_heavy_' . $UserID);
    $Cache->update_row(false, array('torrent_pass' => $NewPassKey));
    $Cache->commit_transaction(0);
    $Cache->delete_value('user_' . $OldPassKey);
    update_tracker('change_passkey', array('oldpasskey' => $OldPassKey, 'newpasskey' => $NewPassKey));
}
$SQL .= "WHERE m.ID='" . db_string($UserID) . "'";
$DB->query($SQL);
if ($ResetPassword) {
    logout();
}
header('Location: user.php?action=edit&userid=' . $UserID);