Location: PHPKode > projects > H-tracker > blocks/login_block.php
<?
if (!$CURUSER){
$avatar = "".$site_config["SITEURL"]."/themes/$THEME/images/avatars/guest.gif";

begin_block("" . Login . "");
?>
<table border=0 width=100% cellspacing=0 cellpadding=0>
	<tr><td>
		<form method=post action=account-login.php>
		<div align=center>
		<table border=0 cellpadding=1>
	      <tr>
					<td align="center" nowrap="nowrap"><img src="<?=$avatar?>" border="0" alt="Login" align="middle" /><br><br><hr></td></tr>
                                    <tr>

                    <td align="center"><img src="images/icon_select.png" border="0" alt="Register now!"/>&nbsp;<a href="account-signup.php" class="mainmenu">Register</a><br/></td>
                </tr>
                 <tr>

                    <td align="center"><img src="images/icon_select.png" border="0" alt="Lost Password?"/>&nbsp;<a href="account-recover.php" class="mainmenu">Recover account</a><br/><hr></td>
                </tr>
						<tr><td align="center">Username<br>
						<input  type="text" name="username" size="10" /><br/></td></tr>
						<tr><td align="center">Password<br>
						<input type="password" name="password" size="10" maxlength="32" /><br/>
					</td>
				</tr>	
				<tr>
					<td align="center"><input type="submit" name="login" value="Login"><hr></td>
				</tr>
		</table>
		</td>
        </div>
		</form>
		</tr>
	</table> 
<?

} else {

begin_block("$CURUSER[username]"); 
    
	$avatar = htmlspecialchars($CURUSER["avatar"]);
	if (!$avatar)
		$avatar = "".$site_config["SITEURL"]."/themes/$THEME/images/avatars/default_avatar.gif";

	$userdownloaded = mksize($CURUSER["downloaded"]);
	$useruploaded = mksize($CURUSER["uploaded"]);
	$privacylevel = $CURUSER["privacy"];
    $levelimg = "<img src=".$site_config["SITEURL"]."/themes/".$THEME."/images/ranks/" . $CURUSER["rankimage"] . ">";
    $seedbonus = $CURUSER["seedbonus"];
                    $res2 = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" . $CURUSER["id"] . " AND seeder='yes'") or print(mysql_error());
                    $row = mysql_fetch_row($res2);
                    $activeseed = $row[0];
                    $res2 = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" . $CURUSER["id"] . " AND seeder='no'") or print(mysql_error());
                    $row = mysql_fetch_row($res2);
                    $activeleech = $row[0];
                    $res3 = mysql_query("SELECT connectable FROM peers WHERE userid=" . sqlesc($CURUSER["id"]) . " LIMIT 1") or print(mysql_error());
                  if($row = mysql_fetch_row($res3)){
                    $connect = $row[0];
                  if($connect == "yes"){
                    $connectable = "<img src=\"".$site_config["SITEURL"]."/images/yes.gif\" border=\"0\" alt=\"You are connectable\">";
                   }else{
                    $connectable = "<img src=\"".$site_config["SITEURL"]."/images/no.gif\" border=\"0\" alt=\"Not connectable\">";
                      }
                   }else{
                    $connectable ="<img src=\"".$site_config["SITEURL"]."/images/na1.gif\" border=\"0\" alt=\"Pending\">";
                   }
                   
    

         if ($CURUSER["downloaded"] > 0)
         {
          $userratio = number_format($CURUSER["uploaded"] / $CURUSER["downloaded"], 2);
          if (($CURUSER["uploaded"] / $CURUSER["downloaded"]) > 10)
          $userratio = "10+";
        }
        else
        if ($CURUSER["uploaded"] > 0)
        $userratio = "Inf.";
        else
         $userratio = "----";
    if ($CURUSER["warned"] != "no") {
        $warnedd = "<center><img width=128 height=128 src=themes/$THEME/images/avatars/warned_users.png border=0><br><blink><font class=error><b>Warning By Staff !</b></blink></font></center>";
    print ("$warnedd");
    } else {
	print ("<center><img width=120 height=120 src=$avatar><br><br>$levelimg<br><font color=green>" . DOWNLOADED . "</font>: $userdownloaded<br><font color=red>" . UPLOADED . "</font>: $useruploaded<BR>" . ACCOUNT_PRIVACY_LV . ": $privacylevel<BR>". RATIO .": <font color=".get_ratio_color($userratio).">$userratio</font><BR><img src=\"".$site_config["SITEURL"]."/images/torrents/seeders.png\" border=\"0\" alt=\"Seed\">: ".$activeseed."&nbsp;&nbsp;<img src=\"".$site_config["SITEURL"]."/images/torrents/leechers.png\" border=\"0\" alt=\"Leech\">: ".$activeleech."<br>Connectable: ".$connectable." <br>Seeding Bonus: <a href='mybonus.php'>$seedbonus</a><br>");
    }
		//check for new pm's
		$res = mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " and unread='yes' AND location IN ('in','both')") or print(mysql_error());
		$arr = mysql_fetch_row($res);
		$unreadmail = $arr[0];
        if ($unreadmail)
                $inboxpic = "<img style=\"border:none\" alt=\"inbox\" title=\"You have a new massage\" src=\"images/mail/newmess.gif\">"; 
        else
                $inboxpic = "<img style=\"border:none\" alt=\"inbox\" title=\"No new massages\" src=\"images/mail/nonew.gif\">";
		if ($unreadmail){
			print("My messages:&nbsp;&nbsp;<a href=mailbox.php?inbox>$inboxpic</a>&nbsp;&nbsp;<b>(<font color=red>$unreadmail</font>)</b>");
		}else{
			print("My messages:&nbsp;&nbsp;<a href=mailbox.php>$inboxpic</a>&nbsp;&nbsp;<b>(<font color=green>$unreadmail</font>)</b></center>");
		}
		//end check for pm's
