<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18849" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2012-02-22T15:46:00-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18849</id>

		<entry>
		<author><name><![CDATA[Johannes13]]></name></author>
		<updated>2012-02-22T15:46:00-04:00</updated>

		<published>2012-02-22T15:46:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=98846#p98846</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=98846#p98846"/>
		<title type="html"><![CDATA[Help please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=98846#p98846"><![CDATA[
Please note that this script is unsafe.<br>I can choose one of the new users on the site and join the chan with such a nick, and change the nick after that to my real nick like Johannes13<br><br>An other thing is that the mysql handle is not closed when the nick is valid.<br>PROTIP: warp all the stuff after mysqlconnect with a catch, so if there is an error, it will still close the mysql handle<br><br>Ok, here a version (it still only checks the nicks, but probably you want to make sure that the nick is registered with nickserv or smillar (by setting a channel mode that let only registered users join etc..) <br><div class="codebox"><p>Code: </p><pre><code>package require mysqltcl#-&gt; Change the information below to connect to your MySQL databaseset mysqlserver localhost;set mysqluser ***;set mysqlpwd ***;set mysqldb ***;#-&gt; Change the chan below for the chan you wish to monitorsetudef flag checknickbind join - * joinsproc joins {nick host hand chan} {if {[channel get $chan checknick]} {set db_handle [mysqlconnect -h $::mysqlserver -u $::mysqluser -password $::mysqlpwd];set code [catch {mysqluse $db_handle $::mysqldbset sql "SELECT id FROM users WHERE username='[mysqlescape $nick]'"set result [mysqlsel $db_handle $sql -list]} res opt]mysqlclose $db_handleif {$code != 0} {return -opt $opt $res}if {$result &gt; 0 } {putserv "NOTICE $nick :welcome"} else {putserv "kick $chan $nick :To join this channel you first need to register at http://cwukchat.com/modules/profile/register.php"}}}</code></pre></div>And it uses now a flag, so you can activate that script for more than 1 channel. (use .chanset #channel +checknick)<br><br>PS.: I think, I used again some Tcl 8.5 features.. so if you have an older version of Tcl installed, it does not work.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11381">Johannes13</a> — Wed Feb 22, 2012 3:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-02-22T14:22:00-04:00</updated>

		<published>2012-02-22T14:22:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=98845#p98845</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=98845#p98845"/>
		<title type="html"><![CDATA[Help please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=98845#p98845"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {[string equal -nocase -- $chan $userChan]} {</code></pre></div>Have you tried removing -- in this line?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Feb 22, 2012 2:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[blake]]></name></author>
		<updated>2012-02-22T13:51:45-04:00</updated>

		<published>2012-02-22T13:51:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=98844#p98844</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=98844#p98844"/>
		<title type="html"><![CDATA[Help please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=98844#p98844"><![CDATA[
Hey I found the following script here on the forums and want to try see if it works on my server but i get the following error on the partyline<br><br>Also would like to beable to get it to work for any channels i set in the script not just one channel<br><blockquote class="uncited"><div>Tcl error [joins]: bad option "--": must be -nocase or -length</div></blockquote>This is the script<div class="codebox"><p>Code: </p><pre><code>package require mysqltcl #-&gt; Change the information below to connect to your MySQL database set mysqlserver localhost; set mysqluser ***; set mysqlpwd ***; set mysqldb ***; #-&gt; Change the chan below for the chan you wish to monitor set userChan "#test" bind join - * joins proc joins {nick host hand chan} {global userChan if {[string equal -nocase -- $chan $userChan]} {set db_handle [mysqlconnect -h $::mysqlserver -u $::mysqluser -password $::mysqlpwd]; mysqluse $db_handle $::mysqldb set sql "SELECT id FROM users WHERE username='[mysqlescape $nick]'" set result [mysqlsel $db_handle $sql -list] } set result [mysqlsel $db_handle $sql -list] if {$result &gt; 0 } { putserv "NOTICE $userChan $nick :welcome" } else { putserv "kick $userChan $nick :To join this channel you first need to register at http://cwukchat.com/modules/profile/register.php" mysqlclose $db_handle; }} </code></pre></div>Many Thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10512">blake</a> — Wed Feb 22, 2012 1:51 pm</p><hr />
]]></content>
	</entry>
	</feed>
