找到你要的答案

Q:How would i go about producing a username instead of a user id in profile.php?

Q:我怎么会去制造一个用户名而不是在profile.php用户ID?

Ok guys well to boot this up what i am wanting is to remove the echo of userid in the url and replace it with the actual username.

the full code is in the link below the partial code.

if(!isset($_GET["u"]) || !($u = $db->getRow("SELECT * FROM `".MLS_PREFIX."users` WHERE `userid`= ?i", $_GET["u"]))){

http://pastebin.com/yM5gLAkr

EXAMPLE:

CURRENT: index.php?u=1

what i want: index.php?u=username

好好引导了我想要是去除URL中的用户标识符的回声和取代它与实际的用户名。

完整的代码在部分代码下面的链接中。

if(!isset($_GET["u"]) || !($u = $db->getRow("SELECT * FROM `".MLS_PREFIX."users` WHERE `userid`= ?i", $_GET["u"]))){

http://pastebin.com/ym5glakr

例子:

电流:index.php?U = 1

我想:index.php?U =用户名

answer1: 回答1:

Simply change WHERE userid= ?i to WHERE username= ?s

This should be enough, unless there's a bunch of other stuff using $_GET['u'].

You will also need to update every single link / form on the website that redirects with ?u=$userid.

Simply change WHERE userid= ?i to WHERE username= ?s

这应该是足够的,除非使用$ _get [ U ]其他的东西一堆。

你也将需要更新的网站上的每一个链接重定向/形式?U = $ userid。

php  .htaccess