Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Ajax Shoutbox V3
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods in Progress

2020-12-14 01:34:12
I understand what you are saying, but its not that simple unfortunately. The database entry would have to have a CSS or HTML tag on it for it to display the color you want, so you would have to write code to add that info to the reply so it adds it when it gets inserted into your database.
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-12-14 04:15:22
I use js to feed tags and pull data out through json, i wish could be of more help, its become complex on my end for what it does now that its hardly php anymore
2020-12-14 19:41:03
Hello the box with the bbcode is not displayed ??


[ATTACH type="full"]5997[/ATTACH]
1607974675132.png
1607974675132.png
2020-12-14 20:12:09
A function could take care of this, returning a colour code wrapping class_user(), based on the ID. More elegant than writing a bunch of code for 1 spot to get the desired colour array
2020-12-16 02:16:19
"STorrents2020, post: 69703, member: 20382":

A function could take care of this, returning a colour code wrapping class_user(), based on the ID. More elegant than writing a bunch of code for 1 spot to get the desired colour array

ok, so no other choice;) I'll make do with it
thank you for all !!
(y) ?
2021-05-29 21:42:51
spiritblue:
Search code:
if ($CURUSER['id'] == $row['uid'] ) {  
 $mid=$row['id'];
 if ($CURUSER["edit_users"]=="yes";) {
 $edit="<a href='javascript:editup($mid,$CURUSER[id]);' style='font-size: 8px'><img id='EditSwap' src='images/ajshoutbox/shout_edit_gray.gif' border='0' title=".T_("EDIT";)."\n></a><a href='javascript:delup($mid);' style='font-size: 8px'><img id='DeleteSwap' src='images/ajshoutbox/shout_delete_gray.png' border='0' title=".T_("_DEL_";)."\n></a>";
 }
 }else
 if ($CURUSER['id']) {
 $edit="<a href='mailbox.php?compose&id=$uid'><img src='images/ajshoutbox/pm.png' border='0' width='22' height='22' title='Send a private message' alt='Send a private message'></a><a href=javascript:Reply_code('&#10148;".$row['name'].":','chatForm','chatbarText')><img src='images/ajshoutbox/reply.png' border='0' width='22' height='22' style='padding: 0px 0px 0px 3px;' title='Reply to this shout' alt='Reply to this shout'\n></a>";
 }



Replace with:
spiritblue:

if ( ($CURUSER["edit_users"]=="yes";) || ($CURUSER['id'] == $row['uid']) ){
 $mid=$row['id'];
 $edit="<a href='javascript:editup($mid,$CURUSER[id]);' style='font-size: 8px'><img id='EditSwap' src='images/ajshoutbox/shout_edit_gray.gif' border='0' title=".T_("EDIT";)."\n></a><a href='javascript:delup($mid);' style='font-size: 8px'><img id='DeleteSwap' src='images/ajshoutbox/shout_delete_gray.png' border='0' title=".T_("_DEL_";)."\n></a>";
 }else
 if ($CURUSER['id']) {
 $edit="<a href='mailbox.php?compose&id=$uid'><img src='images/ajshoutbox/pm.png' border='0' width='22' height='22' title='Send a private message' alt='Send a private message'></a><a href=javascript:Reply_code('&#10148;".$row['name'].":','chatForm','chatbarText')><img src='images/ajshoutbox/reply.png' border='0' width='22' height='22' style='padding: 0px 0px 0px 3px;' title='Reply to this shout' alt='Reply to this shout'\n></a>";
 }



In my case, this does not work well, my users class 5 and above do not see the PM and Reply buttons



Last edited by coco on 2021-05-29 21:46:34
2021-06-03 20:29:30
@coco I can't see shoutbox on you test page at all, used FF, GC and TOR to check it but resultate is the same


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2021-06-04 08:00:37
I also don't see it, maybe the host is a problem. Thanks for the help

