Click to See Complete Forum and Search --> : permission denied


grahamg
03-12-2003, 11:11 AM
This is the error message.


Forbidden
You don't have permission to access /java script:void(0) on this server.


--------------------------------------------------------------------------------

Apache/1.3.20 Server at localhost Port 80


This is the code that I'm trying to execute.

echo "<a onClick=\"exec('calc.exe'); return false;\" href=\"java script:void(0)\">Launch Calculator</a>";

I get the usual activex warnings, I click on 'yes/ok', but then a popup windows tells me that 'command execution of calc.exe dissallowed by user'.

Steps that I've already taken.
1) modify the registry to show 'my computer' as a zone in the internet options/security tab.
2) modified the following zones to have low security and enabled all scripting accesses that I could find. (internet/Local intranet/my computer)


I've tried this on several machines all running win2ksp3 ie6.0sp1. Some machines this code works, and on some it doesn't/produces the above error messages.

I'm pulling out the little amount of hair that I have left.


BTW, this happens if I use vbscript, javascript, or php's exec();, I just picked out my lastest example of code.

Any thoughts?

grahamg
03-12-2003, 11:24 AM
Dope.

I forgot to add that if I create a blah.htm file and make it a part of my active desktop, it works every time on every machine.

To me the difference is that while on the active desktop, apache is not serving up the html file. But in a webpage apache is serving up the code.

I may be way off base here, but I'm thinking that it may be a permission thing with apache. Sooo, I've spent most of yesterday googling my problem, but to no avail. Oh sure there are several answers of chmod 777 on the dir or file/script in question. That doesn't help me much, but it did give me the idea of right-clicking on c:\, click on web-sharing, and click on everything that is avaiable including script execution. But to no avail. then it occured to me that it probablly related to the IIS I have installed not apache, which is what I am using.

Sigh...

grahamg
03-12-2003, 12:27 PM
I gues that I should add that I've tried various forms of exec() system(), etc as follows.

calc.php
<?
//exec('cmd bgrun.exe calc.bat ');
//exec("COMMAND.COM /C calc.exe >NUL");
//exec("mikehup calc.exe");
exec("calc.bat"); //worked for me.
//$cmd = "c:\\calc.bat";
//exec( $cmd );
//passthru("c:\command.com /c calc.bat" );
//exec("c:\\command.com /c calc.bat");
echo "testing.."; //shows that the script comes back.
?>

calc.bat
<
bgrun.exe calc.exe //bgrun is a file that I found along the vien of mikehup...it is supposed to clode stdout, etc, and pass control back to the php script without waiting for the command to finish.
>

turns out that this solution is SERVER-SIDE DOPE!. I needed a CLIENT-SIDE solution, well back to the drawing board.

Soo, I found this next,

calcii.php
<html>
<head>
<script language="JScript">
function ShellExJ(filename,arg,count)
{
var objShell = new ActiveXObject("Shell.Application");
objShell.ShellExecute(filename, arg, "", "open", count);
}
</script>
<script language="VBScript">
function fnShellExecuteVB()
dim objShell

set objShell = CreateObject("Shell.Application")

objShell.ShellExecute "notepad.exe", "", "", "open", 1

set objShell = nothing
end function
</script>
</head>

<body>
<a target="_self" href="javascript:ShellExJ('C:\\calc.exe');">Spider</a>
<a onClick=" ShellExJ('C:\\calc.exe'); return false;" href="javascript:;">Spider</a>
<a target="_self" href="vbscript:fnShellExecuteVB('C:\\calc.bat');">Spider</a>
</body>
</html>

This sometimes worked, but on some machines it gave a permission denied error as well., it's then that I stumbled my way to the example shown in the first post.

\hmm did I leave anything out?