Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 8.1
Author Message
gunit86
New Member
New Member



Joined: Apr 23, 2008
Posts: 13

PostPosted: Thu May 08, 2008 12:09 pm Reply with quote

I have downloaded the phbb user info block which doesn't have ip coding in it. So, I've downloaded a separate block which displays the user's ip. I would like to combine the ip block into the user menu block which make it into 1 block but I'm not too sure how to do that. Could someone help me with this. Here's the coding

Code:


<?php
if (eregi("block-IP_INFO.php",$PHP_SELF)) {
     Header("Location: index.php");
die();
}
//T-Tech.org © 2004 - Thomas
//IPINFO Block v1.0

global $user, $cookie;
cookiedecode($user);
$username = $cookie[1];
if ($username == "") {
$username = "Anonymous";
}

$message="Hello, <b>$username</b>";
$isphash = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$ispstr = preg_split("/\./", $isphash);
$xy = count($ispstr);
$x = $xy - 1;
$y = $xy - 2;
$i = $xy - 3;
$pc= "Name: <b>" . $ispstr[$i] . "</b>";
$isp = "Your isp: <b>" . $ispstr[$y] . "." . $ispstr[$x] . "</b>";
$ip = "Your ip: <b>" . $_SERVER['REMOTE_ADDR'] . "</b>";
$content ="<font size=\"-3\" face=\"Tahoma\">" . "$message" . "<br>" . "$ip" ."<br>" . "$isp" . "<br>" . "$pc" . "</font>";
?>


Code:


if (eregi("block-phpBB2_User_Menu.php", $PHP_SELF)) {     
    Header("Location: index.php");
    die();
}
$content = "";

require_once("mainfile.php");
global $user, $cookie, $prefix, $user_prefix, $dbi, $anonymous, $userinfo, $Default_Theme;
getusrinfo($user);

cookiedecode($user);
$ip = getenv("REMOTE_ADDR");
$username = $cookie[1];
if (!isset($username)) {
    $username = "$ip";
    $guest = 1;
}
$past = time()-900;
sql_query("DELETE FROM $prefix"._session." WHERE time < $past", $dbi);
$result = sql_query("SELECT time FROM $prefix"._session." WHERE uname='$username'", $dbi);
$ctime = time();
if ($row = sql_fetch_array($result, $dbi)) {
    sql_query("UPDATE $prefix"._session." SET uname='$username', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$username'", $dbi);
} else {
    sql_query("INSERT INTO $prefix"._session." (uname, time, host_addr, guest) VALUES ('$username', '$ctime', '$ip', '$guest')", $dbi);
}

$result = sql_query("SELECT username FROM ".$prefix."_users order by user_id DESC limit 0,1", $dbi);
list($lastuser) = sql_fetch_row($result, $dbi);
$result3 = sql_query("SELECT user_id FROM ".$prefix."_users order by user_id DESC limit 0,1", $dbi);
list($ulast) = sql_fetch_row($result3, $dbi);
$numrows = sql_num_rows(sql_query("select user_id from $user_prefix"._users." where user_id <>1 ", $dbi), $dbi);
$result2 = sql_query("SELECT uname,guest FROM $prefix"._session." where guest=0", $dbi);
$member_online_num = sql_num_rows($result2, $dbi);
$who_online_now = "";
$i = 1;
while ($session = sql_fetch_array($result2, $dbi)) {
    if (isset($session["guest"]) and $session["guest"] == 0) {
       $result5 = sql_query("SELECT user_id FROM ".$prefix."_users where username='$session[uname]'", $dbi);
          list($user_id) = sql_fetch_row($result5, $dbi);
        if ($i < 10) {
            $who_online_now .= "&nbsp;$i:&nbsp;<A HREF=\"profile-.html$user_id\">$session[uname]</a><br>\n";
        } else {
            $who_online_now .= "$i:&nbsp;<A HREF=\"profile-.html$user_id\">$session[uname]</a><br>\n";
        }
        $who_online_now .= ($i != $member_online_num ? "  " : "");
        $i++;
    }
}



// Calculate Who's Online

$result = sql_query("SELECT uname FROM $prefix"._session." where guest=1", $dbi);

$guest_online_num = sql_num_rows($result, $dbi);



$result = sql_query("SELECT uname FROM $prefix"._session." where guest=0", $dbi);

