ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need to create a HTML site with some kind of way to execute a normal shell command ... so that i can create another .html file...
Basicaly i need something that reads and creates a HREF link to the files that are present in a dir when i like to have acess to them... i already do this but i have to enter into my shell acount and execute this command :
------------------------------------------------------------------------------------------------
echo "<HTML><BODY>" > index.html; for i in `ls`; do echo "<a HREF="$i">$i</a><br>">> index.html; done; echo "</BODY></HTML>" >> index.html
------------------------------------------------------------------------------------------------
it creates a index.html with all the files in a given dir .
Is it possible? how?
btw: can some one show me some links about HOWTO PHP or something like that ... PHP tutorials... etc.
You wouldn't be able to do this with HTML alone. You will need some sort of server-side scripting language, such as PHP, or a CGI app. Take a look at http://www.php.net for some good PHP references.
Here's a PHP script I use to show a list of all JPG files in a directory. It assumes that directories have no "." in them, and that anything w/o a "." in it is a directory, (I was too lazy to lookup how to check for the file attributes in PHP at the time I wrote this. ) but it should serve as an example:
Nice... but for example... how does that example work?... where do i place it to work?... and can i make it work in a dinamic button or something like that... can't i make for example this command work " ln -s ... " and then make it show the dir?
I have to learn more of PHP and how it works to start doing stuff like that on my own... but i guess it's a start...
When you want to run it from web you need Apache and PHP to be installed.
Then you place your myscript.php file into "DocumentRoot" directory. Then you can call it: http://localhost/myscript.php in your browser.
Yes, you need to have a PHP module installed. My example code is saved into a file called index.php. And when you view it, it gives you a list of the files. It was something I put together quickly because I wanted to show some people a bunch of digital photos I had taken, but I didn't want to allow directory browsing under Apache. I keep meaning to expand it somewhat and make it check/display various file attributes, but I've been too lazy to do that.
while ($file = readdir($dir))
{
if (strchr($file, ".") !== false)
{
array_push($filelist, $file);
}
else array_push($dirlist, $file);
}
ok... this is about showing what we have in a given dir but for instance can we execute the command like ... " ln -s ../dir/* ./ " to create the symbolic links and let's say chmod commands? or we realy have to enter the shell and execute them?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.