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
[SOLVED] Show username instead of id num
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

Unknown User
2019-05-01 21:29:20
I saw many torrenttrader tackers have it. For example, I want it to be account-details.php?id=shadows instead of account-details.php?id=1
2019-05-04 00:16:23
this would probably require using mod-rewrite and adding things to HTACCESS. Just curious, why do you want to do this?
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)
Unknown User
2019-05-04 09:06:34
"MicroMonkey, post: 66518, member: 311":

this would probably require using mod-rewrite and adding things to HTACCESS. Just curious, why do you want to do this?

It looks way better and user friendly. I changed htaccess to be like user/number but cant get username there. I found that on ettv.to, prostylex.com, torrentgalaxy.org, etc. Every single of them uses it

This is my htaccess
RewriteRule ^user/([0-9]+) account-details.php?id=$1 [L,QSA]

Edit: I think this needs to be changed in account-details.php $id = (int)$_GET["id"];
Unknown User
2019-05-04 21:54:23
Bump

For example on this torrenttrader both versions work:

[url='https://torrentgalaxy.org/account-details.php?id=shadow']https://torrentgalaxy.org/account-details.php?id=[/url]shadows
[url='https://torrentgalaxy.org/account-details.php?id=shadow']https://torrentgalaxy.org/account-details.php?id=[/url]1222
Unknown User
2019-05-05 12:39:34
It probably have to do something with this part from functions.php

The code below is checking if the valid id, but we need one for a valid username

function is_valid_id($id){
   return is_numeric($id) && ($id > 0) && (floor($id) == $id);
}

function is_valid_int($id){
   return is_numeric($id) && (floor($id) == $id);
}[/code[
2019-05-05 12:51:34
try what these people are saying. https://stackoverflow.com/questions/1039725/how-to-do-url-re-writing-in-php
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)
Unknown User
2019-05-05 13:27:40
"MicroMonkey, post: 66532, member: 311":

It always gives bad id output. There must be a call from SQL to show username instead of id. I tried with $r = @SQL_Query_exec("SELECT * FROM users WHERE username = $id");
but doesnt work.
2019-05-05 14:11:53
probably $row['username']
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)
Unknown User
2019-05-05 14:26:59
Still not working

Database Error in account-details.php on line 13: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1. Query was: SELECT * FROM users WHERE username = .
Unknown User
2019-05-05 14:36:13
"MicroMonkey, post: 66534, member: 311":

probably $row['username']

PS: With $r = @SQL_Query_exec("SELECT * FROM users WHERE username = '".$user["username"]."' "); it doesn't show the SQL error, but it shows There is no user with ID: admin.
Which comes from this line below SQL $user = mysqli_fetch_array($r) or  show_error_msg(T_("NO_SHOW_DETAILS"), T_("NO_USER_WITH_ID")." $id.",1);
Unknown User
2019-05-05 17:46:59
I finally figured it out

In account-details.php remove
if (!is_valid_id($id))
show_error_msg(T_("NO_SHOW_DETAILS"), "Bad ID.",1);


Now at the top of the code add the following:
$id2 = $_GET['name'];

$r2 = @SQL_Query_exec("SELECT * FROM `users` WHERE `username` = '$id2'");
$user2 = mysqli_fetch_array($r2) or  show_error_msg(T_("NO_SHOW_DETAILS"), T_("NO_USER_WITH_ID")." $id2.",1);


Open browser and type: yourdomain.com/account-details.php?name=admin or any username.
2019-05-05 19:01:01
nice job. Thanks for posting your findings
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)
Unknown User
2019-10-06 10:25:55
Use sqlesc on that input
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