Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I want to create a web page where you can upload your c++ code and compile it. How I can do this? For example http://codepad.org/[^]
Posted
Comments
OriginalGriff 26-Oct-10 7:04am    
"But I can to accept code only with uploading it in .cpp files and analyze it before executing and removing code that delete files. I want to create it for my University, to check if problem is correct or not. How to install compiler on server? And how to make him execute one .cpp file?"
Firstly, don't post that as an answer - the only person who gets told is you. If you post it as a comment to my answer (like this one) then I get an email to say you need more help.
Secondly, it's not just delete files. registry, file content changes, create, move, copy and send to some other computer, etc., etc., etc. There is a HUGE range of potentially malicious stuff that a user could do, either deliberately, or accidentally. Do you University computer administrators know you are trying to open thier entire network up to the whole world? Because I don't think they will be at all pleased! (To put it mildly and politely!)
Try to think of another way: install the MS Visual Studio C++ Express on the PCs - it's free and removes the massive security threat you seem determined to introduce...

1 solution

Extremely carefully.
Think about it: You have to run the compiler on the web server (since you can't be sure it exists on the client). Then you have to execute it on the server (since you can't execute on the client - that is what virus scanners and firewalls are there for).

Do you really want anyone in the world running any code they like on your webserver? Because (and you can trust me on this) I don't.

Suppose one code line is the equivalent of:
File.Remove("c:\\*.*");
 
Share this answer
 
Comments
OriginalGriff 26-Oct-10 6:59am    
"But I can to accept code only with uploading it in .cpp files and analyze it before executing and removing code that delete files. I want to create it for my University, to check if problem is correct or not. How to install compiler on server? And how to make him execute one .cpp file?" - leninvlad

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900