• Welcome to Valhalla Legends Archive.
 

[PHP] Bringing Back the Bot

Started by AC_Drkan, May 23, 2005, 05:44 PM

Previous topic - Next topic

AC_Drkan

Hey i found somethig rather interesting.

http://us4.php.net/manual/en/function.system.php

and

http://us3.php.net/manual/en/features.commandline.php

With these 2, if im not mistaken, you can execute php with your own ini file, so therefore, you could setup your own ini file and have the max_execution time set to 0 to allow it to execute indefinately?

This question was dealing with the PHP Bot for battle.net
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

Banana fanna fo fanna

But if the bot runs forever, the PHP won't ever return anything and will (probably) time out via Apache (though I'm not sure)

Warrior

Those functions are pretty cool, try it
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

AC_Drkan

Will do. Im developing it as i post this. Will bne posting code for all you Source Pirates
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

MyndFyre

Quote from: AC_Drkan on May 23, 2005, 08:20 PM
Will bne posting code for all you Source Pirates
*squeaky nerdy voice* th4nk j0o soo much mr. drkan!1!11!eleven!!  Now I can m4k3 my 0wn l33t b0t!!1!!1!
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

AC_Drkan

#5
Quote from: MyndFyre on May 23, 2005, 08:57 PM
Quote from: AC_Drkan on May 23, 2005, 08:20 PM
Will bne posting code for all you Source Pirates
*squeaky nerdy voice* th4nk j0o soo much mr. drkan!1!11!eleven!!  Now I can m4k3 my 0wn l33t b0t!!1!!1!
lmao....

Ok, i have a little problem, here it is:
The server i will be running this will have Linux.
The development platfoirm is Windows XP Pro

The include paths are dofferent correct?
Windows: include_path = ".;C:\apache2triad\php;C:\apache2triad\php\smarty;C:\apache2triad\php\pear"
So what would it be in Linux?

I have SSH access on the server so im able to view directories.

Or can i just take the line out?

Nvm...Figured it out with my ub3r l337 ski11z
Linux Include Path: /usr/local/apache

Another edit:
Cannot find the php.ini in that directory, is ther like, a search command in Linux?
Search php.ini produced nothing and said the command did not exsist

GOD I LOVE GOOGLE!
!!!HIDDEN!!!:~ > whereis php.ini
php: /usr/local/bin/php4.old
/usr/local/bin/php4.20030910
/usr/local/bin/php
/usr/local/lib/php3.ini
/usr/local/lib/php
/usr/local/lib/php.ini


So if i make this....Can someone make the connection code to log onto BNET with a Key?

We could go pretty with this if it works.
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

AC_Drkan

#6
The Custom PHP.ini File:(Adjust it to fit your needs)
memory_limit = 400M;
upload_max_filesize = 20M;
max_execution_time = 0;
max_execution_time = 0;
register_globals = on;
error_reporting  =  E_ALL & ~E_NOTICE & ~E_WARNING


In Install.php:
<?php

system
("php -c /kunden/homepages/17/d105382477/htdocs/BotTest/php.ini File -f Bot.php"$retval);

echo(
"The Execution Returned: $retval");

?>


PLEASE NOTE..THIS CODE WILL ONLY WORK ON THE SERVER I HAVE IT ON. PLEASE REPLACE /kunden/homepages/17/d105382477/htdocs/BotTest/ WITH THE LOCATION OF THE CUSTOM PHP.INI FILE

Alrighty. i have the bot done, but MAN I LOVE DEBUGGING MY OWN CODE!, lemmie just work out all the bugs
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

AC_Drkan

Need some help:

Parse error: parse error, unexpected $ in /homepages/17/d105382477/htdocs/BotTest/bot.php on line 90


With this code:
<?php

$config 
= Array();
$config['server'] = "useast.bettle.net";
$config['port'] = 6112;
$config['username'] = "";
$config['password'] = "";
$config['home'] = "public Chat PHP";
$config['idle'] = "/me ::..:: is a PHP Bot version 0.2 http://www.flawgaming.com for more Details ::..::";
$config['timeout'] = 10;

// =================================================================================
// DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOUR DOING
// =================================================================================

$conn = Array();
$conn['count'] = 0;
$conn['info'] = "";
$conn['discreason'] = "";
$conn['terminate'] = FALSE;
$conn['disconnect'] = FALSE;
$conn['chat'] = chr(3).chr(4);
$conn['enter'] = chr(10).chr(13);
$conn['connection'] = fsockopen("tcp://".$config['server'], $config['port'], $Errno$Errstr$config['timeout']);

if (!
$conn['connection']) {
$conn['terminate'] = TRUE;
$conn['reason'] = "Unable to Connect to The server.";
}