$member_online_num = sql_num_rows($result, $dbi);



$who_online_num = $guest_online_num + $member_online_num;



if (is_user($user)) {



    // For Members

    if ($userinfo[user_avatar]) {

      $content .= "<center><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" alt=\"\"><br>\n";

   }

   $content .= "<b>$username</b><br></center>\n";

   $result = sql_query("select user_id from $user_prefix"._users." where username='$username'", $dbi);

    list($user_id) = sql_fetch_row($result, $dbi);

    $result2 = sql_query("select privmsgs_to_userid from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' and privmsgs_type ='0'", $dbi);

    $newpms = sql_num_rows($result2, $dbi);

    $result3 = sql_query("select privmsgs_to_userid from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' and privmsgs_type ='1'", $dbi);

    $oldpms = sql_num_rows($result3, $dbi);

   

   // Members Menu

   $content .= "<img src=images/blocks/phpBB2_User_Menu/icon_menu.gif>&nbsp;<b>"._UMBMENU."</b><BR>\n";

   $content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n";

   $content .= "<TR><FORM METHOD=GET ACTION=\"modules.php\">\n";

   $content .= "<TD><img src=images/blocks/phpBB2_User_Menu/icon_select.gif>&nbsp;<SELECT NAME=\"name\" CLASS=\"boxcontent\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";

   $content .= "<OPTION VALUE=\"\">"._UMBSELECT."";

   $content .= "<OPTION VALUE=\"forums.html?file=profile&mode=editprofile\">"._UMBCHANGEYOURINFO."\n";

   $content .= "<OPTION VALUE=\"modules.php?name=Your_Account&amp;op=edithome\">"._UMBCHANGEHOME."\n";

   $content .= "<OPTION VALUE=\"modules.php?name=Your_Account&amp;op=editcomm\">"._UMBCHANGECOMM."\n";

   $content .= "</SELECT></TD></TR></FORM></TABLE>";



   // Exit

   $content .= "<img src=images/blocks/phpBB2_User_Menu/icon_logout.gif>&nbsp;<a href=\"account-logout.html\">"._UMBEXIT."</a><br>\n";


   // Private Messages

   $content .= "<a href=\"messages.html\"><img src=\"images/blocks/phpBB2_User_Menu/icon_pm.gif\" border=\"0\" ALT=\""._UMBPM."\"></a>&nbsp;<b>"._UMBPM.":</b>\n";

    $content .= "<a href=\"messages.html\"><b>$newpms</b></a>&nbsp;<img src=images/blocks/phpBB2_User_Menu/icon_new.gif><br>\n";

   

} else {
// Info for guests (users who didn't log in)
   if (!is_user($user)) {
       mt_srand ((double)microtime()*1000000);
       $maxran = 1000000;
       $random_num = mt_rand(0, $maxran);
   }
$content .= "<center><img src=\"images/blocks/phpBB2_User_Menu/icon_who.gif\" alt=\"\"><br>\n";
$content .= "<b>$anonymous</b><br></center>\n";
$content .="<form action=\"account.html\" method=\"post\">\n";
$content .="<table border=\"0\"><tr><td>\n";
$content .=""._NICKNAME.":</td></tr>\n";
$content .="<tr><td><input type=\"text\" name=\"username\" size=\"15\" maxlength=\"25\"></td></tr>\n";
$content .="<tr><td>"._PASSWORD.":</td></tr>\n";
$content .="<tr><td><input type=\"password\" name=\"user_password\" size=\"15\" maxlength=\"20\"></td></tr>\n";
       if (extension_loaded("gd")) {
//$content .="<tr><td colspan='2'>"._SECURITYCODE.": <img src='modules.php?name=Your_Account&op=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td></tr>\n";
//$content .="<tr><td colspan='2'>"._TYPESECCODE.": <input type=\"text\" NAME=\"gfx_check\" SIZE=\"15\" MAXLENGTH=\"10\"></td></tr>\n";
$content .="<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
       }
$content .="</table><input type=\"hidden\" name=\"redirect\" value=$redirect>\n";
$content .="<input type=\"hidden\" name=\"mode\" value=$mode>\n";
$content .="<input type=\"hidden\" name=\"f\" value=$f>\n";
$content .="<input type=\"hidden\" name=\"t\" value=$t>\n";
$content .="<input type=\"hidden\" name=\"op\" value=\"login\">\n";
$content .="<input type=\"submit\" value=\""._LOGIN."\"></form><br>\n\n";


   $content .= "<img src=images/blocks/phpBB2_User_Menu/icon_dot.gif>&nbsp;<a href=\"forums.html?file=profile&mode=register\">"._UMBREG."</a><BR>\n";

   $content .= "<img src=images/blocks/phpBB2_User_Menu/icon_dot.gif>&nbsp;<a href=\"modules.php?name=Your_Account&amp;op=pass_lost\">"._UMBLOST."</a><BR>\n";

}



