Author |
Message |
Tommyguns
Hangin' Around
Joined: Jul 07, 2004
Posts: 32
|
Posted:
Mon Nov 22, 2004 7:26 am |
|
How do I get the "Your IP: 65.*.***.***" showing like you do in the User Info Block? |
|
|
|
|
sixonetonoffun
Spouse Contemplates Divorce
Joined: Jan 02, 2003
Posts: 2496
|
Posted:
Mon Nov 22, 2004 8:16 am |
|
That was the first question I asked Raven almost 2 yrs ago lol
[ Only registered users can see links on this board! Get registered or login! ]
This is the very simple solution I used at the time:
$IP = substr_replace($IP, '.*.*', 6);
echo ($IP); |
_________________ [b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 |
|
|
|
Raven
Site Admin/Owner
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Mon Nov 22, 2004 9:11 am |
|
|
|
|
Tommyguns
|
Posted:
Mon Nov 22, 2004 10:23 am |
|
But where do I place that in the Block.php? |
|
|
|
|
Raven
|
Posted:
Mon Nov 22, 2004 12:55 pm |
|
At the point you want it to show. If you want it above the image, like mine, find where the image is added int $content and place it above that line. |
|
|
|
|
elrayjones
Regular
Joined: Oct 08, 2004
Posts: 55
Location: Texas
|
Posted:
Tue Nov 23, 2004 4:45 am |
|
Tommyguns wrote: | But where do I place that in the Block.php? |
open block-User_Info.php
At or around line 208 find:
if (is_user($user)) {
$sqlp = "SELECT user_posts AS posts FROM $user_prefix"._users." WHERE username = '$uname'";
$result = $db->sql_query($sqlp);
$row = $db->sql_fetchrow($result);
$posts = $row[posts];
$sql = "SELECT user_avatar FROM " . $prefix."_users WHERE username='$uname' AND user_avatar IS NOT NULL";
$result = $db->sql_query($sql);
if ($result) {
$userinfo = $db->sql_fetchrow($result);
if ( ereg( "(http)", $userinfo[user_avatar]) ) {
$content .= "<br /><center><img src=\"$userinfo[user_avatar]\" /></center>\n";
}
else
if ($userinfo[user_avatar]) {
."</b></center>" ;
$content .= "<br /><center><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" /></center>\n";
}
}
Replace with:
if (is_user($user)) {
$sqlp = "SELECT user_posts AS posts FROM $user_prefix"._users." WHERE username = '$uname'";
$result = $db->sql_query($sqlp);
$row = $db->sql_fetchrow($result);
$posts = $row[posts];
$sql = "SELECT user_avatar FROM " . $prefix."_users WHERE username='$uname' AND user_avatar IS NOT NULL";
$result = $db->sql_query($sql);
if ($result) {
$userinfo = $db->sql_fetchrow($result);
if ( ereg( "(http)", $userinfo[user_avatar]) ) {
$content .= "<br /><center><img src=\"$userinfo[user_avatar]\" /></center>\n";
}
else
if ($userinfo[user_avatar]) {
$content .= "<center><b>IP: " . $_SERVER["REMOTE_ADDR"] ."</b></center>" ;
$content .= "<br /><center><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" /></center>\n";
}
}
i use $content .= "<center><b>IP: " . $_SERVER["REMOTE_ADDR"] ."</b></center>" ; |
_________________ Shopping Mall at godotshop We have Video Games,Toys,DVD,Camera,Magazine Subscriptions,Music,Apparel,Inkjet,Food,Garden,Electronics,Kitchen,Cell Phones, Tapestry and much more |
|
|
|
Tommyguns
|
Posted:
Tue Nov 23, 2004 12:58 pm |
|
I tried that but needed to do it this way to make it work:
Code:if (is_user($user)) {
$sqlp = "SELECT user_posts AS posts FROM $user_prefix"._users." WHERE username = '$uname'";
$result = $db->sql_query($sqlp);
$row = $db->sql_fetchrow($result);
$posts = $row[posts];
$content .= "<center><b>Your IP: " . $_SERVER["REMOTE_ADDR"] ."</b></center>" ;
$sql = "SELECT user_avatar FROM " . $prefix."_users WHERE username='$uname' AND user_avatar IS NOT NULL";
$result = $db->sql_query($sql);
if ($result) {
$userinfo = $db->sql_fetchrow($result);
if ( ereg( "(http)", $userinfo[user_avatar]) ) {
$content .= "<br /><center><img src=\"$userinfo[user_avatar]\" /></center>\n";
}
else
if ($userinfo[user_avatar]) {
$content .= "<br /><center><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" /></center>\n";
}
}
|
|
|
|
|
|
elrayjones
|
Posted:
Wed Nov 24, 2004 2:43 am |
|
I placed the code so the IP would show up after the user loged on. but after thinking about i think i will place it where it shows all the time. glad I could help.
EJ |
|
|
|
|
|