Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
Tommyguns
Hangin' Around



Joined: Jul 07, 2004
Posts: 32

PostPosted: Mon Nov 22, 2004 7:26 am Reply with quote

How do I get the "Your IP: 65.*.***.***" showing like you do in the User Info Block?
 
View user's profile Send private message Visit poster's website MSN Messenger
sixonetonoffun
Spouse Contemplates Divorce



Joined: Jan 02, 2003
Posts: 2496

PostPosted: Mon Nov 22, 2004 8:16 am Reply with quote

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 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Mon Nov 22, 2004 9:11 am Reply with quote

Shocked
 
View user's profile Send private message
Tommyguns







PostPosted: Mon Nov 22, 2004 10:23 am Reply with quote

But where do I place that in the Block.php?
 
Raven







PostPosted: Mon Nov 22, 2004 12:55 pm Reply with quote

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
Regular



Joined: Oct 08, 2004
Posts: 55
Location: Texas

PostPosted: Tue Nov 23, 2004 4:45 am Reply with quote

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 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Tommyguns







PostPosted: Tue Nov 23, 2004 12:58 pm Reply with quote

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







PostPosted: Wed Nov 24, 2004 2:43 am Reply with quote

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
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©