Need Help with a block

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Need Help with a block
mrmagoo_83
CZ Newbie
mrmagoo_83 has been a member for over 20 year's 20 Year Member
usa.gif texas.gif
Website:
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 25
Points: 5,106
   
I need help making a block. Its based off some HTML code that is linked to a database that tells whether a player is online or offline. Now I have created the simple block that displays this, which is fine; however I want a block that does a little more.

This is the HTML code.
<a target="_blank" href="http://aaotracker.4players.de/usertracker.php?userid=921"><img border="0" src="http://aaotracker.4players.de/trackericon.php?userid=921&style=4"></a>


The 411

I am a member of an America's Army Game clan, Reborn Soldiers -[RS]-, our current website is [ Register or login to view links on this board.] , which is soon to be changed (thanks for the theme) cause it crashed hard last night when I uploaded the CZEnhanced, I think I forgot to do something. Anyway. We are using VWars ported for PHPNuke, [ Register or login to view links on this board.] , and when the member signs up they input their "Honor" and their "User ID", which are stored in the database. I have to find out what table they are stored in.

What I want is for this block to go to the database get the User ID# for each member, then put that into the html code above (921 is the current user id, me), then if the user is online, display him in the block, if he isn't do nothing. But I want it to display all the online members.

Does that make any sense?


Back to top Reply with quote
#2   re: Need Help with a block
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Same concept as any user block. You just need the databse name and if it is differant the current one you will have to add a mysql login to the block so it can connect to the other databse other wise it will try to pull from the one loading it.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Need Help with a block
mrmagoo_83
CZ Newbie
mrmagoo_83 has been a member for over 20 year's 20 Year Member
usa.gif texas.gif
Website:
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 25
Points: 5,106
   
VWars loads all its tables within the Nuke database so thats not a problem. I still am not sure as to what the table is because my site is till down.

Now I must say I know very little about PHP, I can hack some code to make it to what I want, but I must have a starting base icon_smile.gif And I am not very good at that, thus my site crashed icon_smile.gif

Anyway, if you are willing to help I will get all the info I can get, and relay that forward. I know it should be pretty simple, just a bunch of setting variables, getting the data from the DB, then getting the return from the html code.

I did determine that the html code displays two images, which are attained here: [ Register or login to view links on this board. ] [ Register or login to view links on this board. ]

Maybe that will help.

So we do a few ifs, and elses, and then display only the online4.gifs right?

Man I so just confused myself.



Back to top Reply with quote
#4   re: Need Help with a block
mrmagoo_83
CZ Newbie
mrmagoo_83 has been a member for over 20 year's 20 Year Member
usa.gif texas.gif
Website:
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 25
Points: 5,106
   
ok here is what I have found out.

The table where the data is stored is withing the main nuke database. The table is vwar_memberprofilefield.

Within the table there are 4 rows/columns whatever you want to call them:
memberprofilefieldid
memberid
profilefileid
fieldvalue

The memberprofilefieldid is the row that is set for the data I want, and then the memberid is for each member, duh icon_smile.gif

So what I need is to figure out how to make a script that goes to the DB gets the fieldvalue for each userid that is in the memberprofilefieldid.

Make sense?



Back to top Reply with quote
#5   re: Need Help with a block
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
You need to also go to the nuke_sessions table and find out if thier online. Then you need to match them up with the vwar table to get thier name. Its really not as easy as you think.

Here is what it might look like.

global $user, $user_id, $cookie, $prefix, $dbi, $user_prefix, $user_name;
$content = "";

cookiedecode( $user );
$ip = getenv( "REMOTE_ADDR" );
$username = $cookie[1];
if ( !isset( $user_name ) )
{
   $user_name = "$ip";
   $guest = 1;
}

// Set Nuke session table
$past = time()-900;
sql_query( "DELETE FROM $prefix"._users." 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='$user_name', 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 );
}
$vwar_online_now = "";
$i = 1;
while ( $session = sql_fetch_array( $result2, $dbi ) )
{
   if ( isset($session["guest"]) and $session["guest"] == 0 )
   {
// Get user ID's of online registered users
      $resultuser_id = sql_query( "SELECT user_id FROM ".$prefix."_users where username='$session[uname]'", $dbi );
      list( $user_id ) = sql_fetch_row( $resultuser_id, $dbi );
     
if ($i < 10) $zi = "0$i";
    else $zi = $i;

//search vwar on line
$vwar_result = sql_query("select memberprofilefieldid, memberid from vwar_memberprofilefield where vwarid='$user_id'", $dbi);
$vwaruserresult = sql_fetch_array($vwar_result);
                  if ($user_id == $vwaruserresult[vwarid] and $vwaruserresult[memberid]==0) {
$vwar_online_now .= "<br>$zi.&nbsp;<a target="_blank" href="http://aaotracker.4players.de/usertracker.php?userid=921"><img border="0" src="http://aaotracker.4players.de/trackericon.php?userid=$memberid&style=4"></a>\n";         
                  }
$vwar_online_now .= ( $i != $member_online_num ? "" : "" );
      $i++;
   }
}
if ( is_user( $user ) )
{
   
   $content .= "<b><u>Vwar Online</b></u>$vwar_online $vwar_online_now<br>";
}


Basically something like that just to get thier info. Should get you started.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   re: Need Help with a block
mrmagoo_83
CZ Newbie
mrmagoo_83 has been a member for over 20 year's 20 Year Member
usa.gif texas.gif
Website:
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 25
Points: 5,106
   
Sorry, I should have said, I don't mean online, as in on the website, I mean online as in playing the game.

That htlm code returns an image if the player is online or offline via the game.

So I don't need to worry about the Nuke Session table.

I wish I could explain it better.

Thanks for your patience



Back to top Reply with quote
#7   re: Need Help with a block
mrmagoo_83
CZ Newbie
mrmagoo_83 has been a member for over 20 year's 20 Year Member
usa.gif texas.gif
Website:
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 25
Points: 5,106
   
Now I apologize because I am very new to all this. Would it just be easier if I hard coded all the UserIDs into the block? And then just did an If HTML returns this, the display, else do nothing?

Which I don't even know how to do that yet.

Crud I really need to fund a php class around here.



Back to top Reply with quote
#8   re: Need Help with a block
viperxp45
CZ Newbie
usa.gif texas.gif
Gender: Male
Website:
Status: Offline
Joined: Dec 25, 2003
0.00 posts per day
Posts: 3
Points: 888
  MSN Messenger 
i know what your talking about . and its very simple to do ... how ever i have seems to have lost the AAO tracker block code :(but i can give u this one that will work....


<a target="_blank" href="http://aaotracker.4players.de/usertracker.php?userid=921"><img border="0" src="http://aaotracker.4players.de/trackericon.php?userid=921&style=4"></a>

u will need to edit the id # to yours ... also there is another code to query the aaotracker clan id page... still looking for that one....



Back to top Reply with quote
#9   re: Need Help with a block
mrmagoo_83
CZ Newbie
mrmagoo_83 has been a member for over 20 year's 20 Year Member
usa.gif texas.gif
Website:
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 25
Points: 5,106
   
Thanks, the was the code I was using, but I didn't want it to show everyone, rather just those that were online. And now we have dropped the stie, and are just using our forums. Thanks though.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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 cannot attach files in this forum
You cannot download files in this forum