just another way to rewrites url profiles

346
.
remoded rewrite url profile by me, work with bbcode @username

1# . put on htaccess root
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^user_(.*?)$ /users/profile.php?wl=$1 [NC,L]

user link = http://aipome.net/user_usernames

2#. for bbcode.php
find this
public static function tags($var)
    {

put this code under thats
$var = preg_replace('#@([\w\d]{2,})#si', '@<a href="../user_$1">$1</a>', $var);

and find this too;
static function notags($var = '')
    {

put this code under that
$var = preg_replace('#@([\w\d]{2,})#si', '@<a href="../user_$1">$1</a>', $var);


3#. and for profile.php put this code;
$name_lat = isset($_GET['wl']) ? trim($_GET['wl']) : '';
$name_lat = functions::rus_lat(mb_strtolower($name_lat));
if (!empty($name_lat)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `name_lat` = '" . mysql_real_escape_string($name_lat) . "' LIMIT 1;"), 0) != 0)
$user = mysql_result(mysql_query("SELECT `id` FROM `users` WHERE `name_lat` = '" . mysql_real_escape_string($name_lat) . "' LIMIT 1;"), 0);
else $user = -1;
}


place under ;
$lng_profile = core::load_lng('profile');


4#. code to link to /user_names
<a href="'$home.'/user_' . functions::smileys(bbcode::tags($user['name'])) . '">

edit this $user['name'] ass your sql query, e.g for functions.php you can use $user['name'] and for index.php forum u can use $res['name']

DEMO ; aipome.net

hope you enjoyed :beer
.
good job!
.
Screamer (21.09.2012/20:48)
good job!
thank sir, if any bugs please help remoded
.
jimy, Ок
.
Screamer (21.09.2012/20:55)
jimy, Ок
before this i try use http://site/usernames but i think it will crash if any user reg use name cpanel, http://site/cpanel
.
jimy, maybe can use id of user
for example: http://site.com/id_number_of_id
or use subdomain
http://nickname.domain.com/
so more beautiful in my opinion
.
Screamer (21.09.2012/21:02)
jimy, maybe can use id of user
for example: http://site.com/id_number_of_id
or use subdomain
http://nickname.domain.com/
so more beautiful in my opinion
yes u can use id too, but i never try it , me try to hidding user id from url bar,
and for sub domain may be u can try using this code for htacces

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
RewriteCond %1 !^(www|ftp|mail)$ [NC]
RewriteRule ^user_(.*?)$ /users/profile.php?wl=$1 [NC,L]
.
jimy (21.09.2012/21:11)
me try to hidding user id from url bar
why? what sense? In other places user can to view it.
.
Screamer (21.09.2012/21:14)
why? what sense? In other places user can to view it.
i dont know, just want to hide only that
.
tag user @jimy @usernames in bbcodes
Всего: 10