TBDev Forum
Programming board
Main Page Forum Rules Privacy Policy Members Contact Us
Welcome Guest (Login | Register)
TBDev Forum TBDev.net - Help General Support Hide profile problem

Hide profile problem

2007-02-21 20:51:00
Group: Member
Posts: 48
Topics participated: 29
Topics started: 24
First post: 2006-12-24 17:09:00
Last post: 2007-03-15 07:42:00
I installed this mod:


...and tried to modifi it a bit, but I can't get it working exactly as I want.

Here is a picture of hows it looks now:


As you can see on my lame piture, I want the small table aroud the avatar
EXACTLY same as the table with all the userinfo.
(A small table to left with the text "Avatar" in, and a wider table to right
with the avatar pic in!)

And btw, I changed the text "anonymous" to "hidestats" becaues of another
mod i'm working on. Take a look:
CODE

if ($user["hidestats"] == 'yes')
{
print("");
if ($user["avatar"])
print("\n");
if ($user["info"])
print("\n");

if (get_user_class() < UC_MODERATOR && $user["id"] != $CURUSER["id"])
{
print("
" . format_comment($user["info"]) . "
");
end_main_frame();
stdfoot();
exit;
}
print("

");


Here is my userdetails.php:
CODE


require "include/bittorrent.php";

dbconn(false);

loggedinorreturn();

function bark($msg)
{
stdhead();
stdmsg("Error", $msg);
stdfoot();
exit;
}

function maketable($res)
{
$ret = "" .
"\n" .
"\n";
while ($arr = mysql_fetch_assoc($res))
{
if ($arr["downloaded"] > 0)
{
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "$ratio";
}
else
if ($arr["uploaded"] > 0)
$ratio = "Inf.";
else
$ratio = "---";
$catimage = htmlspecialchars($arr["image"]);
$catname = htmlspecialchars($arr["catname"]);
$ttl = (28*24) - floor((gmtime() - sql_timestamp_to_unix_timestamp($arr["added"])) / 3600);
if ($ttl == 1) $ttl .= "
hour"; else $ttl .= "
hours";
$size = str_replace(" ", "
", mksize($arr["size"]));
$uploaded = str_replace(" ", "
", mksize($arr["uploaded"]));
$downloaded = str_replace(" ", "
", mksize($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$ret .= "\n" .
"\n" .
"\n";
}
$ret .= "
TypeNameTTLSizeSe.Le.Upl.Downl.Ratio
\"$catname\"" . htmlspecialchars($arr["torrentname"]) .
"
$ttl$size$seeders$leechers$uploaded$downloaded$ratio
\n";
return $ret;
}

$id = 0 + $_GET["id"];

if (!is_valid_id($id))
bark("Bad ID $id.");

$r = @mysql_query("SELECT * FROM users WHERE id=$id") or sqlerr();
$user = mysql_fetch_array($r) or bark("No user with ID $id.");
if ($user["status"] == "pending") die;
if($user["anonymous"] == "no")
$viewprof = 1;
elseif($CURUSER["id"] == '$id' OR get_user_class() >= UC_MODERATOR)
$viewprof = 1;
if($viewprof == 1){
$r = mysql_query("SELECT id, name, seeders, leechers, category FROM torrents WHERE owner=$id ORDER BY name") or sqlerr();
if (mysql_num_rows($r) > 0)
{
$torrents = "\n" .
"
class=colhead>Leechers
\n";
while ($a = mysql_fetch_assoc($r))
{
$r2 = mysql_query("SELECT name, image FROM categories WHERE id=$a[category]") or sqlerr(__FILE__, __LINE__);
$a2 = mysql_fetch_assoc($r2);
$cat = "\"$a2[name]\"";
$torrents .= "" .
"\n";
}
$torrents .= "
TypeName Seeders
$cat" .

htmlspecialchars($a["name"]) . "
$a[seeders]$a[leechers]
";
}
}

if ($user["ip"] && (get_user_class() >= UC_MODERATOR || $user["id"] == $CURUSER["id"]))
{
$ip = $user["ip"];
$dom = @gethostbyaddr($user["ip"]);
if ($dom == $user["ip"] || @gethostbyname($dom) != $user["ip"])
$addr = $ip;
else
{
$dom = strtoupper($dom);
$domparts = explode(".", $dom);
$domain = $domparts[count($domparts) - 2];
if ($domain == "COM" || $domain == "CO" || $domain == "NET" || $domain == "NE" || $domain == "ORG" || $domain == "OR" )
$l = 2;
else
$l = 1;
$addr = "$ip ($dom)";
}
}
if ($user[added] == "0000-00-00 00:00:00")
$joindate = 'N/A';
else
$joindate = "$user[added] (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($user["added"])) . " ago)";
$lastseen = $user["last_access"];
if ($lastseen == "0000-00-00 00:00:00")
$lastseen = "never";
else
{
$lastseen .= " (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($lastseen)) . " ago)";
}
$res = mysql_query("SELECT COUNT(*) FROM comments WHERE user=" . $user[id]) or sqlerr();
$arr3 = mysql_fetch_row($res);
$torrentcomments = $arr3[0];
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE userid=" . $user[id]) or sqlerr();
$arr3 = mysql_fetch_row($res);
$forumposts = $arr3[0];

//if ($user['donated'] > 0)
// $don = "";

$res = mysql_query("SELECT name,flagpic FROM countries WHERE id=$user[country] LIMIT 1") or sqlerr();
if (mysql_num_rows($res) == 1)
{
$arr = mysql_fetch_assoc($res);
$country = "\"$arr[name]\"";
}

//if ($user["donor"] == "yes") $donor = "Donor";
//if ($user["warned"] == "yes") $warned = "Warned";

if($user["anonymous"] == "no")
$viewprof = 1;
elseif($CURUSER["id"] == $id OR get_user_class() >= UC_MODERATOR)
$viewprof = 1;
if($viewprof == 1){
$res = mysql_query("SELECT torrent,added,uploaded,downloaded,torrents.name as torrentname,categories.name as

catname,size,image,category,seeders,leechers FROM peers JOIN torrents ON peers.torrent = torrents.id JOIN categories ON torrents.category =

categories.id WHERE userid=$id AND seeder='no'") or sqlerr();
if (mysql_num_rows($res) > 0)
$leeching = maketable($res);
$res = mysql_query("SELECT torrent,added,uploaded,downloaded,torrents.name as torrentname,categories.name as

catname,size,image,category,seeders,leechers FROM peers JOIN torrents ON peers.torrent = torrents.id JOIN categories ON torrents.category =

categories.id WHERE userid=$id AND seeder='yes'") or sqlerr();
if (mysql_num_rows($res) > 0)
$seeding = maketable($res);
}

stdhead("Details for " . $user["username"]);
$enabled = $user["enabled"] == 'yes';
print("

".
"$country

$user[username]" . get_user_icons($user, true) . "

\n");

if (!$enabled)
print("

This account has been disabled

\n");
elseif ($CURUSER["id"] <> $user["id"])
{
$r = mysql_query("SELECT id FROM friends WHERE userid=$CURUSER[id] AND friendid=$id") or sqlerr(__FILE__, __LINE__);
$friend = mysql_num_rows($r);
$r = mysql_query("SELECT id FROM blocks WHERE userid=$CURUSER[id] AND blockid=$id") or sqlerr(__FILE__, __LINE__);
$block = mysql_num_rows($r);

if ($friend)
print("

(remove from friends)

\n");
elseif($block)
print("

(remove from blocks)

\n");
else
{
print("

(add to friends)");
print(" - (add to blocks)

\n");
}
}
if ($user["hidestats"] == 'yes')
{
print("");
if ($user["avatar"])
print("\n");
if ($user["info"])
print("\n");

if (get_user_class() < UC_MODERATOR && $user["id"] != $CURUSER["id"])
{
print("
" . format_comment($user["info"]) . "
");
end_main_frame();
stdfoot();
exit;
}
print("
");
}
begin_main_frame();
?>




if (get_user_class() >= UC_MODERATOR)
print("\n");
if ($addr)
print("\n");

// if ($user["id"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR)
// {
?>



if ($user["downloaded"] > 0)
{
$sr = $user["uploaded"] / $user["downloaded"];
if ($sr >= 4)
$s = "w00t";
else if ($sr >= 2)
$s = "grin";
else if ($sr >= 1)
$s = "smile1";
else if ($sr >= 0.5)
$s = "noexpression";
else if ($sr >= 0.25)
$s = "sad";
else
$s = "cry";
$sr = floor($sr * 1000) / 1000;
$sr = "
Join date=$joindate?>
Last seen=$lastseen?>
Email$user[email]
Address$addr
Uploaded=mksize($user["uploaded"])?>
Downloaded=mksize($user["downloaded"])?>
" . number_format($sr, 3) . "
";
print("Share ratio$sr\n");
}
//}

//if ($user['donated'] > 0 && (get_user_class() >= UC_MODERATOR || $CURUSER["id"] == $user["id"]))
// print("Donated$$user[donated]\n");
if ($user["avatar"])
print("Avatar\n");
print("Class" . get_user_class_name($user["class"]) . "\n");
print("Torrent comments");
if ($torrentcomments && (($user["class"] >= UC_POWER_USER && $user["id"] == $CURUSER["id"]) || get_user_class() >= UC_MODERATOR))
print("$torrentcomments\n");
else
print("$torrentcomments\n");
print("Forum posts");
if ($forumposts && (($user["class"] >= UC_POWER_USER && $user["id"] == $CURUSER["id"]) || get_user_class() >= UC_MODERATOR))
print("$forumposts\n");
else
print("$forumposts\n");

if ($torrents)
print("Uploaded torrents$torrents\n");
if ($seeding)
print("Currently seeding$seeding\n");
if ($leeching)
print("Currently leeching$leeching\n");
if ($user["info"])
print("" . format_comment($user["info"]) . "\n");

if ($CURUSER["id"] != $user["id"])
if (get_user_class() >= UC_MODERATOR)
$showpmbutton = 1;
elseif ($user["acceptpms"] == "yes")
{
$r = mysql_query("SELECT id FROM blocks WHERE userid=$user[id] AND blockid=$CURUSER[id]") or sqlerr(__FILE__,__LINE__);
$showpmbutton = (mysql_num_rows($r) == 1 ? 0 : 1);
}
elseif ($user["acceptpms"] == "friends")
{
$r = mysql_query("SELECT id FROM friends WHERE userid=$user[id] AND friendid=$CURUSER[id]") or sqlerr(__FILE__,__LINE__);
$showpmbutton = (mysql_num_rows($r) == 1 ? 1 : 0);
}
if ($showpmbutton)
print("
");

print("\n");

if (get_user_class() >= UC_MODERATOR && $user["class"] < get_user_class())
{
begin_frame("Edit User", true);
print("
\n");
print("\n");
print("\n");
print("\n");
print("\n");
print("\n");
$avatar = htmlspecialchars($user["avatar"]);
print("\n");
// we do not want mods to be able to change user classes or amount donated...
if ($CURUSER["class"] < UC_ADMINISTRATOR)
print("\n");
else
{
print("\n");
}

if (get_user_class() == UC_MODERATOR && $user["class"] > UC_VIP)
printf(" else
{
print("\n");
}

$modcomment = htmlspecialchars($user["modcomment"]);
print("\n");
$warned = $user["warned"] == "yes";

print("
");

if ($warned)
{
$warneduntil = $user['warneduntil'];
if ($warneduntil == '0000-00-00 00:00:00')
print("\n");
else
{
print("\n");
}
}
else
{
print("\n");
print("");
}
print("\n");

print("");
print("\n");
print("
Title
Avatar URL
DonorYes No
Class
Comment
Warned " .
( $warned
? "YesNo"
: "No" ) ."
(arbitrary duration)
Until $warneduntil");
print(" (" . mkprettytime(strtotime($warneduntil) - gmtime()) . " to go)
Warn for PM comment:
EnabledYes No
\n");
print("
\n");
end_frame();
}
end_main_frame();
stdfoot();

?>


Please help me with this mod! I'm a newbie trying to get this working,
so I'm very glad if there is some nice people out there that can use 5
minutes of their live helping me... <3

Thank you! :D
 

Similar threads

Topic Posts Last post
Hide Profile 16 2009-01-01 03:43:00
Show/Hide Menu From Profile 1 2008-04-20 15:00:00
I got problem with hide links at login 98 2008-08-22 18:43:00
BBCode [hide] [/hide] 2 2008-04-12 18:16:00
My profile 2 2007-07-21 00:18:00

Statistics

Today's active topics · 
User(s) active in the past 30 minutes
  59 Guests, 9 Members LiquidAtoR, rocky, mesh, GunnersBr, RayDaX, DeMaper, Txie, abcd*, bbrian017 OPISY DO GG , drewno , pozycjonowanie i optymalizacja , Airport limos , okna pcv apteka faktoring pozycjonowanie pozycjonowania BezpĹ‚atne konta bankowe
Often viewed topics
· Preliminary XSS... · RSS feed passke... · Invite With Bonus · Browse.php · new Message · Torrent Inline ... · torrent uppload... · Save PMs to temp! · Similar torrent... · Work with mod_r... · Nice signup usi... · Stats on index · browse.php · action script · hash fails???:S · Ratio Master · User/ID · Warned users (o... · Question about ... · Rating using ajax
Forthcoming Calendar Events within the next 5 days
  There are no forthcoming calendar events