// Submit

//$content .= "</center><BR><img src=images/blocks/phpBB2_User_Menu/icon_news.gif>&nbsp;<b>"._UMBSUBMIT."</a></b><BR>\n";

//$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n";

//$content .= "<TR><FORM METHOD=GET ACTION=\"modules.php\">\n";

//$content .= "<TD><img src=images/blocks/phpBB2_User_Menu/icon_select.gif>&nbsp;<SELECT NAME=\"name\" CLASS=\"boxcontent\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";

//$content .= "<OPTION VALUE=\"\">"._UMBSELECT."";

//$content .= "<OPTION VALUE=\"messages-post-2.html\">"._UMBNEWS."\n";

//$content .= "<OPTION VALUE=\"modules.php?name=Downloads&amp;d_op=AddDownload\">"._UMBADDD."\n";

//$content .= "<OPTION VALUE=\"links.html?amp;l_op=AddLink\">"._UMBADDL."\n";

//$content .= "</SELECT></TD></TR></FORM></TABLE>";


// Members Stats
$content .= "<BR><a href=\"members.html\"><img src=\"images/blocks/phpBB2_User_Menu/icon_profile.gif\" border=\"0\" ALT=\""._UMBMEMP."\"></a>&nbsp;<b>"._UMBMEMP.":</b><br>\n";

$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_last.gif>&nbsp;"._UMBLATEST.": <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\"profile-.html$ulast\"><b>$lastuser</b></a>&nbsp;<img src=images/blocks/phpBB2_User_Menu/icon_new.gif><br>\n";

$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_registered.gif>&nbsp;"._UMBOVER.": <b>$numrows</b><br>\n";



// Who's Online

$content .= "<BR><a href=\"members.html\"><img src=\"images/blocks/phpBB2_User_Menu/icon_connect.gif\" border=\"0\" ALT=\""._UMBON."\"></a>&nbsp;<b>"._UMBON."[$who_online_num]:</b><br>\n";

$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_users.gif>&nbsp;"._UMBVIS.": <b>$guest_online_num</b><br>\n";

$content .= "<img src=images/blocks/phpBB2_User_Menu/icon_registered.gif>&nbsp;"._UMBMEM.": <b>$member_online_num</b><br>\n";

if ($member_online_num > 0) {

   $content .= "$who_online_now<br>";

}
cookiedecode($user);
$username = $cookie[1];
$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where username='$username'", $dbi);
list($numrow) = sql_fetch_row($result, $dbi);
if ($numrow > 0) {
   echo "<script language='javascript'>\n"
             ."<!--\n"
             ."var win = window.open('modules.php?name=Private_Messages&popup=1&mode=newpm', '', 'height=225,width=400')"
             ."//-->\n"
             ."</script>";
}



// Total Hits

$result = sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'", $dbi);

$result = sql_fetch_row($result, $dbi);

$content .= "<BR><center><img src=images/blocks/phpBB2_User_Menu/icon_hit.gif ><br><small>"._WERECEIVED."</small><br><b><a href=\"stats.html\">$result[0]</a></b></small></center>";



?>

 
View user's profile Send private message
sting
Involved
Involved



Joined: Sep 23, 2003
Posts: 456
Location: Somewhere out there...

PostPosted: Fri May 09, 2008 8:46 am Reply with quote

You will need to take the code that you need from the IP block that gets the ip into a variable, then add the variable to the $content at the end of the phpbb block with appropriate formatting and/or preferred labeling.

Merge only what you need from the one file into the other.

-sting

_________________
You see - I told you I wasn't paranoid. They were really out to get me. 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 8.1

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 ©