?>


<CENTER><a href="account.php"><? print("" . ACCOUNT . "\n"); ?></a> <br> 
<? if ($CURUSER["control_panel"]=="yes") {
print("<a href=admincp.php>" . STAFFCP . "</a><br>");
}
if($CURUSER["level"]=="Super Moderator") {
print("<a href=modocp.php>Super Mod Cp</a><br>");
}
if($CURUSER["level"]=="Moderator") {
print("<a href=modcp.php>Mod Cp</a><br>");
}
if($site_config["REQUESTSON"]){
print("<a href=viewrequests.php?requestorid=$CURUSER[id]>My Requests</a><br>");
}
print("<img src=\"images/users/logout.gif\" alt=\"Logout\"><a href=\"account-logout.php\" onclick=\"return confirm('Are you sure you want to log out?')\">&nbsp;" . LOGOUT . "</a><br>");
    $ss_r = mysql_query("SELECT * from stylesheets") or die;
    $ss_sa = array();

    while ($ss_a = mysql_fetch_array($ss_r)){
        $ss_id = $ss_a["id"];
        $ss_name = $ss_a["name"];
        $ss_sa[$ss_name] = $ss_id;
    }

    ksort($ss_sa);
    reset($ss_sa);

    while (list($ss_name, $ss_id) = each($ss_sa)){
        if ($ss_id == $CURUSER["stylesheet"]) $ss = " selected"; else $ss = "";
            $stylesheets .= "<option value=$ss_id$ss>$ss_name</option>\n";
    }
    $lang_r = mysql_query("SELECT * from languages") or die;
    $lang_sa = array();

    while ($lang_a = mysql_fetch_array($lang_r)){
        $lang_id = $lang_a["id"];
        $lang_name = $lang_a["name"];
        $lang_sa[$lang_name] = $lang_id;
    }

    ksort($lang_sa);
    reset($lang_sa);
    while (list($lang_name, $lang_id) = each($lang_sa)){
      if ($lang_id == $CURUSER["language"]) $lang = " selected"; else $lang = "";
        $languages .= "<option value=$lang_id$lang>$lang_name</option>\n";
    }
    echo "<br><table width=100% border=0 cellspacing=0 cellpadding=0>";
    echo "<tr><hr><td><table width=100% border=0 cellspacing=0 cellpadding=2>";
    echo "<td align=center><form action='take-theme.php' name='jump' method='POST'>";
    echo "" . THEME . ": <br><select name='stylesheet' onChange='document.jump.submit();'>$stylesheets</select><br>";
    echo "" . LANG . ": <br><select name='language' onChange='document.jump.submit();'>$languages</select>";
    echo "</form>";
    echo "</td></tr></table><hr></td></tr>";
    echo "<tr><td align=center valign=top><img src=\"images/online.png\" alt=\"\">&nbsp;<span style=\"text-decoration:underline; font-weight: bold;\">Members Online:</span><br />";
     echo "<table width=145>";
    echo "<div align=left class=login_contain>";
