Beispiel #1
0
function get_header_login($host, $uri, $port, $header, $url)
{
    $extra_headers = array();
    $extra_headers["Cookie"] = sn_login();
    $response = whead($host, $uri, $port, ICEWEASEL_UA, $extra_headers);
    sn_logout();
    $header_value = exec_get_header($response, $header, False);
    if ($header_value != "") {
        privmsg("  {$header} header for {$url} = {$header_value}");
    }
}
Beispiel #2
0
/**
 * login.php
 *
 * @version 2.0 Security checks & tests by Gorlum for http://supernova.ws
 * @version 1.1 Security checks & tests by Gorlum for http://supernova.ws
 * @version 1.0
 * @copyright 2008 by ?????? for XNova
 */
include 'includes/init.' . substr(strrchr(__FILE__, '.'), 1);
lng_include('login');
lng_include('admin');
$id_ref = sys_get_param_int('id_ref');
$username = sys_get_param('username');
$password = sys_get_param('password');
if ($username) {
    $result = sn_login($username, $password, $_POST['rememberme']);
    switch ($result['status']) {
        case LOGIN_SUCCESS:
            $user = $result['user_row'];
            header('Location: overview.php');
            break;
        case LOGIN_ERROR_USERNAME:
        case LOGIN_ERROR_PASSWORD:
            message($result['error_msg'], $lang['Login_Error']);
            break;
        default:
    }
    die;
} elseif (!empty($_COOKIE[$config->COOKIE_NAME])) {
    $user = sn_autologin();
    if ($user['id']) {
Beispiel #3
0
                break;
            }
            $planet += 3;
        }
        //    $new_planet = doquery("SELECT `id` FROM {{planets}} WHERE `id_owner` = '{$user['id']}' LIMIT 1;", '', true);
        //    $new_planet = $new_planet['id'];
        doquery("UPDATE {{users}} SET `id_planet` = '{$new_planet}', `current_planet` = '{$new_planet}', `galaxy` = '{$galaxy}', `system` = '{$system}', `planet` = '{$planet}' WHERE `id` = '{$user['id']}' LIMIT 1;");
        $config->db_saveItem('users_amount', $config->users_amount + 1);
        $Message = $lang['thanksforregistry'];
        if (sendpassemail($email, $password)) {
            $Message .= " (" . htmlentities($email) . ")";
        } else {
            $Message .= " (" . htmlentities($email) . ")";
            $Message .= "<br><br>{$lang['error_mailsend']} <b>{$password}</b>";
        }
        $user = sn_login($username, $password);
        $user = $user['user_row'];
        message($Message, "{$lang['reg_welldone']}<b>{$password}</b>");
    }
} else {
    $template = gettemplate('registry_form', true);
    $template->assign_vars(array('id_ref' => $id_ref, 'servername' => $config->game_name, 'URL_RULES' => $config->url_rules, 'URL_FORUM' => $config->url_forum, 'URL_FAQ' => $config->url_faq));
    tpl_login_lang($template, $id_ref);
    display(parsetemplate($template), $lang['registry'], false, '', false, false);
}
function sendpassemail($emailaddress, $password)
{
    global $lang, $kod;
    $parse['SN_ROOT_VIRTUAL'] = SN_ROOT_VIRTUAL;
    $parse['password'] = $password;
    $parse['kod'] = $kod;
Beispiel #4
0
 $port = 443;
 $response = wtouch($host, $uri, $port, 120);
 $response_g = wtouch($host_g, $uri, $port, 120);
 if ($response === False and $response_g !== False) {
     pm("crutchy", "ALERT: \"" . strtoupper($host) . "\" HOST IS UNAVAILABLE ON PORT {$port}");
     $account = users_get_account($verifier_nick);
     if ($account == $verifier_account) {
         pm($verifier_nick, $verifier_msg);
     } else {
         # DON'T TRUST EXEC TO ALERT ANYTHING ON IT'S OWN
         #pm("#soylent",chr(3)."08".chr(2)."*** ALERT: \"".strtoupper($host)."\" HOST IS UNAVAILABLE ON PORT $port ***");
     }
     return;
 }
 $extra_headers = array();
 $extra_headers["Cookie"] = sn_login();
 $response = wget($host, $uri, $port, ICEWEASEL_UA, $extra_headers);
 $delim1 = "<b>Progress So Far: \$";
 $delim2 = "</b>";
 $amount = extract_text($response, $delim1, $delim2);
 if ($amount !== False) {
     $data = exec_file_read("previous_sn_funding");
     $previous = "";
     if (count($data) > 0) {
         $previous = trim($data[0]);
     } else {
         term_echo("funding: count(data) = 0");
     }
     if ($previous != $amount) {
         pm("#soylent", chr(3) . "05" . "*** SN funding has changed from \${$previous} to \${$amount}");
         exec_file_write("previous_sn_funding", array($amount));
Beispiel #5
0
function sn_comment_sid($subject, $comment_body, $article_sid, $parent_cid = "")
{
    $host = "dev.soylentnews.org";
    $port = 443;
    $params = array();
    if ($parent_cid == "") {
        $params["pid"] = "0";
        $uri = "/comments.pl?sid={$article_sid}&op=Reply";
    } else {
        $params["pid"] = $parent_cid;
        $uri = "/comments.pl?sid={$article_sid}&pid={$parent_cid}&op=Reply";
    }
    $extra_headers = array();
    $extra_headers["Cookie"] = sn_login();
    if ($extra_headers["Cookie"] == "") {
        privmsg("error: login failure (2)");
        return False;
    }
    $response = wget($host, $uri, $port, ICEWEASEL_UA, $extra_headers);
    $html = strip_headers($response);
    $delim1 = "<input type=\"hidden\" name=\"formkey\" value=\"";
    $delim2 = "\">";
    $formkey = extract_text($html, $delim1, $delim2);
    if ($formkey === False) {
        privmsg("error: unable to get formkey");
        sn_logout();
        return False;
    }
    var_dump($formkey);
    $uri = "/comments.pl";
    $params["sid"] = $article_sid;
    $params["mode"] = "improvedthreaded";
    $params["startat"] = "";
    $params["threshold"] = "-1";
    $params["commentsort"] = "0";
    $params["formkey"] = $formkey;
    $params["postersubj"] = $subject;
    $params["postercomment"] = $comment_body;
    #$params["nobonus_present"]="1";
    #$params["nobonus"]="";
    $params["postanon_present"] = "1";
    #$params["postanon"]="";
    $params["posttype"] = "1";
    # Plain Old Text
    $params["op"] = "Submit";
    sleep(8);
    $response = wpost($host, $uri, $port, ICEWEASEL_UA, $params, $extra_headers);
    $html = strip_headers($response);
    $delim = "start template: ID 104";
    $result = False;
    if (strpos($html, $delim) !== False) {
        privmsg("SoylentNews requires you to wait between each successful posting of a comment to allow everyone a fair chance at posting.");
    }
    $delim = "This exact comment has already been posted.";
    if (strpos($html, $delim) !== False) {
        privmsg("This exact comment has already been posted. Try to be more original.");
    }
    $delim = "Comment Submitted. There will be a delay before the comment becomes part of the static page.";
    if (strpos($html, $delim) !== False) {
        $result = array();
        $delim1 = "<input type=\"hidden\" name=\"sid\" value=\"";
        $delim2 = "\">";
        $result["sid"] = extract_text($html, $delim1, $delim2);
        $delim1 = "<input type=\"hidden\" name=\"cid\" value=\"";
        $result["cid"] = extract_text($html, $delim1, $delim2);
        $delim1 = "<input type=\"hidden\" name=\"pid\" value=\"";
        $result["pid"] = extract_text($html, $delim1, $delim2);
        # if pid=cid, then comment is at root level
        $delim1 = "<div id=\"comment_body_" . $result["cid"] . "\">";
        $delim2 = "</div>";
        $result["body"] = extract_text($html, $delim1, $delim2);
        $delim1 = "<a name=\"" . $result["cid"] . "\">";
        $delim2 = "</a>";
        $result["subject"] = extract_text($html, $delim1, $delim2);
        privmsg("  comment submitted successfully => https://" . $host . "/comments.pl?sid=" . $result["sid"] . "&cid=" . $result["cid"]);
    }
    #var_dump($html);
    sn_logout();
    return $result;
}