# FreeBSD-Updates - Webinterface



## Leander (Feb 25, 2014)

I wrote a webinterface to keep track of current FreeBSD-Updates and its correlating updating information. It requires

a working webserver such as Apache
PHP support in webserver
read/writeable /tmp/
Feel free to have a look. It might be useful 
Comments are welcome

http://sourceforge.net/projects/freebsd-updates/

Best regards
L


----------



## Carpetsmoker (Feb 26, 2014)

You can use gethostname() (or php_uname()), no need to call external binaries for that.

You also want to escape your shell commands, for example:


```
shell_exec("/usr/sbin/pkg info -d $pkg_name 2>&1");
```

Should really be:


```
shell_exec(sprintf("/usr/sbin/pkg info -d %s 2>&1",
    escapeshellarg($pkg_name)));
```

You also do this on a number of occasions:

```
shell_exec("cat $filename 2>&1")
```

Just use file_get_contents() or file() ... ?

PHP_EOL will always be \n on FreeBSD, only on Windows it's \r\n. I don't expect anyone to ever run this on Windows. (And even on Windows using PHP_EOL is a bad idea IMHO)

I also recommend against using full pathnames, such as /usr/sbin/pkg. Just use pkg and trust your PATH, or set the PATH if you don't trust it. This is really much more robust.


----------

