How to make a web-based interface for user configuration program?
Dear friends...
I currently doing a network emulator program and the features must includes the web-based interface for user configuration. I able to run my program through command line. But I would like to ask how to associate my program to web-based interface for user configuration? Please kindly advise me for any example or website. Your responses are highly appreciate. Thanks:) |
The simplest way would be to have your site execute the command lines which configure the system via CGI.
Basically, you would have a webserver set up on the machine which contains your software. This webserver will serve a page containing a form which has the configuration details (buttons, text boxes, check boxes) When you click [SUBMIT] the contents of the form are POSTed to a CGI script when then parses out what needs to be done and exec()s the relevant commands to make it happen, or writes config files, or whatever. |
Quote:
|
Quote:
i had set up the apache webserver on my current ubuntu 9.10 machine. For the CGI script, isn't i have to convert my c programming into CGI script in order to execute the program? Thanks.. |
No, CGI is Common Gateway Interface, just an agreed way to call programs from a webserver; you can use any language.
http://en.wikipedia.org/wiki/Common_Gateway_Interface |
How to load module and iptables rules through cgi scirpts?
Quote:
|
How to set iptables rules and access superuser(root privilege ) in web page?
Quote:
i had wrote a network emulator program in c programming. It can run for ubuntu terminal with good performance. But i have to make it for web-based user configuration. So i had setup apache web server and write this program in cgi script and try to execute this program from web page. BUT IT CAN'T WORKS!!! This program must be run in root privilege($sudo -s) and add the iptables rules such as (#iptables -A OUTPUT -j QUEUE). So my question is how to add iptables rules in my cgi scripts? How to set the superuser(root privilege) permission to access my program through web server? Or any other method? your reply is highly appreciate... thanks.. |
The program will run as the Apache user, so you'll need to edit the sudoers file to give that user the reqd privileges.
Note that apache starts up as a root user so it can bind to port 80 (& 443), then drops privileges. |
Quote:
|
All times are GMT -5. The time now is 08:08 PM. |