note 27065 added to ref.exec
| From: | wusheng at swau dot edu dot cn | Date: | Thu, 21 Nov 2002 18:01:26 +0000 |
| Subject: | note 27065 added to ref.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39825@lists.php.net to get a copy of this message | ||
use exec() on win2k and IIS , want to execute WScript.exe to write register. It's strange, the
same parameter of exec( ) , can only be execute when refresh another page which contain the exec( )
code, and do nothing when in the pre page. so I create a new page and locate to it .
//---------------------------------------------
<?php
......
......
$cmd="'"."C:\\WINNT\\System32\\WScript.exe
C:\\Inetpub\\wwwroot\\ONE.VBS"."'";
//---- I feel using ' better than using " --//
$openfile=fopen("./REGWRITE.PHP","w+");
$filestr="<"."?php exec($cmd); ?".">";
echo $regstring;
$file_writed=fwrite($openfile,$filestr);
?>
<script>
location.href="REGWRITE.PHP"; //locate to the new page
</script>
//------------------------------------------------
if the code such as below , return no error but do nothing
//------------------------------------------------
<?php
......
......
$cmd="'"."C:\\WINNT\\System32\\WScript.exe
C:\\Inetpub\\wwwroot\\ONE.VBS"."'";
exec($cmd);
?>
--
http://www.php.net/manual/en/ref.exec.php
http://master.php.net/manage/user-notes.php?action=edit+27065
http://master.php.net/manage/user-notes.php?action=delete+27065
http://master.php.net/manage/user-notes.php?action=reject+27065