$file = "".$site_config["cache_dir"]."/cache_usersonlineblock.txt";
$expire = 600; // time in seconds
if (file_exists($file) && filemtime($file) > (time() - $expire)) {
    $usersonlinerecords = unserialize(file_get_contents($file));
}else{ 
    $usersonlinequery = mysql_query("SELECT id, username FROM users WHERE privacy !='strong' AND UNIX_TIMESTAMP('" . get_date_time() . "') - UNIX_TIMESTAMP(users.last_access) < 900") or die(mysql_error());
    
    while ($usersonlinerecord = mysql_fetch_array($usersonlinequery) ) {
        $usersonlinerecords[] = $usersonlinerecord;
    }
    $OUTPUT = serialize($usersonlinerecords);
    $fp = fopen($file,"w");
    fputs($fp, $OUTPUT);
    fclose($fp);
} // end else 
if ($usersonlinerecords == ""){
    echo "No Users Online";
}else{
    foreach ($usersonlinerecords as $id=>$row) { 
        $UClass=@mysql_fetch_array(@mysql_query("SELECT Color, level,  username, avatar, added, uploaded, downloaded, privacy, age, client, donated FROM users JOIN groups ON users.class=groups.group_id WHERE users.id='$row[id]'")) 
        or die(mysql_error());
        $donor = $UClass["donated"] > 0 ? "<img src=".$site_config['SITEURL']."/images/users/money.png alt='Donor'>" : "";
        $avatar2 = htmlspecialchars($UClass["avatar"]);
    if (!$avatar2) {
        $avatar2 = "".$site_config["SITEURL"]."/themes/$THEME/images/avatars/default_avatar.gif";
    } 
    if ($UClass["privacy"] != "strong" ) {
        echo "<a href='account-details.php?id=$row[id]' title=\"$UClass[level]\"><font color=\"$UClass[Color]\" onMouseover=\"return overlib('<table width=100% class=ttable_col1 cellspacing=0 cellpadding=5 align=center><tr><td class=ttable_head colspan=2 align=center>".$row["username"]."</td></tr><tr valign=top><td><div align=center><img src=$avatar2><br /><div align=left><b>Class: </b>" . $UClass["level"] ."<br /></div><div align=left><b>Joined: </b>" . htmlspecialchars(utc_to_tz($UClass["added"])) ."<br /></div><div align=left><b>Uploaded: </b>" . mksize($UClass["uploaded"]) ."<br /></div><div align=left><b>Downloaded: </b>" . mksize($UClass["downloaded"]) ."<br /><b>Donated: </b>" . $UClass["donated"] ."&nbsp;$<br /><b>Age: </b>" . $UClass["age"] ."<br /><b>Client: </b>" . $UClass["client"] ."</td></tr></table>')\"; onMouseout=\"return nd()\">$row[username]</font></a>&nbsp;$donor, \n";
    } else{
        echo "<a href='account-details.php?id=$row[id]' title=\"$UClass[level]\"><font color=\"$UClass[Color]\" onMouseover=\"return overlib('<table width=100% class=ttable_col1 cellspacing=0 cellpadding=5 align=center><tr><td class=ttable_head colspan=2 align=center>".$row["username"]."</td></tr><tr valign=top><td><div align=center><B>This member has selected<br> to keep their details private</B></td></tr></table>')\"; onMouseout=\"return nd()\">$row[username]</font></a>&nbsp;$donor, \n";                                                                                                                                                                                                   
    } 
    } 
}
echo"</div></table></td></tr></table></center>";
}
end_block(); 
?>
Return current item: H-tracker