A little help with MooSock
Hi everybody!
I'm not sure if the problem has to do with MooSock or my php code. My php scrip says:
<?php
$fp=fopen($filename,"a")
or die("Can't open file");
$today=date("Y-m-d-H.i.s");
$line="\n";
$insert=fputs($fp,$line);
$write_donnee=fputs($fp,$datas);
fclose($fp);
?>
And my MMF2 application says:
Send text "GET "+"http://my_site"+"/tstphp/test.php"
Send text "?filename="
Send text "test.txt"
Send text "&datas="
Send text "1234"
Send text " HTTP/1.0"+string$( "LF" )+"From: []mehere@now.com"+string$([/] "LF" )+"User-Agent: HTTPTool/1.0"+string$( "LF" )+string$( "LF" )
My app connects with the site and loads the php file without problem. But I get that message:
<b>Notice</b>: Undefined variable: filename in <b>E:\Web\localuser\My_name\tstphp\test.php& lt;/b> on line <b>9</b><br />
If I write the filename in the php code, I will have a message that the variable $datas is not defined...
Any idea?
Thanks!
MB
A little help with MooSock
Hi everybody!
I'm not sure if the problem has to do with MooSock or my php code. My php scrip says:
<?php
$fp=fopen($filename,"a")
or die("Can't open file");
$today=date("Y-m-d-H.i.s");
$line="\n";
$insert=fputs($fp,$line);
$write_donnee=fputs($fp,$datas);
fclose($fp);
?>
And my MMF2 application says:
Send text "GET "+"http://my_site"+"/tstphp/test.php"
Send text "?filename="
Send text "test.txt"
Send text "&datas="
Send text "1234"
Send text " HTTP/1.0"+string$( "LF" )+"From: []mehere@now.com"+string$([/] "LF" )+"User-Agent: HTTPTool/1.0"+string$( "LF" )+string$( "LF" )
My app connects with the site and loads the php file without problem. But I get that message:
<b>Notice</b>: Undefined variable: filename in <b>E:\Web\localuser\My_name\tstphp\test.php& lt;/b> on line <b>9</b><br />
If I write the filename in the php code, I will have a message that the variable $datas is not defined...
Any idea?
Thanks!
MB
Re: A little help with MooSock
You have superglobals off - these are also bad, dont use them.
$filename = $_GET['filename'];
Place this before you open the file in order to put the GET request variable 'filename' into the php variable, $filename.
Also, thats terribly insecure - anyone can put any random filename in there (including directory traversal) in order to open and overwrite any file they wish.
Re: A little help with MooSock
You have superglobals off - these are also bad, dont use them.
$filename = $_GET['filename'];
Place this before you open the file in order to put the GET request variable 'filename' into the php variable, $filename.
Also, thats terribly insecure - anyone can put any random filename in there (including directory traversal) in order to open and overwrite any file they wish.
Re: A little help with MooSock
Thanks, Plasma! It works!
But now, it's the $datas variable that is not defined:
<b>Notice</b>: Undefined variable: datas in <b>E:\Web\localuser\Myname\tstphp\test.php&l t;/b> on line <b>15</b><br />
I believe I must place a similar line to put the variable datas into the php variable $datas. Can you tell me how?
About security: yes indeed, it is insecure. As soon as I see everything can work, I will take care of the security issue.
Re: A little help with MooSock
Thanks, Plasma! It works!
But now, it's the $datas variable that is not defined:
<b>Notice</b>: Undefined variable: datas in <b>E:\Web\localuser\Myname\tstphp\test.php&l t;/b> on line <b>15</b><br />
I believe I must place a similar line to put the variable datas into the php variable $datas. Can you tell me how?
About security: yes indeed, it is insecure. As soon as I see everything can work, I will take care of the security issue.
Re: A little help with MooSock
Ah! I used the same instruction $_GET with the datas variable and it works!
Thanks again, Plasma!
MB
Re: A little help with MooSock
Ah! I used the same instruction $_GET with the datas variable and it works!
Thanks again, Plasma!
MB