if (
$conn['terminate']) {
fputs($conn['connection'], $conn['chat']);
fputs($conn['connection'], $config['username']);
fputs($conn['connection'], $config['password']);

while ($conn['disconnect']) {
if (false === ($conn['info'] = fgets($conn['connection']))) {
$conn['terminate'] = TRUE;
$conn['disconnect'] = TRUE;
$conn['discreason'] = "Unable to Read incoming Data.";
}

$conn['refuse'] = strpos($info"refused");
if ($conn['refuse']) {
$conn['terminate'] = TRUE;
$conn['disconnect'] = TRUE;
$conn['discreason'] = "The Connection to the server was refused.";
}

$conn['badlogin'] = strpos($info"Login Incorrect");
if ($conn['refuse']) {
$conn['terminate'] = TRUE;
$conn['disconnect'] = TRUE;
$conn['discreason'] = "Invalid Username/Password.";
}

$conn['tmp'] = substr($conn['info'], 4);
$conn['tmp'] = "a".$conn['tmp'];
$conn['res'] = strpos($conn['info'], "2000");

if (!$conn['terminate']) {
fputs($conn['connection'], "/join ".$config['home'].$conn['enter']);
while (!$conn['abort']) {
$conn['info'] = fgets($conn['connection']);
$conn['tmp'] = substr($conn['info'], 04);
$conn['tmp'] = "a".$conn['tmp'];

if (strpos($conn['tmp'], "2000")) {
$conn['count'] = $conn['count'] + 1;
if ($conn['count'] >= 20) {
$conn['terminate'] = TRUE;
$conn['disconnect'] = TRUE;
$conn['discreason'] = "Disconnect Count Reached.";
}
fputs($conn['connection'], $config['idle'].$conn['enter']);
}
}
}

if ($conn['connection']) {
fclose($conn['connection']);
}

if (!$conn['terminate']) {
echo "Terminated";
} else {
echo $conn['discreason'];
}
}
?>
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

R.a.B.B.i.T

Writing your own code would probably help you fix errors.  People here don't much like helping people who come and say "fix this other person's broken code".  It just doesn't work out too well.

AC_Drkan

Quote from: rabbit on May 25, 2005, 06:21 PM
Writing your own code would probably help you fix errors.  People here don't much like helping people who come and say "fix this other person's broken code".  It just doesn't work out too well.

I did write my own code and thats my code.
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

Banana fanna fo fanna

Quote from: rabbit on May 25, 2005, 06:21 PM
Writing your own code would probably help you fix errors.  People here don't much like helping people who come and say "fix this other person's broken code".  It just doesn't work out too well.

You're a douchebag.

MyndFyre

Quote from: AC_Drkan on May 24, 2005, 05:22 PM
Need some help:

Parse error: parse error, unexpected $ in /homepages/17/d105382477/htdocs/BotTest/bot.php on line 90


With this code:

Almost universally in scripting languages, errors like this indicate something along the lines of an unterminated string constant, an unclosed brace, or something similar.  What do I mean by "like this?"  Well, I pasted your code into notepad, and line 90 (where the interpreter reports the error) is the end of the file.

Having scanned through your code, I didn't see anything like that, but I'm pretty tired and haven't gotten much sleep the past couple days, so I might have missed something.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

AC_Drkan

Quote from: MyndFyre on May 25, 2005, 09:13 PM
Quote from: AC_Drkan on May 24, 2005, 05:22 PM
Need some help:

Parse error: parse error, unexpected $ in /homepages/17/d105382477/htdocs/BotTest/bot.php on line 90


With this code:

Almost universally in scripting languages, errors like this indicate something along the lines of an unterminated string constant, an unclosed brace, or something similar.  What do I mean by "like this?"  Well, I pasted your code into notepad, and line 90 (where the interpreter reports the error) is the end of the file.

Having scanned through your code, I didn't see anything like that, but I'm pretty tired and haven't gotten much sleep the past couple days, so I might have missed something.

Yeah. I plugged it into a few debuggers cause i got tired of the error and found nothing.

I decided to rewrite it from scratch. will post code later on, im tired right now.. Good Night all.
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

R.a.B.B.i.T

Quote$config['idle'] = "/me ::..:: is a PHP Bot version 0.2 http://www.flawgaming.com for more Details ::..::";
Didn't look like it to me, sorry.

AC_Drkan

#14
Quote from: rabbit on May 26, 2005, 05:47 PM
Quote$config['idle'] = "/me ::..:: is a PHP Bot version 0.2 http://www.flawgaming.com for more Details ::..::";
Didn't look like it to me, sorry.

Actually, thats my domain. registered to me. Want me to change it to something?

well when i get more than 5 minutes where i can actually do something then i will change it.
See i have a life. A job. A gf.

AND BY THE WAY. i left you a little not at the bottom of the page. view it to find the note.
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.