$bb->register('b', [], true, function($special, $content)
{
return '<b>'.$content.'</b>';
});
$bb->register('staff', ['color'=>'red', 'font'=>'bold'], true, function($special, $content)
{
return '<span style="color:'.$special['color'].';font-weight: '.$special['font'].'">'. $content .'</span>';
});
foreach ($stmt as $row)
{
$random = $row['username'];
}
Should be:
$random = '';
foreach ($stmt as $row)
{
$random = $row['username'];
}"STorrents2020, post: 68218, member: 20382":
This actually simply secures download links to to SHA1 hash I believe, this was only to obfuscate download URLs with no other intention. What you want to do is start working with $_GET and register torrent.name into the variable and call it manually to test working, but you must updated a LOT of internal references to the script/ID or you will have dead links everywhere.
ID and Name can both be used. Name is good for SEO, ID is a little dated, but hook-efficient (you can call it throughout the script without much effort).
I'll be working on this one tomorrow as I do care about SEO and that will bring some changes to the rewrite rules too.
"MicroMonkey, post: 68209, member: 311":
Im just confused as to why this matters? I think someone asked about this very thing a few years ago. Not sure if anyone addressed it or not.
<?php
if (isset($_COOKIE['uid']) && isset($_COOKIE['pass']))
{
/* @var $_COOKIE ['uid'] = $userid;
* Change language for a currently logged user.
* basic mod by shadows @ torrenttrader.xyz
*/
begin_frame("Select your language");
$stmt = mysql_query("SELECT *, COUNT (id) as 'found_languages' FROM languages");
$row = mysql_fetch_assoc($stmt);
if ($row && $row['found_languages'] > 0)
{
echo '<form method="post">';
foreach ($row as $item)
{
echo '<input type="radio" name="language" value="' . $item['id'] . '">' . $item['name'] .'<br>';
}
echo '<input type="hidden" name="change_language" value="1">';
echo '</form>';
}
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
if ($_POST['change_language'] == 1)
{
mysql_query("UPDATE users SET language = ".$_POST['language']." WHERE id = ".$_COOKIE["uid"]."");
begin_frame("Language changed");
echo 'Language changed';
}
}
}
$p = '21';
$a = 21;
$k = '0';
$t = 're';
echo is_numeric($p ?? 0) . "\n";
echo is_numeric($a ?? 0) . "\n";
echo is_numeric($k ?? 0) . "\n";
echo is_numeric($t ?? 0) . "\n";
// output
1
1
1
public function isvalidcookie() {
if (!is_numeric($_COOKIE['uid']) || (int) $_COOKIE['uid'] < 1 || !isset($_COOKIE['pass']) ) {
return (new Cookie)->logoutcookie();
}
} public function curuser()
{
$stmt = $this->db->run("SELECT * FROM users WHERE id = 1");
if ($stmt && password_verify(/** */))
{
foreach ($stmt as $item => $value)
{
return $data[$item] = $value;
}
}
/*
* If not current user / return false
*/
return false;
}
$user = new User();
echo $user->curuser()['username'];
// Strict check
if ($user->curuser() === false)
{
echo 'Not logged in';
}
// Less strict check
if (!$user->curuser())
{
echo 'Not logged in';
}
public function loggedIn()
{
if ($this->curuser() === false)
{
return false;
}
return true;
}
if ($user->loggedIn())
{
echo $user->curuser()['username'];
}
public function curuser()
{
$stmt = $this->db->query("SELECT * FROM users WHERE id = 2");
if ($stmt && password_verify(/** */))
{
foreach ($stmt as $item => $value)
{
return $data[$item] = $GLOBALS['CURUSER'] = $value;
}
}
/*
* If not current user / return false
*/
return false;
}
/*
* User class included
*/
global $CURUSER;
$user = new User($db_handler);
$user->curuser();
echo $CURUSER['username'];
"STorrents2020, post: 68165, member: 20382":
Your query (corrected above) is working like a charm, I commented vars in the loop and directed the rest to $query outside the loop, nice! thnx - this is a optimization though no?
$query = SQL_Query_exec("
SELECT peers.*, users.*, COUNT(peers.id) as 'found_num'
FROM peers
LEFT JOIN users
ON (peers.userid = users.id)
WHERE peers.torrent = $id
ORDER BY peers.seeder DESC
");$query = SQL_Query_exec("
SELECT peers.*, users.*,
(
SELECT COUNT(peers.id)
FROM peers
WHERE peers.torrent = $id
) as 'found_num'
FROM peers
LEFT JOIN users
ON (peers.userid = users.id)
WHERE peers.torrent = $id
ORDER BY peers.seeder DESC
");