Valhalla Legends Forums Archive | Web Development | [PHP] Bringing Back the Bot

AuthorMessageTime
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
May 23, 2005, 10:44 PM
St0rm.iD
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)
May 23, 2005, 11:55 PM
Quarantine
Those functions are pretty cool, try it
May 24, 2005, 12:51 AM
AC_Drkan
Will do. Im developing it as i post this. Will bne posting code for all you Source Pirates
May 24, 2005, 1:20 AM
Myndfyr
[quote author=AC_Drkan link=topic=11686.msg113552#msg113552 date=1116897656]
Will bne posting code for all you Source Pirates
[/quote]
*squeaky nerdy voice* th4nk j0o soo much mr. drkan!1!11!eleven!!  Now I can m4k3 my 0wn l33t b0t!!1!!1!
May 24, 2005, 1:57 AM
AC_Drkan
[quote author=MyndFyre link=topic=11686.msg113555#msg113555 date=1116899850]
[quote author=AC_Drkan link=topic=11686.msg113552#msg113552 date=1116897656]
Will bne posting code for all you Source Pirates
[/quote]
*squeaky nerdy voice* th4nk j0o soo much mr. drkan!1!11!eleven!!  Now I can m4k3 my 0wn l33t b0t!!1!!1!
[/quote]
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?
[code]Windows: include_path = ".;C:\apache2triad\php;C:\apache2triad\php\smarty;C:\apache2triad\php\pear"[/code]
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
[code]Linux Include Path: /usr/local/apache[/code]

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!
[code]!!!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[/code]

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.
May 24, 2005, 2:01 AM
AC_Drkan
The Custom PHP.ini File:(Adjust it to fit your needs)
[code]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
[/code]

In Install.php:
[code]<?php

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

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

?>[/code]

PLEASE NOTE..THIS CODE WILL ONLY WORK ON THE SERVER I HAVE IT ON. PLEASE REPLACE [code]/kunden/homepages/17/d105382477/htdocs/BotTest/[/code] 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
May 24, 2005, 9:05 PM
AC_Drkan
Need some help:
[code]
Parse error: parse error, unexpected $ in /homepages/17/d105382477/htdocs/BotTest/bot.php on line 90[/code]

With this code:
[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'], 0 , 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'], 0, 4);
$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'];
}
}
?>[/code]
May 24, 2005, 10:22 PM
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.
May 25, 2005, 11:21 PM
AC_Drkan
[quote author=rabbit link=topic=11686.msg113737#msg113737 date=1117063282]
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.
[/quote]

I did write my own code and thats my code.
May 25, 2005, 11:30 PM
St0rm.iD
[quote author=rabbit link=topic=11686.msg113737#msg113737 date=1117063282]
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.
[/quote]

You're a douchebag.
May 26, 2005, 12:41 AM
Myndfyr
[quote author=AC_Drkan link=topic=11686.msg113633#msg113633 date=1116973347]
Need some help:
[code]
Parse error: parse error, unexpected $ in /homepages/17/d105382477/htdocs/BotTest/bot.php on line 90[/code]

With this code:
[/quote]

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.
May 26, 2005, 2:13 AM
AC_Drkan
[quote author=MyndFyre link=topic=11686.msg113762#msg113762 date=1117073620]
[quote author=AC_Drkan link=topic=11686.msg113633#msg113633 date=1116973347]
Need some help:
[code]
Parse error: parse error, unexpected $ in /homepages/17/d105382477/htdocs/BotTest/bot.php on line 90[/code]

With this code:
[/quote]

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.
[/quote]

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.
May 26, 2005, 2:28 AM
R.a.B.B.i.T
[quote]$config['idle'] = "/me ::..:: is a PHP Bot version 0.2 http://www.flawgaming.com for more Details ::..::";[/quote]
Didn't look like it to me, sorry.
May 26, 2005, 10:47 PM
AC_Drkan
[quote author=rabbit link=topic=11686.msg113870#msg113870 date=1117147644]
[quote]$config['idle'] = "/me ::..:: is a PHP Bot version 0.2 http://www.flawgaming.com for more Details ::..::";[/quote]
Didn't look like it to me, sorry.
[/quote]

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.
May 27, 2005, 8:20 PM
St0rm.iD
[quote author=AC_Drkan link=topic=11686.msg113932#msg113932 date=1117225200]
[quote author=rabbit link=topic=11686.msg113870#msg113870 date=1117147644]
[quote]$config['idle'] = "/me ::..:: is a PHP Bot version 0.2 http://www.flawgaming.com for more Details ::..::";[/quote]
Didn't look like it to me, sorry.
[/quote]

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.
[/quote]

wahhhhh
May 29, 2005, 1:46 AM
Quarantine
Good Job, AC_Drkan.

May 29, 2005, 2:30 AM
R.a.B.B.i.T
The first thing I thought was "flawed".

Also, if you have enough time to change the source to your page, you should have enough time to order a different domain, which takes all of TWO MINUTES.

Finally, like I care what someone thinks if they can't even spell "newb".  You're a dumbass.
May 29, 2005, 2:36 PM
AC_Drkan
[quote author=rabbit link=topic=11686.msg114054#msg114054 date=1117377403]
The first thing I thought was "flawed".

Also, if you have enough time to change the source to your page, you should have enough time to order a different domain, which takes all of TWO MINUTES.

Finally, like I care what someone thinks if they can't even spell "newb".  You're a dumbass.
[/quote]
Please uninstall CS and any other game your have.

Thats called l337 speak. or LEET, just for you.

|24|3|317
Is your username rabbit spelled in l337 speak

Me a dumbass.......look whos being an ass. U R (oops sorry) YOUR ARE.

Don't deny it, i could own you so bad in CS My score on average is about(out of 100 rounds) is 97(kills) to 14(deaths).

And let me guess, youll post a message saying oh yeah....well my score is 5 million - 1, but lemmie guess your score...

-10(kills) to 90(deaths)
May 30, 2005, 2:48 AM
UserLoser.
[quote author=AC_Drkan link=topic=11686.msg114142#msg114142 date=1117421290]
[quote author=rabbit link=topic=11686.msg114054#msg114054 date=1117377403]
The first thing I thought was "flawed".

Also, if you have enough time to change the source to your page, you should have enough time to order a different domain, which takes all of TWO MINUTES.

Finally, like I care what someone thinks if they can't even spell "newb".  You're a dumbass.
[/quote]
Please uninstall CS and any other game your have.

Thats called l337 speak. or LEET, just for you.

|24|3|317
Is your username rabbit spelled in l337 speak

Me a dumbass.......look whos being an ass. U R (oops sorry) YOUR ARE.

Don't deny it, i could own you so bad in CS My score on average is about(out of 100 rounds) is 97(kills) to 14(deaths).

And let me guess, youll post a message saying oh yeah....well my score is 5 million - 1, but lemmie guess your score...

-10(kills) to 90(deaths)
[/quote]

userloser.net:27016
May 30, 2005, 3:22 AM
KkBlazekK
Actually, rabbit was quite good last time I played him.
May 30, 2005, 4:12 AM
AC_Drkan
[quote author=UserLoser link=topic=11686.msg114147#msg114147 date=1117423328]
userloser.net:27016
[/quote]

If i ever have time to go play on it ill join it.

Your server is down at 12:30 EST time.

My server, whenever i get the chance to run it, is

68.50.77.212:27020
May 30, 2005, 4:25 PM
NicoQwertyu
64.154.38.23:27015 is where the party's at.

Edit: Either Warrior or Banana, please turn off your email notification.
May 31, 2005, 4:06 AM
Quarantine
Not i
May 31, 2005, 11:18 PM
R.a.B.B.i.T
[quote author=AC_Drkan link=topic=11686.msg114142#msg114142 date=1117421290]
[quote author=rabbit link=topic=11686.msg114054#msg114054 date=1117377403]
The first thing I thought was "flawed".

Also, if you have enough time to change the source to your page, you should have enough time to order a different domain, which takes all of TWO MINUTES.

Finally, like I care what someone thinks if they can't even spell "newb".  You're a dumbass.
[/quote]
Please uninstall CS and any other game your have.

Thats called l337 speak. or LEET, just for you.

|24|3|317
Is your username rabbit spelled in l337 speak

Me a dumbass.......look whos being an ass. U R (oops sorry) YOUR ARE.

Don't deny it, i could own you so bad in CS My score on average is about(out of 100 rounds) is 97(kills) to 14(deaths).

And let me guess, youll post a message saying oh yeah....well my score is 5 million - 1, but lemmie guess your score...

-10(kills) to 90(deaths)
[/quote]I know what l33tspeak is, but it's still evidence of whoever "speaks" with it is a complete moron.  If you want to insult me, try not to make yourself look retarded in the process.
June 2, 2005, 3:00 AM
AC_Drkan
[quote author=rabbit link=topic=11686.msg114525#msg114525 date=1117681219]
[quote author=AC_Drkan link=topic=11686.msg114142#msg114142 date=1117421290]
[quote author=rabbit link=topic=11686.msg114054#msg114054 date=1117377403]
The first thing I thought was "flawed".

Also, if you have enough time to change the source to your page, you should have enough time to order a different domain, which takes all of TWO MINUTES.

Finally, like I care what someone thinks if they can't even spell "newb".  You're a dumbass.
[/quote]
Please uninstall CS and any other game your have.

Thats called l337 speak. or LEET, just for you.

|24|3|317
Is your username rabbit spelled in l337 speak

Me a dumbass.......look whos being an ass. U R (oops sorry) YOUR ARE.

Don't deny it, i could own you so bad in CS My score on average is about(out of 100 rounds) is 97(kills) to 14(deaths).

And let me guess, youll post a message saying oh yeah....well my score is 5 million - 1, but lemmie guess your score...

-10(kills) to 90(deaths)
[/quote]I know what l33tspeak is, but it's still evidence of whoever "speaks" with it is a complete moron.  If you want to insult me, try not to make yourself look retarded in the process.
[/quote]

my server today. 5:00. Be there. Ill even take little demos for all to download.
June 2, 2005, 10:39 AM

Search