05-15-2007, 06:14 PM
|
#1 |
| | userstat ploblem | hello guys, i have a little problem :| , and im looking for help, tcl and php file works very good, only teamname is wrong, because it appears IND for all users 
[FxP Team: iND]
PHP: Quote:
<?php
error_reporting(7);
define ('LF', "\n");
$server="localhost";
$dbuser="user";
$dbpass="vb";
$db="user1";
$link = mysql_pconnect($server,$dbuser,$dbpass);
$username=$_GET["username"];
if ($link)
{
$db_selected = mysql_select_db($db, $link);
$user=mysql_query("SELECT * FROM user WHERE username='".addslashes(htmlspecialchars($username) )."'");
$user=mysql_fetch_array($user);
if ($user['userid'])
{
#$team = mysql_query("SELECT * FROM team WHERE teamid='$user[userid]'");
#$teaminfo=mysql_fetch_array($team);
if ($teaminfo['name'] !='') {
$team = $teaminfo['name'];
} else {
$team = "iND";
}
echo
LF, $user[username],
LF, $team,
LF, $user[posts],
LF, $user[pubs],
LF, $user[hacks],
LF, $user[scans],
LF, $user[races],
LF, $user[mirror],
LF, $user[leeches],
LF, $user[credits];
}
} else {
echo LF, mysql_error($conn);
}
?>
| TCL: Quote:
set url "http://vbsite/userstat.php"
set agent "Mozilla"
package require http
bind pub "-|-" !user stat
proc stat { nick host handle channel text } {
global chan url agent
putlog "$text"
if {$text != ""} {
set query "$url?username=$text"
set page [http::config -useragent $agent]
set page [http::geturl $query]
set lines [split [::http::data $page] \n]
set nick [lindex $lines 1]
set teams [lindex $lines 2]
set post [lindex $lines 3]
set pub [lindex $lines 4]
set hacks [lindex $lines 5]
set scan [lindex $lines 6]
set race [lindex $lines 7]
set mirror [lindex $lines 8]
set leeches [lindex $lines 9]
set credits [lindex $lines 10]
upvar #0 $page state
set max 0
if {$nick != ""} {
putquick "PRIVMSG $channel :\002\0037Forum User Stats For:\003 $nick ";
putquick "PRIVMSG $channel :\0037\002\[\0037FxP Team: \003$teams\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Posts:\003 $post\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Filled:\003 $pub\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Hacks:\003 $hacks\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Scans:\003 $scan\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Races:\003 $race\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Mirrors:\003 $mirror\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Leeched:\003 $leeches\0037\002\]";
putquick "PRIVMSG $channel :\0037\002\[\0037Credits:\003 $credits\0037\002\]"
} else {
putquick "PRIVMSG $channel :\0037\002\[ No User Found \002\]"
}
http::cleanup $page
} else {
putquick "PRIVMSG $channel :!user <Username>: Get User Stats."
}
}
| someone check it out and please fix my problem.
regards.
| |