Edit: I am very, very stupid. I have no words for myself. Maybe I'm getting old. Everything works perfectly. You just have to see it :)
Last edited by coco on 2021-06-04 21:06:04
2021-06-04 21:18:23
I search and search and search where i'm wrong but whithout success
Where am i wrong?
class_user not working and not working, what did you not do and did not replace, help guys please


2021-06-06 13:34:10
@coco I can't see shoutbox on you test page at all, used FF, GC and TOR to check it but resultate is the same

idem
2021-06-06 19:08:47
I will find a solution to this problem, I am close. Thanks Sly thanks for the help guys

How MM said
Quote:
its because a reply in the shoutbox is inserted as plain text into the database, including the username you are replying to. its not an object


Thanks again and Regards
2021-06-11 18:10:02
it’s strange I won’t deny that, reason. Most development goes like this:

<span class=“shoutbox <?=(class_user[$var] == 1) : ‘staff’ ? ‘member’?>”>class_user[$var]</span>

So your letting the class_user() function decide the style class. From there it should be in CSS file.

Otherwise, it’s 2 JOINs between groups and users table providing that hexadecimal colour value.
2023-05-25 23:28:27
removed mysqli_result (the original quick-fix) in getshout.php
      $query = SQL_Query_exec("SELECT id FROM users WHERE username = " . sqlesc($Data));

     if (mysqli_num_rows($query) > 0) {
       $row = mysqli_fetch_assoc($query);
       $Userid = $row['id'];
       (SQL_Query_exec("DELETE FROM ajshoutbox WHERE uid = " . sqlesc($Userid)) OR sqlerr(__FILE__, 293));
       execcommand_message();
     }

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2023-05-25 23:31:47
2023-05-27 04:21:19
Just point $row to the fetch method.

if ($row = mysqli_fetch_assoc($query)) { ... }

PHP automatically checks if result set is available, otherwise it returns false. Thats all you need to do. By wrapping $row, your assigning it so you can read it in the scope { ... }

---

Now if you want to check if query result(s) are empty first, you do this

if (!($row = mysqli_fetch_assoc($query))) {
  // $row not available - INSERT, DELETE FROM, etc
} else {
   // $row available - UPDATE, DELETE FROM, continue, etc
}


So you dont need to use this

$mysqli->mysqli_num_rows()
$pdo->getRowCount()


These methods above are good for counters, database related tracking (eg. inserting to column "Imported row 1/27 successful" or presenting a count on front-end webpage. I personally use a $i++ counter at all times. I dont see the need for these and the overhead associated. Raw PHP as much as possible (performance).


$query = SQL_Query_exec("SELECT id FROM users WHERE username = " . sqlesc($Data));
if ($row = mysqli_fetch_assoc($query)) {
  $Userid = $row['id'];
  SQL_Query_exec("DELETE FROM ajshoutbox WHERE uid = " . sqlesc($Userid)) or sqlerr(__FILE__, 293));
  execcommand_message();
}
Last edited by STorrents2020 on 2023-05-27 04:26:52
2023-05-27 18:03:16
this was the original code. It used to be mysql_result which is no longer a function, so I researched a fix, which is
function mysqli_result($res,$row=0,$col=0){
   $numrows = mysqli_num_rows($res);
   if ($numrows && $row <= ($numrows-1) && $row >=0){
       mysqli_data_seek($res,$row);
       $resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
       if (isset($resrow[$col])){
           return $resrow[$col];
       }
   }
   return false;
}


      $query = SQL_Query_exec ("SELECT id FROM users WHERE username = " . sqlesc ($Data));
     if (0 < mysqli_num_rows ($query))
     {
       $Userid = mysqli_result ($query, 0, 'id');  
       (SQL_Query_exec ("delete from ajshoutbox where uid = " . sqlesc ($Userid)) OR sqlerr (__FILE__, 293));
       execcommand_message ();
     }

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2023-05-27 18:06:00
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728