"spiritblue, post: 68758, member: 401":
little question...
I tried adding the default avatar with an [color=rgb(226, 80, 65)]else[/color] and it didn't work, you have an idea, don't I?
CODE BETA:
$downloaders = SQL_Query_exec("SELECT users_downloaded.userid, users_downloaded.torrentid, users.avatar, users.id, users.class, users.username FROM users_downloaded LEFT JOIN users ON users.id = users_downloaded.userid WHERE users_downloaded.torrentid = $id LIMIT 12");
if (mysqli_num_rows($downloaders) > 0) {
print('<tr><td align="center" colspan="2"><div class="alsoDownloaded">
<ul class="grid" style="list-style: none">');
while ($dlrow = mysqli_fetch_assoc($downloaders)):
$avatar = htmlspecialchars($user["avatar"]);
if (!$avatar){
print('<li class="grid"><a href="account-details.php?id="'.$dlrow["userid"].'"></a><img src="'.$dlrow["avatar"].'" /><br/><font size="2"> '.class_user($dlrow["username"]).' </font>');
}else{
print('<img class="hitavatar" src="'.$avatar.'" alt="" />');
#print('<a href="account-details.php?id="'.$dlrow["userid"].'"><img src="'.$site_config["SITEURL"].'"/images/default_avatar.png"/>'.$avatar.'</a>');
}
#if ($CURUSER) {
#print('<p><a href="mailbox.php?compose&id="'.$dlrow["userid"].'"> Mp</a></p>');
#}
print('</li>');
endwhile;
print('</ul></div></td></tr>');
#} else {
#print('<img src="'.$avatar.'" alt="" />');
#echo '<span style="float:right;padding:30px">' .format_comment("Aucun téléchargeur pour l'instant.. "). '</span>';
}
[ATTACH type="full" alt="Capture.PNG"]5595[/ATTACH]
...thanks !
SQL_Query_exec("UPDATE torrents SET hits = hits + 1 WHERE id = $id");SQL_Query_exec("INSERT INTO users_downloaded (userid, torrentid, lastdownload) VALUES ($CURUSER[id], $id, NOW())"); "MicroMonkey, post: 68730, member: 311":
Look really cool, but $freeleech is not in the MYSQLI 3.0 version at all. I can only find that in snatched.php, so maybe you are getting versions mixed up or are doing custom code that will not immediately be identifiable by people using the 3.0 as I posted it on github. Just something to be aware of, but thanks for all the help. I just think things are getting crossed over between projects. I have my own custom project that I dont share because I cant just help people "plug and play" using what I have altered, so I always have to refer and test against the code that is downloadable for all to use. If I share something, I test it against the code that I posted on git. I tried sharing custom code once, it was too difficult to help with since I was always fiddling with it lol. But as I said, very nice stuff you have and thank you very much for sharing :) If people know what they are looking at they can pick it apart and code it themselves, but I try to make it as easy as I can for the folks who may be just starting to have some fun with this
$freeleech<div>$reseed $healthy $popular $fleech $comments</div>
$state = SQL_Query_exec("SELECT id, seeders, hits, freeleech, comments FROM torrents WHERE id = " .$id);
$check = mysql_fetch_assoc($state);
if ($check["seeders"] <= 2) { // If torrent has 2 seeds or less (poor health)
$reseed = '<span style="pointer-events:none;font-size:13px;background:orange;padding:3px 11px 4px 11px;text-align:center;border-radius:3px;color:#FFF;font-weight:500;text-decoration:none;text-shadow:0 1px 1px rgba(0,0,0,.3)">
Seeders Wanted
</span>';
}else{
$reseed = '';
}
if ($check["seeders"] >= 3) { // If torrent has 3 seeds or more (good health)
$healthy = '<span style="margin-left:5px;pointer-events:none;font-size:13px;background:#ED2324;padding:3px 11px 4px 11px;text-align:center;border-radius:3px;color:#FFF;font-weight:500;text-decoration:none;text-shadow:0 1px 1px rgba(0,0,0,.3)">
Healthy
</span>';
}else{
$healthy = '';
}
if ($check["hits"] >= 20) { // If torrent has 20 downloads or more (good hits)
$popular = '<span style="margin-left:5px;pointer-events:none;font-size:13px;background:purple;padding:3px 11px 4px 11px;text-align:center;border-radius:3px;color:#FFF;font-weight:500;text-decoration:none;text-shadow:0 1px 1px rgba(0,0,0,.3)">
Popular
</span>';
}else{
$popular = '';
}
if ($check["freeleech"] == 1) { // If torrent has 20 downloads or more (good hits)
$fleech = '<span style="margin-left:5px;pointer-events:none;font-size:13px;background:#0079FE;padding:3px 11px 4px 11px;text-align:center;border-radius:3px;color:#FFF;font-weight:500;text-decoration:none;text-shadow:0 1px 1px rgba(0,0,0,.3)">
Freeleech
</span>';
}else{
$fleech = '';
}
if ($check["comments"] >= 4) { // If torrent has 4 comments or more (user attention)
$comments = '<span style="margin-left:5px;pointer-events:none;font-size:13px;background:green;padding:3px 11px 4px 11px;text-align:center;border-radius:3px;color:#FFF;font-weight:500;text-decoration:none;text-shadow:0 1px 1px rgba(0,0,0,.3)">
Social
</span>';
}else{
$comments = '';
}
SQL_Query_exec("UPDATE torrents SET hits = hits + 1 WHERE id = $id");SQL_Query_exec("INSERT INTO users_downloaded (userid, torrentid, lastdownload) VALUES ($CURUSER[id], $id, NOW())");
print("<center><br />" . format_comment($row['descr']) . "<br /><br />\n");
// end description
?>
<h1 itemprop="name" class="entry-title" style="font-size:30px;font-weight:400">
Also downloaded
</h1>
<?
$downloaders = SQL_Query_exec("SELECT users_downloaded.userid, users_downloaded.torrentid, users.avatar, users.id, users.class, users.username FROM users_downloaded LEFT JOIN users ON users.id = users_downloaded.userid WHERE users_downloaded.torrentid = $id LIMIT 12");
if (mysql_num_rows($downloaders) > 0) {
?>
<!-- BEGIN Users Also Downloaded -->
<div class="alsoDownloaded">
<ul class="grid columns-3" style="list-style: none">
<?
while ($dlrow = mysql_fetch_assoc($downloaders)):
?>
<li>
<a href="/user/?id=<? echo $dlrow["userid"]; ?>">
<img src="/<? echo $dlrow["avatar"]; ?>" /></a>
<?
if ($CURUSER) {
?>
<p><a href="/message/?compose&id=<?
echo $dlrow["userid"]; ?>">Ask for Help</a></p>
<?
}
?>
</li>
<?
endwhile;
?>
<li style="padding-bottom:10px; list-style: none">
<span>+ 11 more</span>
</li>
</ul>
</div>
<?
} else {
echo '<span style="float:right;padding:30px">' . format_comment('No downloaders populated yet.. :( ') . '</span>';
}
?>
.alsoDownloaded {
margin: 0 auto;
margin-top: 3%;
margin-bottom: 4%
}
ul.grid {
list-style: none;
font-size: 0px;
margin-left: -6.5% /* should match li left margin */
}
ul.grid li {
float: right;
display: inline-block;
_padding: 10px;
_margin: 0 0 2.5% 2.5%;
_background: #fff;
_border: 1px solid #dfdfdf;
font-size: 16px;
font-size: 1rem;
vertical-align: top;
_box-shadow: 0 0 5px #dfdfdf;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box
}
ul.grid li img {
height:55px;
width:55px;
border-radius:100%;
margin-left:10px
}
ul.grid li h3 {
margin: 0 0 5px
}
ul.grid li p {
font-size: .9em;
line-height: 1.5em;
color: #999;
text-align: center
}
ul.grid.columns-3 li {
_width: 30.83%; /* this value + 2.5 should = 33% */
}
CREATE TABLE `users_downloaded` (
`userid` int(10) unsigned NOT NULL DEFAULT 0,
`torrentid` int(10) unsigned NOT NULL DEFAULT 0,
`lastdownload` datetime NOT NULL,
UNIQUE KEY `userfriend` (`userid`,`torrentid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
"shadows, post: 68722, member: 20311":
Shouldn't views be used for actual HTML parts of torrents/upload/details/profiles if this is a MVC structure?
Controllers are only used to return views eg.
public function indexAction()
{
View::renderTemplate('Torrent/torrents-upload.html');
}
// TROPHIE: FIRST FORUM TOPIC
SQL_Query_exec("INSERT INTO users_trophies (userid, trophie, reason, trophiepic) VALUES
($CURUSER[id], 'First Forum Topic', 'Earned Bookworm Trophie for posting their first forum topic.', 'images/trophies/firstforumtopic.png')");
// TROPHIE: FIRST TORRENT COMMENT
SQL_Query_exec("INSERT INTO users_trophies (userid, trophie, reason, trophiepic) VALUES
($CURUSER[id], 'First Comment', 'Earned Star Trophie for posting their first torrent comment.', 'images/trophies/firstcomment.png')");
$trophieq = SQL_Query_exec("SELECT userid, trophie, trophiepic, reason FROM users_trophies LEFT JOIN users ON users.id = users_trophies.userid WHERE users_trophies.userid = $result2[user]");
if (mysql_num_rows($trophieq)){
while($trophie = mysql_fetch_assoc($trophieq)) {
// Retrieve users trophies - June 11, 2020
$trophiename = $trophie["trophie"];
$reasonalt = $trophie["reason"];
$trophiepic = $trophie["trophiepic"];
echo "<span style='float:left;padding-right:3px'><img src='$site_config[SITEURL]/$trophiepic' title='$reasonalt' style='height:25px' /></span>";
}
}else{
echo "<div style='font-size:12px;color:#C0C0C0'>(none yet)</div>";
}
echo "</div>";
CREATE TABLE `users_trophies` (
`userid` int(10) unsigned NOT NULL DEFAULT 0,
`trophie` text NOT NULL,
`reason` text NOT NULL,
`trophiepic` text NOT NULL,
UNIQUE KEY `userfriend` (`userid`,`reason`) USING HASH
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
"m-jay, post: 68715, member: 20288":
add anything you wish (y) been distracted with server but this can go a few places just the link to the controllermethod/page needs changing ive updated 1st post, the type in likes table need to be changed comment for comment, forum for forum etc
for comments its this line in commenttable function
print('<th align="right">' . $edit . $delete . '[<a href="$site_config[SITEURL]/report?comment=' . $row["id"] . '">Report</a>] Posted: ' . date("d-m-Y \\a\\t H:i:s", utc_to_tz_time($row["added"])) . '<a id="comment' . $row["id"] . '"></a></th>');