| View previous topic :: View next topic |
| Author |
Message |
asmds Voice
Joined: 30 Jul 2005 Posts: 1
|
Posted: Sat Jul 30, 2005 5:26 pm Post subject: mysql table read |
|
|
Hi all
Im trying to understand mysql and tcl because i want to do a script that uses a database, but i need some help.
first : i want that my eggdrop reads from a database when a user join my channel to see if that user is registered in a website that i run, if the user is not registered the bot will ban him and ask the user to do the registration.
I know how to do the basic TCL for this script, i just cant do the mysql part.
can you give me an example of the code to see +/- how to do it ? what do i need to run mysql ? mysqltcl only ?
the table is small, the fields are
| Code: | `id` mediumint(8) NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
`mgroup` smallint(3) NOT NULL default '0',
`password` varchar(32) NOT NULL default '', |
Thanks |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Jul 30, 2005 6:35 pm Post subject: |
|
|
| did you go here already? if not, do so |
|
| Back to top |
|
 |
Galadhrim Op
Joined: 11 Apr 2003 Posts: 123 Location: Netherlands, Enschede
|
Posted: Sun Jul 31, 2005 5:23 am Post subject: |
|
|
| Quote: | | what do i need to run mysql ? mysqltcl only ? |
You need a mysql server, like the one from your site. (The data doesn't come from a blackhole ) And you need mysqltcl. You can talk to the server using the mysqltcl in your tcl script.
Once you got that create a query that gets the user data from the database like
| Code: | | SELECT * FROM users WHERE username='$nick' |
Then you can read the data and decide if the person can stay or not. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Aug 02, 2005 5:51 am Post subject: |
|
|
| besides the popular among this community mysql.mod module and mysqltcl APIs, there's third option for using SQL database with eggdrop: SQLite, small & fast database engine with Tcl interface |
|
| Back to top |
|
 |
Galadhrim Op
Joined: 11 Apr 2003 Posts: 123 Location: Netherlands, Enschede
|
Posted: Tue Aug 02, 2005 7:47 am Post subject: |
|
|
| indeed, with that you dont need a separate mysql database server, since the package is the server. |
|
| Back to top |
|
 |
|