NVU the WYSIWYG HTML for linux

Teodor Iliescu tiliescu-ZdyLq7YhDA8hunQcOVOuvCwD8/FfD2ys at public.gmane.org
Thu Oct 30 19:57:04 UTC 2003


On Thu, 30 Oct 2003, JoeHill wrote:

> On Thu, 30 Oct 2003 10:53:50 -0500
> Matthew Godycki <mcg2-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org> uttered:
> 
> > Really easy to do includes with PHP.
> 
> So easy even I can do it. That's how I get the uptime display at the
> bottom of the main page.
> 
> It's as simple as this:
> 
> <?php include "uptime.txt"; ?>
> 
> with a cron job that writes to the text file.
> 
> PHP is definitely the easiest way to go for dynamic content.

Getting a cronjob to update the text file does the job, although it is so
inefficient. Think about it, you are running the cronjob every 5 minutes
or so, and you are causing I/O. Plus, the reading is not necessarily
accurate, if it is outdated by 5 minutes.

A safe, and secure way of doing this (in Perl), as I was thought in
school, is to just use the back ticks to invoke a command, such as:

print `uptime`;

Now, you should additionally invoke Perl, with the -T (tainted option),
which basically means you have to explicitly say where Perl should run
each program from. So the above would turn into:

print `/usr/bin/uptime`;

Additionally, you should empty your PATH variable, before invoking
commands, otherwise it chokes.

This will get rid of the cron jobs, get rid of the static text file, and
it will have a live reading of your's system's uptime status.


Links:

Looks like Php does it the same way:
http://www.phpfreaks.com/articles/45/0.php

Check tainting in PERL FAQ:
http://gunther.web66.com/FAQS/taintmode.html

-Teodor I.





--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list