Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks
Author Message
nextgen
Worker
Worker



Joined: Sep 28, 2006
Posts: 235

PostPosted: Thu Feb 02, 2012 2:38 pm Reply with quote

Does anyone know of a top 5 users by points accumulated block ? Maybe with a link to edit profile, change theme and log out options.
 
View user's profile Send private message Send e-mail
Susann
Moderator



Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support

PostPosted: Thu Feb 02, 2012 3:10 pm Reply with quote

Welcome back ! I believe I had such a block but I had a different point system in Nuke.
Therefore to help you we need to know what points you are talking about.
 
View user's profile Send private message
nextgen







PostPosted: Thu Feb 02, 2012 3:55 pm Reply with quote

The points system installed by default in Ravennuke.
 
nextgen







PostPosted: Fri Feb 03, 2012 10:28 am Reply with quote

here is what i found but need it to show the nuke points.

Code:
<?php


if (eregi("block-User_Login.php", $_SERVER['PHP_SELF'])) { Header("Location: index.php"); }
global $redirect, $mode, $f, $t, $sitekey, $nukeurl, $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $gfx_chk;
include_once("modules/Your_Account/includes/functions.php");
$ThemeSel = get_theme();
$ya_config = ya_get_configs();
$userinfo = getusrinfo($user);
if (is_user($user)) {
$memname = $cookie[1];
$sqlab = "SELECT points AS dollars FROM ".$prefix."_users WHERE username = '$memname'";
$result = $db->sql_query($sqlab);
$row = $db->sql_fetchrow($result);
$dollars = $row[dollars];

$sqlbc = "SELECT * FROM ".$prefix."_bbconfig";
$resultbc = $db->sql_query($sqlbc);
while ( $rowbc = $db->sql_fetchrow($resultbc) )
{
$board_config[$rowbc['config_name']] = $rowbc['config_value'];
}
if ($userinfo[user_avatar_type] == 1) {
$userinfo[user_avatar] = $board_config['avatar_path']."/".$userinfo[user_avatar];
} elseif ($userinfo[user_avatar_type] == 2) {
$userinfo[user_avatar] = $userinfo[user_avatar];
} else {
$userinfo[user_avatar] = $board_config[avatar_gallery_path]."/".$userinfo[user_avatar];
}
if ($userinfo[user_avatar]) {
$sqlde = "SELECT user_posts AS postz FROM ".$prefix."_users WHERE username = '$memname'";
$result = $db->sql_query($sqlde);
$row = $db->sql_fetchrow($result);
$postz = $row[postz];

$content .= "<center><img src=\"$userinfo[user_avatar]\" alt=\"\" height=\"90\" width=\"90\"></center>\n";
$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"95%\"><tr><TD class=\"rowx\">&nbsp;<b></td></tr></table>\n";
$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"95%\">\n";
$content .= "<img src=\"themes/$ThemeSel/images/menu/meminfo.gif\" border=\"0\" alt=\"Your account information.\">\n";
$content .= "<TR><TD class=\"rowx\">&nbsp;Welcome: $memname<br><br>\n";
if(is_active("Private_Messages")) {
list($uid) = $db->sql_fetchrow($db->sql_query("select user_id from $user_prefix"._users." where username='$memname'"));
$newpms = $db->sql_numrows($db->sql_query("select privmsgs_to_userid from $prefix"._bbprivmsgs." where privmsgs_to_userid='$uid' and (privmsgs_type='1' OR privmsgs_type='5')"));
$savpms = $db->sql_numrows($db->sql_query("select privmsgs_to_userid from $prefix"._bbprivmsgs." where privmsgs_to_userid='$uid' and privmsgs_type='3'"));
$oldpms = $db->sql_numrows($db->sql_query("select privmsgs_to_userid from $prefix"._bbprivmsgs." where privmsgs_to_userid='$uid' and privmsgs_type='0'"));
$totpms = $newpms + $oldpms + $savpms;
$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"100%\"><TR><TD class=\"rowx\">&nbsp;<a href=\"messages.html\"><b>Messages:</b></a></td><td align=\"right\"><a href=\"messages.html\">$newpms</a></span></td></tr></table>";


$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"100%\"><TR><TD class=\"rowx\">&nbsp;<b>Total Points:</b></a></td><td align=\"right\">$points</span></td></tr></table>";

$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"100%\"><TR><TD class=\"rowx\">&nbsp;<b>Your Posts:</b></a></td><td align=\"right\">$postz</span></td></tr></table>";


//$content .= "<TR><TD class=\"rowx\">&nbsp;Forum Posts:<font color=\"#ffffff\"> $postz</font></TD></TR>\n";
$content .= "<TR><TD class=\"rowx\">&nbsp;</TD></TR>\n";
$content .= "<TR><TD class=\"rowx\">&nbsp;<a href=\"forum-editprofile.html\" target=_self>Edit your Profile</a></TD></TR>\n";
$content .= "<TR><TD class=\"rowx\">&nbsp;<a href=\"modules.php?name=Your_Account&op=chgtheme\" target=_self>Change Theme</a></TD></TR>\n";
$content .= "<TR><TD class=\"rowx\">&nbsp;<a href=\"account-logout.html\">"._BLOGOUT." </a><br><br>\n";
//$content .= "<TR><TD class=\"rowx\">&nbsp;</TD></TR>\n";
$content .= "<img src=\"themes/$ThemeSel/images/menu/top5.gif\" border=\"0\" alt=\"Your account information.\">\n";


$query='SELECT username, user_id, points FROM '.$prefix."_users WHERE `user_id`>'1' ORDER BY `points` DESC LIMIT 5";
$result=$db->sql_query($query);
//$content = "<TR><TD class=\"rowx\">&nbsp;Member</b></TD><TD><TR><b>Points</b></TD></TR>";
for($i = 1;$h = $db->sql_fetchrow($result);$i++)
{
$id = $h['user_id'];
$name = $h['username'];
$points = $h['points'];
$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"100%\"><TR><TD class=\"rowx\">$i. <a href=\"modules.php?name=Forums&amp;file=profile&amp;mode=viewprofile&amp;u=$id\">$name</a></td><td align=\"right\">$points</span></td></tr></table>";
}
$content .= "</table>\n";
}
}
} else {
mt_srand ((double)microtime()*1000000);
$maxran = 10 * intval($ya_config['codesize']);
$random_num = mt_rand(0, $maxran);
$content .= "<img src=\"themes/$ThemeSel/images/menu/regged.gif\" border=\"0\" alt=\"Member Login\">\n";
$content .= "<table border=0 cellpadding=0 cellspacing=0>\n";
$content .= "<tr><form action=\"account.html\" method=\"post\">\n";
$content .= "<td><input type=\"text\" name=\"username\" size=\"11\" maxlength=\"25\"><br>\n";
$content .= "<input type=\"password\" name=\"user_password\" size=\"11\" maxlength=\"20\" AutoComplete=\"off\"><br>\n";
if (extension_loaded("gd") AND ($ya_config['usegfxcheck'] == 2 OR $ya_config['usegfxcheck'] == 3)) {
$content .=""._BCODE.": <img src='?gfx=gfx&random_num=$random_num' border='0' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'><br>\n";
$content .="<input type=\"text\" NAME=\"gfx_check\" SIZE=\"11\" MAXLENGTH=\"10\" AutoComplete=\"off\"><br>\n";
$content .="<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
}
$content .="<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=\""._BLOGIN."\">\n";
$content .= "</td>\n";
$content .= "</form></tr>\n";
$content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"95%\"><tr><TD class=\"rowx\"><a href=\"account-new_user.html\"><img src=\"themes/$ThemeSel/images/menu/registernow.gif\" border=\"0\" alt=\"Register as new User!\"></a></TD></TR>\n";
$content .= "</table>\n";
}
?>
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Fri Feb 03, 2012 12:34 pm Reply with quote

