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
Steptoe
Involved
Involved


Joined: Oct 09, 2004
Posts: 293

PostPosted: Mon Jul 18, 2005 6:05 pm Reply with quote

I have this Where is block that I want to put into my custom user info block so the links show at the end or under the visitors ip/members name, only if a member is logged in. both blocks works by themselves ok
Code:


if (eregi("block-Who-is-Where.php",$_SERVER[PHP_SELF])) {
    Header("Location: ../index.php");
    die();
}

$content = '';
global $admin, $user, $cookie, $prefix, $user_prefix,$db, $anonymous,$name,$lang;

define('_MIN','' ');
define('_SEC','"');

if ($lang=='french') {
   define("_MEMBRES","Membres ");
   define("_VISITEURS","Visiteurs ");
   define("_VISITEUR","Visiteur ");
} else if ($lang=='russian') {
   define("_MEMBRES","ÎŰňÝű");
   define("_VISITEURS","¤ţ˝ň˛Ŕ˛ňŰŔ");
   define("_VISITEUR","¤ţ˝ň˛Ŕ˛ňŰŔ");
} else if ($lang=='spanish') {
   define("_MEMBRES","Miembro");
   define("_VISITEURS","Visitante");
   define("_VISITEUR","Visitantes");
} else if ($lang=='italian') {
   define("_MEMBRES","Membri");
   define("_VISITEURS","Ospiti");
   define("_VISITEUR","Ospite");
} else if ($lang=='portuguese') {
   define("_MEMBRES","Miembro");
   define("_VISITEURS","Visitantes");
   define("_VISITEUR","Visitante");
} else {
   define("_MEMBRES","Members");
   define("_VISITEURS","Visitors");
   define("_VISITEUR","Visitor");
}

$who_online[0] = "";
$who_online[1] = "";
$num[0] = 1;
$num[1] = 1;

/**
 * function that displays
 * int timeSec : time in seconds
 * @return String timeDisplay
 */
function displayTime($sec) {
   $minutes = floor($sec / 60);
   $seconds = $sec % 60;
   if ($minutes == 0) {
      return $seconds . _SEC;
   }
   return $minutes . _MIN . $seconds . _SEC;
}

// Query
$result = $db->sql_query("select username, guest, module, url, UNIX_TIMESTAMP(now())-time AS time from ".$prefix."_whoiswhere order by username");
$member_online_num  = $db->sql_numrows($result);

// Display Section
while ($session = $db->sql_fetchrow($result)) {
   //--- guest can only be 0 or 1
   $guest = $session["guest"];
   if ($num[$guest] < 10) {
      $who_online[$guest] .= "0";
   }
   
   if ($guest == 0) {
      $title = "<A HREF=\"modules.php?name=Your_Account&op=userinfo&uname=$session[username]\" title=\"" . displayTime($session[time]) . "\">$session[username]</a>";
   } else {
      //--- Anonymous user
      if (isset($admin)) {
         $title = '<A title="' . displayTime($session[time]) . "\">$session[username]</a>";
      } else {
         $title = '<A title="' . displayTime($session[time]) . '">' . _VISITEUR . '</a>';
      }
   }

   $who_online[$guest] .= "$num[$guest]:&nbsp;$title -&gt; <a href=\"$session[url]\" target=\"_blank\">$session[module]</a><br>\n";
   $num[$guest]++;
}

//--- Members
if ($who_online[0] != "") {
   $content = "<img src=\"images/Who-is-Where/members.gif\">&nbsp;<span class=\"content\"><b>"._MEMBRES.":</b></span><br>$who_online[0]<br>";
}

//--- Anonymous
if ($who_online[1] != "") {
   $content .= "<img src=\"images/Who-is-Where/visitors.gif\">&nbsp;<span class=\"content\"><b>"._VISITEURS.":</b></span><br>$who_online[1]";
}

// the link will be display only for anonymous user...
// please let it for my future work on this funny block
// it's a copyright don't remove it
if (!isset($user)) {
      $content .= "<center>".ucfirst(_BY)." <a href=\"http://www.creation-de-site-brest.com\" target=\"_blank\">Creation site</a></center>";
}
?>


I think it has to go some where into the user_info block here
Also the PM links when clked the PM window does automatically show the recipent name...If anyone has an asnswer to that to please?
Code:
/* NOW ONLINE */

$content .= "<div align=\"center\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=$TBLWIDTH>\n";
$content .= "<tr><td width=\"100%\" colspan=\"2\"><img src=\"images/blocks/group.gif\" height=\"16\" width=\"17\" align=\"absmiddle\"> <b>"._BVISIT."</b><br><img src=images/blocks/spacer.gif border=0><br><img src=images/blocks/spacer.gif border=0></td></tr>\n";
////vistor heading
$content .= "<tr><td width=\"85%\"><p align=\"left\">&nbsp;<img src=\"images/blocks/guest.gif\" width=\"14\" height=\"14\" align=\"absmiddle\"><b>"._BVIS."</b> </td>\n";
///number of visitors
$content .= "<td width=\"15%\"><p align=\"right\"><b>$guest_online_num</b></td></tr>\n";
if ($gmember_online_num > 0) {
   /////VISITORS ip details
$content .= "<tr><td width=\"100%\" colspan=\"2\">$gwho_online_now<br><img src=images/blocks/space.gif border=0></td></tr>\n";
} else {
$content .= "<tr><td width=\"100%\" colspan=\"2\"><img src=images/blocks/space.gif border=0></td></tr>\n";
}
////memberheading
$content .= "<tr><td width=\"85%\"><p align=\"left\">&nbsp;<img src=\"images/blocks/member.gif\" width=\"14\" height=\"14\" align=\"absmiddle\"><b>"._BMEM."</b> </td>\n";
///number of members
$content .= "<td width=\"15%\"><p align=\"right\"><b>$member_online_num</b></td></tr>\n";
if ($member_online_num > 0) {
////member  name flag and PM link...PM link when clicked, opens send PM but the recipient name not automatically entered..needs fixing???
$content .= "<tr><td width=\"100%\" colspan=\"2\">$who_online_now</td></tr>\n";
} else {
$content .= "<tr><td width=\"100%\" colspan=\"2\"><img src=images/blocks/space.gif border=0></td></tr>\n";
}
$content .= "<tr><td width=\"100%\" colspan=\"2\"><img src=images/blocks/space.gif border=0></td></tr>\n";
////total on line heading
$content .= "<tr><td width=\"90%\"><p align=\"left\">&nbsp;<img src=\"images/blocks/admin.gif\" width=\"14\" height=\"14\" align=\"absmiddle\"><b>"._BTT." online</b></td>\n";
////total number on line
$content .= "<td width=\"10%\"><p align=\"right\"><b>$who_online_num</b></td></tr>\n";
$content .= "</table></div><hr noshade size=1>\n";
 
View user's profile Send private message
sting
Involved
Involved


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

PostPosted: Tue Aug 02, 2005 8:46 am Reply with quote

First off, you are going to need to tweak a bit of code if you are planning to merge the two into one - for example, you will need to take out of whichever block you decide to put into another the top few lines:

Example:
Code:
if (eregi("block-Who-is-Where.php",$_SERVER[PHP_SELF])) {

    Header("Location: ../index.php");
    die();
}


would need to be removed if you were putting Who is Where INTO the User Info Block as the block is no longer called block-Who-is-Where.php...

Secondly, you will need to go through your who is where block and make sure that all of the declared variables are declared in the User Info block - and that there are no double declarations occurring, as you could end up with some interesting data.

From there it should be a matter of formatting. Of course it never is...

-sting
 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Steptoe
PostPosted: Sat Aug 06, 2005 3:33 pm Reply with quote

Give me a welder, a hot rod, lathe and milling machine,a small network 100 odd machines, hardware, I am good on that stuff...languages, including code, draw a pic...my head talents just will not get my head around those.
I certainly try, hence the time frame since your post lol and neen playing wijh this for 4 months now.
I see the principle of what u are saying , its the 'full stops, commas' and in the right place that is screwing me around lol.
I would appreciate if someone could put it together/finish it for me please?
Im not interested in releasing it...if someone wishes to clean up what I have done so far, finish it up, they are welcome to have it to do what they like.
If there are any takers, I will post all the details...
Cheers
Steps
 
VinDSL
Life Cycles Becoming CPU Cycles


Joined: Jul 11, 2004
Posts: 614
Location: Arizona (USA) Admin: NukeCops.com Admin: Disipal Designs Admin: Lenon.com

PostPosted: Sat Aug 06, 2005 4:10 pm Reply with quote

Steptoe wrote:
Give me a welder, a hot rod, lathe and milling machine,a small network 100 odd machines, hardware, I am good on that stuff...languages, including code, draw a pic...my head talents just will not get my head around those...

LoL! Nicely put!

I made a user block on my site, that ppl have been clamoring for, but it's so complex, I'm afraid to release it. I don't even know if it would work on another *nux server... Cool

I just got home, and haven't had a chance to look at your code, but based on personal experience, I would pay close attention to your globals...

_________________
.:: "The further in you go, the bigger it gets!" ::.
.:: Only registered users can see links on this board! Get registered or login! | Only registered users can see links on this board! Get registered or login! ::. 
View user's profile Send private message Visit poster's website ICQ Number
VinDSL
PostPosted: Sat Aug 06, 2005 4:15 pm Reply with quote

Sting wrote:
...Secondly, you will need to go through your who is where block and make sure that all of the declared variables are declared in the User Info block - and that there are no double declarations occurring, as you could end up with some interesting data...

Exactly!
 
Steptoe
PostPosted: Sat Aug 06, 2005 4:52 pm Reply with quote

Quote:
and that there are no double declarations occurring,

hmm lol
Strange things lol yep..
I found I have to rename the where is block file so it doesnt work
I add where is stuff into user info in diff places and stuff, the bottom 1/2 of user info goes blank, or the stuff in user info disappears and the where is stuff in in there instead lol...Im sure its has something to do with poor grammer in a foreign lanuguage (php)

Anyway this is my user info so far.
uses the Where is db and the msa ip to country db. Currently working here Only registered users can see links on this board! Get registered or login! ... I want the where is just to show when logged in.

opps when I post the code I get a BAD sental warning...there are no style or scripts things?? so If someone wishes to help out please PM me with contact and I will send OK?
 
Steptoe
PostPosted: Mon Aug 15, 2005 7:12 pm Reply with quote

Anyone interested in cleaning up and finishing please?
I have been thinking of adding info into it like the 'total hits' 'yest hits', but instead adding or changing to ' total posts' and maybe 'total topics'??
Can anyone tell me how to do this?
 
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 ©