<input type="hidden" name="token" value="<?php echo Token::generate(); ?>" />
if (Token::check($_SESSION['token']) == false) {
show_error_msg("Error", "Please try again.");
}
<?php
class Token
{
public function __construct() { }
private function __clone() { }
public static function generate()
{
return $_Session["token"] = sha1(time());
}
public static function check($token)
{
// check the crsf token
if ($token === $_Session["token"] ) {
// then destroy it
$_Session["token"] = null;
return true;
}
return false;
}
}
public function adduser()
{
if ($_SESSION["class"] < "7") {
show_error_msg("Error", "Sorry you do not have the rights to view this page!", 1);
}
$data = [];
$this->view('admin/adduser', $data);
}
public function addeduserok()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST["username"] == "" || $_POST["password"] == "" || $_POST["email"] == "") {
show_error_msg("Error", "Missing form data.");
}
if ($_POST["password"] != $_POST["password2"]) {
show_error_msg("Error", "Passwords mismatch.");
}
$username = $_POST["username"];
$password = $_POST["password"];
$email = $_POST["email"];
$secret = mksecret();
$passhash = md5($password);
$secret = $secret;
$count = get_row_count("users", "WHERE username=$username");
if (!$count !=0) {
show_error_msg("Error", "Unable to create the account. The user name is possibly already taken.");
Redirect::to(URLROOT . "/admincp");
die;
}
DB::run("INSERT INTO users (added, last_access, secret, username, password, status, email) VALUES (?,?,?,?,?,?,?)", [get_date_time(), get_date_time(), $secret, $username, $passhash, 'confirmed', $email]);
Redirect::autolink(URLROOT . "/admincp", Lang::T("COMPLETE"));
}
}
<?php
Style::adminheader("Add User");
Admincp::adminnavmenu1();
Style::begin("Add User");
?>
<center><b>Add user</b></center>
<div class="form-group">
<form method=get action=?>
<input type=hidden name=action value=users>
Search Users: <input type=text size=30 name=search>
<input type=submit value='Search'>
</form>
<form method=post action='<?php echo URLROOT; ?>/admincp/addeduserok'>
<div class="form-group">
<label for="name">Username</label>
<input id="name" type="text" class="form-control" name="username" minlength="3" maxlength="25" required autofocus>
</div>
<div class="form-group">
<label for="name">Password</label>
<input id="name" type="text" class="form-control" name="password" minlength="3" maxlength="25" required autofocus>
</div>
<div class="form-group">
<label for="name">Re-type password</label>
<input id="name" type="text" class="form-control" name="password2" minlength="3" maxlength="25" required autofocus>
</div>
<div class="form-group">
<label for="name">E-mail</label>
<input id="name" type="text" class="form-control" name="email" minlength="3" maxlength="25" required autofocus>
</div>
<div class="form-group">
<div class="form-group no-margin">
<button type="submit" class="btn btn-primary btn-block">Okay</button>
</div>
</form>
</div>
</div>
<?php
Style::end();
Style::adminfooter();
$config['myadminhash'] = 'hcudhcuerichiercherichei', // can be anything can be reset here anytime
$_SESSION['class'] > 5 || $_SESSION["control_panel"] != "yes" || $_SESSION['private' != $config['myadminhash']
if (strlen($_COOKIE["password"]) != 60 || !is_numeric($_COOKIE["id"]) || $_COOKIE["login_fingerprint"] != self::loginString()) {
private static function loginString()
{
$ip = Helper::getIP();
$browser = Helper::browser();
return hash("sha512", $ip, $browser);
}
header("X-XSS-Protection: 1; mode=block");<?php
class Token
{
public function __construct() { }
private function __clone() { }
public static function generate()
{
return Session::set("token", sha1(time()));
}
public static function check($token)
{
$tokenNome = "token";
if (Session::get($tokenNome) && $token === Session::get($tokenNome)) {
Session::destroy($tokenNome);
return true;
}
return false;
}
}Token::generate();<input type="hidden" name="token" value="<?php echo isset($this->token) ? $this->token : $this->token; ?>" /> function bruteForce()
{
return loginTries() > 5 ? true : false;
}
function triesLogin()
{
$logins = loginTries();
// insert count to db
if ($logins > 0) {
$this->db->update('bruteforces', ["alltimes" => $logins + 1], "`ip` = ? AND `alldate` = ?", [getip(), NOW()]);
} else {
$this->db->insert('bruteforces', ["ip" => getip(), "alldate" => NOW()]);
}
}
loginTries()
{
$query = $this->db->select1("SELECT `alltimes` FROM `bruteforces` WHERE `ip` = ? AND `alldate` = ?", [getip(), NOW()]);
return count($query) == 0 ? 0 : $query->alltimes;
}
CREATE TABLE IF NOT EXISTS `bruteforces` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`ip` varchar(70) NOT NULL,
`alltimes` int(10) UNSIGNED NOT NULL DEFAULT 1,
`alldate` date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; $res = SQL_Query_exec("SELECT (SUM(peers.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(peers.started)) AS speed, peers.seeder, peers.id, peers.connectable, users.id, peers.started, torrents.id AS torrentid, torrents.name, torrents.size, peers.to_go FROM peers LEFT JOIN torrents ON torrents.id = peers.id LEFT JOIN users ON peers.id = users.id WHERE peers.id = $CURUSER[id] AND peers.seeder = 'no' GROUP BY peers.started DESC LIMIT 6");
while ($row = mysqli_fetch_assoc($res)) {
$rows = $row;
if (array_key_exists('torrentid', $row)) {
echo 'something happened';
} else {
echo T_("NO_ACTIVE_TRANSFERS");
}
} <?php
class Test extends Controller
{
public function __construct()
{
$this->db = new Database;
}
public function index()
{
dbconn();
try {
$timeout = 12;
$scraper = new Udptscraper($timeout);
$ret = $scraper->scrape('udp://9.rarbg.to:2890/announce', '546d6aed41217195ed2c82e9c561b7badbd6b590');
foreach ($ret as $array) {
$keys = array_keys( $array);
echo $array[ $keys[0] ].' seeders<br>';
echo $array[ $keys[1] ].' completed<br>';
echo $array[ $keys[2] ].' leechers<br>';
}
} catch (ScraperException $e) {
echo ('Error: ' . $e->getMessage() . "<br />\n");
echo ('Connection error: ' . ($e->isConnectionError() ? 'yes' : 'no') . "<br />\n");
}
}
}"Botanicar, post: 69627, member: 19833":
in torrent description I have [color=rgb(255, 0, 0)]=[/color] character
unexpected 'public' (T_PUBLIC) in file /home/tt-m-jay/public_html/controllers/Torrents.php on line 752try {
$ret = DB::run("INSERT INTO torrents (filename, owner, name, vip, descr, image1, image2, category, tube, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action, freeleech, imdb)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
[$fname, $_SESSION['id'], $name, $vip, $descr, $inames[0], $inames[1], $catid, $tube, get_date_time(), $infohash, $torrentsize, $filecounts, $fname, $announce, $external, $nfo, $langid, $anon, get_date_time(), $free, $imdb]);
} catch (PDOException $e) {
rename("$torrent_dir/$fname", "$torrent_dir/duplicate.torrent"); // todo
autolink(TTURL . '/index.php', 'Torrent already added. Duplicate Hash');
}
$id = DB::lastInsertId();
$ret = DB::run("INSERT INTO torrents (filename, owner, name, vip, descr, image1, image2, category, tube, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action, freeleech, imdb)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
[$fname, $_SESSION['id'], $name, $vip, $descr, $inames[0], $inames[1], $catid, $tube, get_date_time(), $infohash, $torrentsize, $filecounts, $fname, $announce, $external, $nfo, $langid, $anon, get_date_time(), $free, $imdb]);
$id = DB::lastInsertId();