I did not try it, but give this rewrite a go.
Code:


<?php

if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}

global $db, $prefix, $user, $user_prefix;

include_once 'modules/Your_Account/includes/functions.php';

$ThemeSel = get_theme();
$ya_config = ya_get_configs();

if (is_user($user)) {
   $userinfo = getusrinfo($user);
   $sql = 'SELECT `points` FROM `' . $user_prefix . '_users` WHERE `username` = "' . $userinfo['username'] . '"';
   $result = $db->sql_query($sql);
   list($points)= $db->sql_fetchrow($result, SQL_NUM);

   $sql = 'SELECT * FROM `' . $prefix . '_bbconfig`';
   $result = $db->sql_query($sql);
   while ( $row = $db->sql_fetchrow($result, SQL_ASSOC) ) {
      $board_config[$row['config_name']] = $row['config_value'];
   }

   if ($userinfo['user_avatar_type'] == 1) {
      $userinfo['user_avatar'] = $board_config['avatar_path'] . '/' . $userinfo['user_avatar'];
   } elseif ($userinfo['user_avatar_type'] == 2) {
      $userinfo['user_avatar'] = $userinfo['user_avatar'];
   } else {
      $userinfo['user_avatar'] = $board_config['avatar_gallery_path'] . '/' . $userinfo['user_avatar'];
   }

   if ($userinfo['user_avatar']) {
      $sql = 'SELECT `user_posts` FROM `' . $user_prefix . '_users` WHERE `username` = "' . $userinfo['username'] . '"';
      $result = $db->sql_query($sql);
      list($postz) = $db->sql_fetchrow($result, SQL_NUM);

      $content .= '<center><img src="' . $userinfo['user_avatar'] . '" alt="" height="90" width="90"></center>' . "\n"
         . '<table border="0" cellpadding="0" cellspacing="0" width="95%"><tr><td class="rowx">&nbsp;<b></td></tr></table>' . "\n"
         . '<table border="0" cellpadding="0" cellspacing="0" width="95%">' . "\n"
         . '<img src="themes/' . $themesel . '/images/menu/meminfo.gif" border="0" alt="your account information.">' . "\n"
         . '<tr><td class="rowx">&nbsp;welcome: ' . $userinfo['username'] . '<br><br>' . "\n";

      if(is_active('Private_Messages')) {
         $newpms = $db->sql_numrows($db->sql_query('SELECT `privmsgs_to_userid` FROM `' . $prefix . '_bbprivmsgs` WHERE `privmsgs_to_userid`="' . $userinfo['user_id'] . '"'
               . 'AND privmsgs_type IN(1,5)'));

         $content .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="rowx">&nbsp;<a href="modules.php?name=private_messages"><b>messages:</b></a></td>'
               . '<td align="right"><a href="modules.php?name=private_messages">' . $newpms . '</a></span></td></tr></table>'
               . '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="rowx">&nbsp;<b>total points:</b></a></td><td align="right">' . $points . '</span></td></tr></table>'
               . '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="rowx">&nbsp;<b>your posts:</b></a></td><td align="right">' . $postz . '</span></td></tr></table>'
               . '<tr><td class="rowx">&nbsp;</td></tr>' . "\n"
               . '<tr><td class="rowx">&nbsp;<a href="modules.php?name=forums&amp;file=profile&amp;mode=editprofile" target="_self">edit your profile</a></td></tr>' . "\n"
               . '<tr><td class="rowx">&nbsp;<a href="modules.php?name=your_account&amp;op=chgtheme" target="_self">change theme</a></td></tr>' . "\n"
               . '<tr><td class="rowx">&nbsp;<a href="modules.php?name=your_account&amp;op=logout">' . _blogout . ' </a><br><br>' . "\n"
               . '<img src="themes/' . $themesel . '/images/menu/top5.gif" border="0" alt="your account information.">' . "\n";

         $query='SELECT `username`, `user_id`, `points` FROM `' . $user_prefix . '_users` WHERE `user_id` > "1" ORDER BY `points` DESC LIMIT 5';
         $result = $db->sql_query($query);
         for($i = 1; list($name, $id, $points) = $db->sql_fetchrow($result, SQL_NUM); $i++) {
            $content .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="rowx">' . $i . '. '
                  . '<a href="modules.php?name=forums&amp;file=profile&amp;mode=viewprofile&amp;u=' . $id . '">' . $name . '</a></td><td align="right">' . $points . '</span></td></tr></table>';
         }

         $content .= '</table>' . "\n";
      }
   }
} else {
   $content .= '<img src="themes/' . $ThemeSel . '/images/menu/regged.gif" border="0" alt="Member Login">' . "\n"
         . '<table border="0" cellpadding="0" cellspacing="0">' . "\n"
         . '<tr><form action="modules.php?name=Your_Account" method="post">' . "\n"
         . '<td><input type="text" name="username" size="11" maxlength="25"><br>' . "\n"
         . '<input type="password" name="user_password" size="11" maxlength="20" AutoComplete="off"><br>' . "\n"
         . security_code(array(2,4,5,7), 'stacked')
         . '<input type="hidden" name="op" value="login">' . "\n"
         . '<input type="submit" value="' . _BLOGIN . '">' . "\n"
         . '</td>' . "\n"
         . '</form></tr>' . "\n"
         . '<table border="0" cellpadding="0" cellspacing="0" width="95%"><tr><td class="rowx"><a href="modules.php?name=your_account&amp;op=new_user">'
         . '<img src="themes/' . $themesel . '/images/menu/registernow.gif" border="0" alt="register as new user!"></a></td></tr>' . "\n"
         . '</table>' . "\n";
}

?>

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
nextgen







PostPosted: Fri Feb 03, 2012 2:19 pm Reply with quote

yes friend.
 
nextgen







PostPosted: Fri Feb 03, 2012 2:23 pm Reply with quote

Palbin, it works perfectly. Thank you so very much.
 
andrewsmith
New Member
New Member



Joined: Jun 08, 2012
Posts: 1

PostPosted: Fri Jun 08, 2012 1:51 am Reply with quote

I am not able to get it can you explain it in little more detail.

_________________
delivery jobs 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating 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 ©