mIRC Home    About    Download    Register    News    Help

Print Thread
mirc + php == 1337 #21864 02/05/03 12:16 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
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
Re: mirc + php == 1337 #21865 02/05/03 12:30 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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
Re: mirc + php == 1337 #21866 02/05/03 12:35 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
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
Re: mirc + php == 1337 #21867 02/05/03 12:43 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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
Re: mirc + php == 1337 #21868 02/05/03 12:49 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
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
Re: mirc + php == 1337 #21869 02/05/03 01:35 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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
Re: mirc + php == 1337 #21870 02/05/03 10:06 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
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
Re: mirc + php == 1337 #21871 02/05/03 04:39 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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
Re: mirc + php == 1337 #21872 02/05/03 04:56 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
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
Re: mirc + php == 1337 #21873 02/05/03 05:39 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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
Re: mirc + php == 1337 #21874 02/05/03 07:56 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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"

Re: mirc + php == 1337 #21875 02/05/03 08:41 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
heh, was unaware..
There ya, use that >:D ty Codemastr


-KingTomato
Re: mirc + php == 1337 #21876 03/05/03 02:23 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
hmmm looks really nice thx so far ^_^


Need amazing web design for low price: http://www.matrixn3t.net
Re: mirc + php == 1337 #21877 06/05/03 04:47 AM
Joined: Feb 2003
Posts: 309
C
CloCkWeRX Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
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