mIRC Home    About    Download    Register    News    Help

Topic Options
#21864 - 02/05/03 01:16 AM mirc + php == 1337
ATMA Offline
Fjord artisan

Registered: 10/12/02
Posts: 397
any one know how i can get mirc to use PHP and mySQL and stuff like that?????????

e.g.
write some code in PHP
then have it send data to a mySQL database

is this possible?????? confused
_________________________
Need amazing web design for low price: http://www.matrixn3t.net

Top
#21865 - 02/05/03 01:30 AM Re: mirc + php == 1337
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
Yes, very possible.. Just need to use sockets. >:D You'd write a script in php that recieves get variables, then have mirc visit the web page, and set the values. Eg..

If you have the page submit.php and you would like to send it values of $_GET["fname"] and $_GET["lname"], you could have mirc visit www.mysite.com and send a get request to $+(/submit.php?fname=,%fname,&,lname=,%lname) >:D
_________________________
-KingTomato

Top
#21866 - 02/05/03 01:35 AM Re: mirc + php == 1337
ATMA Offline
Fjord artisan

Registered: 10/12/02
Posts: 397
heh? u have me lost i dont know how to use sockets yet its like the one thing i dont know =/
_________________________
Need amazing web design for low price: http://www.matrixn3t.net

Top
#21867 - 02/05/03 01:43 AM Re: mirc + php == 1337
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
Describe what you want to do with this script, and I;'ll build the first have. For example, what data will you be sending? Is mirc going to replace a form field on a php page? Etc etc
_________________________
-KingTomato

Top
#21868 - 02/05/03 01:49 AM Re: mirc + php == 1337
ATMA Offline
Fjord artisan

Registered: 10/12/02
Posts: 397
ok here is what i want it to do--


every 5 min it looks to find some one on the chan
then it sends data to the SQL database saying
ison or isnton
then prints it out on a webpage (i can do that part -.-)
if i just have a small script like that to work off i can figur out how to do stuff =p
_________________________
Need amazing web design for low price: http://www.matrixn3t.net

Top
#21869 - 02/05/03 02:35 AM Re: mirc + php == 1337
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
Okay, So i assume your going to have a php webpage that is going to place everything into the MySQL database.

So if you had something like online.php?nick1=on&nick2=on&nick3=off&nick4=on&nick5=on&nick6=off
Then in the php, just send mysql_query("insert into <db> values ($_GET[nick1], $_GET[nick2],...$_GET[nickN]);");

Now, you'll get "on" or "off" in the database. You can print out status on the webpage based on whether they are on or off. Now, as for seinding the information, you can use:

-----------------------------

on 1:CONNECT: {
.timerchkonline 0 300 /checkonline
}

alias checkonline {
; set the name of the channel your checking for people on.
/set -u0 %chan #mychannel
; set the names of the people whom your checking
/set -u0 %people ATMA KingTomato ...
; Now, ghet status
/set -u0 %a 1
/unset %status
while (%a <= $numtok(%people, 32)) {
/set %status $+(%status,&,$gettok(%people, %a, 32),=)
if ($gettok(%people, %a, 32) ison %chan) { /set %status $+(%status,On) }
else { /set %status $+(%status,Off) }
/inc -u0 %a
}
/sockopen status www.yoursite.com 80
}

on 1:SOCKOPEN:status: {
if ($sockerr) { /echo -a Error: Could not submit Status }
else {
/sockwrite -n $sockname GET /online.php [ $+ [ $+(?,%status) ] ] HTTP/1.0
/sockwrite -n $sockname Host: www.yoursite.com
/sockwrite -n $sockname Connection: Keep-Alive
/sockwrite -n $sockname
}
if ($isFile(result.txt)) { .remove result.txt }
}

on 1:SOCKREAD:status: {
/sockread -f &result
/bwrite result.txt -1 -1 &result
}

on 1:SOCKCLOSE:status: {
; now, the result.txt file contains the text that would appear on the webpage
; as if you were to visit it in your browser. Use this to return if it was
; a success.
}

---------------------------------------------------

Change those in red..
_________________________
-KingTomato

Top
#21870 - 02/05/03 11:06 AM Re: mirc + php == 1337
ATMA Offline
Fjord artisan

Registered: 10/12/02
Posts: 397
hmmmm when ever i try to run the code i get a socet error
Error: Could not submit Status

do you know what could be couseing it my site is http://www.matrixn3t.net idk what the problem could be =/

im a n00b to sockets =/
_________________________
Need amazing web design for low price: http://www.matrixn3t.net

Top
#21871 - 02/05/03 05:39 PM Re: mirc + php == 1337
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
If you could, could you give me the name of the php file, and how you want the variables to be fullfilled? When I get a working version, i'll post it.
_________________________
-KingTomato

Top
#21872 - 02/05/03 05:56 PM Re: mirc + php == 1337
ATMA Offline
Fjord artisan

Registered: 10/12/02
Posts: 397
ok well thx what i want it to do is echo this information to a table:

server:
Nick:
last used command:
Channels
Op%: out of X/Y

if you could do that it would be nice thanks
_________________________
Need amazing web design for low price: http://www.matrixn3t.net

Top
#21873 - 02/05/03 06:39 PM Re: mirc + php == 1337
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
Okay, I'm working on it now, so if you would like to see the stages, keep refreshing http://www.kingtomato.com/online.php
_________________________
-KingTomato

Top
#21874 - 02/05/03 08:56 PM Re: mirc + php == 1337
codemastr Offline
Hoopy frood

Registered: 12/12/02
Posts: 2809
If I were you, I wouldn't bother with sockets. There is a dll for mIRC available that lets you communicate with a MySQL server. You can find it on mircscripts.org under the dll section, it is called "mIRC MySQL"

Top
#21875 - 02/05/03 09:41 PM Re: mirc + php == 1337
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
heh, was unaware..
There ya, use that >:D ty Codemastr
_________________________
-KingTomato

Top
#21876 - 03/05/03 03:23 AM Re: mirc + php == 1337
ATMA Offline
Fjord artisan

Registered: 10/12/02
Posts: 397
hmmm looks really nice thx so far ^_^
_________________________
Need amazing web design for low price: http://www.matrixn3t.net

Top
#21877 - 06/05/03 05:47 AM Re: mirc + php == 1337
CloCkWeRX Offline
Fjord artisan

Registered: 18/02/03
Posts: 309
Loc: Adelaide, Australia
another option is to find dragonzap's STDIO dll and run PHP 4.1.0 or greater with the CLI sapi...

You can capture output, input, etc. Screw this DLL 2 mySQl messyness, i won't even rant about sockets.

pmsg me if you are interested in finding out more
_________________________
http://www.ahsonline.com.au/dod/FOAF.rdf

Top