PHP 8.5.0 Beta 1 available for testing

Voting

: four minus two?
(Example: nine)

The Note You're Voting On

dj dot thd at hotmail dot com
9 years ago
Never ever use jurchiks101 at gmail dot com code!!! It contains command injection vulnerability!!!
If you want to do it that way, use something like this instead:

<?php
if (PHP_OS === 'Windows')
{
exec(sprintf("rd /s /q %s", escapeshellarg($path)));
}
else
{
exec(sprintf("rm -rf %s", escapeshellarg($path)));
}
?>

Note the escapeshellarg usage to escape any possible unwanted character, this avoids putting commands in $path variable so the possibility of someone "pwning" the server with this code

<< Back to user notes page

To Top