<?

/*
// +--------------------------------------------------------------------------+
// | Project:    NVTracker - NetVision BitTorrent Tracker                     |
// +--------------------------------------------------------------------------+
// | This file is part of NVTracker. NVTracker is based on BTSource,          |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | NVTracker is free software; you can redistribute it and/or modify        |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | NVTracker is distributed in the hope that it will be useful,             |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with NVTracker; if not, write to the Free Software Foundation,     |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// | Obige Zeilen dürfen nicht entfernt werden!    Do not remove above lines! |
// +--------------------------------------------------------------------------+
 */

require_once("include/bittorrent.php");

hit_start();

$id = 0 + $_GET["id"];
$md5 = $_GET["secret"];

if (!$id)
    httperr();

dbconn();

hit_count();
$registered = number_format(get_row_count("users"));
$res = mysql_query("SELECT passhash, editsecret, status, username, id FROM users WHERE id = $id");
$row = mysql_fetch_array($res);


if (!$row)
    httperr();

if ($row["status"] != "pending") {
    header("Refresh: 0; url=../../ok.php?type=confirmed");
    exit();
}

$sec = hash_pad($row["editsecret"]);
if ($md5 != md5($sec))
    httperr();

mysql_query("UPDATE users SET status='confirmed', editsecret='' WHERE id=$id AND status='pending'");

$uid = $row['id'];


if ($registered == "1000") {
$text = "[color=red]Begrüsst alle ganz herzlich unser 1000. Mitglied !,[/color][color=SeaGreen][url=userdetails.php?id=".$row['id']."] " . $row['username']."[/url][/color]";
} else {


$text = "[color=DarkOrange]Begrüßt unser neuestes  Mitglied,[/color][color=SeaGreen][url=userdetails.php?id=".$row['id']."] " . $row['username']."[/url]  (Nr. ".$registered.")[/color]";
}
$date=time();


mysql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES ('id'," . sqlesc('56') . ", " . sqlesc('TRACKER SYSTEM MELDET') . ", $date, " . sqlesc($text) . ")");



if (!mysql_affected_rows())
    httperr();

logincookie($id, $row["passhash"]);

header("Refresh: 0; url=../../ok.php?type=confirm");

hit_end();

?>