PDA

View Full Version : problem with fopen and input


bandersen
02-01-2003, 05:59 PM
Hi - I am trying to get the Tombot AI hack to work but have trouble with the bot reply. I appreciate any help.

This is the section in tomstalkerbot.php that gives the reply:

$rss = preg_replace("#^(.*)\[/quote\]#ies","",$message);
$ff = fopen($ttb_alicelocation . "?input=" . urlencode($rss),"r");
$response = fread($ff,10000);
fclose($ff);

Edit: using the above I only got the smileys in the reply.
I changed it to the following:

$rss = preg_replace("#^(.*)\[/quote\]#ies","",$message);
shell_exec("fetch -o /forums/upload/alice \"$ttb_alicelocation?input=".urlencode($rss)."\"");
$ff = fopen("/forums/upload/alice","r");
$response = fread($ff,10000);
fclose($ff);

This is how the reply comes up (se attachment for picture):

Ž³ .Šµ .. ³aimlN=푳 sql’³ src“³
COPYING³,#talk.php?input=are+you+there+now%3F³ ,!talk.php?input=testing+thi s+thing#ÀA¶X2talk.php? input=Testing+after+incl+Mike%27s+changesÇ

(ps:he repeats/ answers the third question with all 3 separate questions/posts)

I use 2.2.9
Php 4.2.3
I am on a shared server, but php.ini does not have safe mode enabled. I have tried to change the $ttb_alicelocation (/forums/upload/alice) to the full path (/user222/username/public_html/forums/upload/alice) with no changes in the reply.

I appreciate any help!

bandersen
02-03-2003, 04:13 PM
OK - my server said it disabled "remote" fopen, but that fopen will work for all local files.

Can someone help with the following:
How do I rephrase the following so that it will work /reads as local:

$ff = fopen($ttb_alicelocation . "?input=" . urlencode($rss),"r");

where

$ttb_alicelocation =
"http://www.mydomain.com/forums/upload/alice/src/talk.php";

Could I use something like:

$ttb_alicelocation = "/forums/upload/alice/src/talk.php"; ....ps...that is not working, maybe I'm writing it wrong?

or should I change the $ff = fopen....... to something?

cirisme
04-02-2003, 04:22 PM
What I did was change that code to

include "E:\\network\\Apache2\\htdocs\\forum\\alice\\src\\r espond.php";

# Here is where we get the reply.
$botresponse=reply($rss,"5");

$response = $botresponse->response;

I also went into the TomBot files and modified the gettemplate() function to be gettemplate2() so it wouldn't conflict with vBulletin. The only problem with doing it this way is that I get warnings that some regular expressions are empty, but it works fine nonetheless.

(note: this code is the same as what is in the file that it is trying to fopen)