PDA

View Full Version : Karma and Thread View Hack


pgowder
04-04-2002, 10:00 PM
This is my first "hack". (Not really a hack, just a combination of two.)

I wanted to be able to combine these two hacks, so here is what I did.

This will give you a table with the totals.

You need to make sure that al the fields in your storepoint table are not null and default 0.

Hope you enjoy.


<html>
<head>
</head>
<body>
<table CELLSPACING=0 BORDER=1 WIDTH=70% align="center">
<tr BGCOLOR=#3300CC>
<td align="center"><font color="white" size="+1"><b>Username</b></font></td><td align="center"><font color="white" size="+1"><b>Karma Points</b></font></td><td align="center"><font color="white" size="+1"><b>Views</b></font></td><td align="center"><font color="white" size="+1"><b>Total</b></font></td>
</tr>



<?

$hostname = "";
$username = "";
$password = "";
$dbName = "";
MYSQL_CONNECT($hostname,$username,$password) OR DIE("Unable to connect to database");
@mysql_select_db("$dbName") or die("Unable to select database");


$query = "select uid, newthread+reply+view+admin_mod+morereply+totalpena lty as total from storepoint order by total desc";



$my_q = mysql_query($query) or die(mysql_error());
$row_count = mysql_num_rows($my_q);
for ($i=0; $i<$row_count; $i++) {
list($uid, $total) = mysql_fetch_row($my_q);
$my_q2 = mysql_query("select username, views from user where userid='$uid'") or die(mysql_error());
list($username, $views) = mysql_fetch_row($my_q2);
$karmatotal = $total + $views;
print "<tr><td BGCOLOR=#ffffcc>$username</td><td BGCOLOR=#ffffcc align=center>$total</td><td BGCOLOR=#ffffcc align=center>$views</td><td BGCOLOR=#ffffcc align=center>$karmatotal</td></tr>";
mysql_free_result($my_q2);
}

mysql_free_result($my_q);


?>

</table>
</body>
</html>

MrLister
04-05-2002, 04:13 PM
Shouldn't this be a "upgrade" to a previous hack or something. Rather then just putting two hacks together and clicking on the new hack button?

pgowder
04-05-2002, 05:08 PM
Wasn't sure where it should go.

Mods, please move if needed.

Thanks

Velocd
04-05-2002, 06:06 PM
How about some more detailed instructions? That might help ;)

pgowder
04-05-2002, 06:14 PM
If you want to use the Karma hack and provide a way for members to get points for reading threads, this is how to do it.

This is a standalone script. You can create references to it from your vb.

Input your system settings, and upload to your site.