This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help needed

Help for those learning Tcl or writing their own scripts.
Post Reply
K
KillerBoy
Voice
Posts: 2
Joined: Sun Apr 02, 2006 7:44 am

Help needed

Post by KillerBoy »

ok guys iam trying to make my script done but it wont give the way i wanted
i wanted a search system which will find the users starting ore where the name is in
like !user test
and the php file is ok and give me the result what i need when i vissit it true my inetx
like
testing test
it give me more then 1 result now i wanted to put the result true my eggdrop into my irc channel but i wont work
it only gives me 1 username but there are 3 users who got test in there name
those are the scripts but not working ok

Code: Select all

<?php
error_reporting(7);

define ('LF', "\n");
// DEFINE YOUR MYSQL INFORMATION HERE!
$server="localhost";
$dbuser="user";
$dbpass="pass";
$db="database";

mysql_pconnect($server,$dbuser,$dbpass);
mysql_select_db($db);

$username=$_GET["username"];
$usernfo=mysql_query("SELECT * FROM users WHERE UPPER(nickname) LIKE UPPER('%$username%') ");

 while($user=mysql_fetch_array($usernfo)) {
  echo 
  LF, $user[nickname],
  LF, $user[joindate],
  LF, $user[posts];
  }     
?>
And the tcl

Code: Select all

set url "http://localhost/ircscripts/user.php"
set agent "Mozilla"
package require http
bind pub "-|-" !user getstatus

proc getstatus { 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 data [http::geturl $query]
                          set data2 [http::data $data] 
                          set lines [split [::http::data $data] \n]
                          set ok [lindex $lines 1]
			  set date [lindex $lines 2]
                          set nickname [lindex $lines 1]
			  set posts [lindex $lines 3]
                          upvar #0 $page state
                          set max 0
                          http::cleanup $data 
                          foreach line [split $data2 \n] { 
                          if {$ok != ""} {
                                putquick "PRIVMSG $channel :\00307,01 \002\[User\] \00307,01 \002$nickname : \00314,01Status \00307,01$posts JOINED AT $date"                     
                         } else {
                                putquick "PRIVMSG $channel :\00307,01 \002\[User\] \00307,01 \002$text not found"
                         }
                         }
                 } 
}
please let me finnish thanxs alot
Post Reply