I get this error message while running the code below:
Warning: shell_exec(): Cannot execute using backquotes in Safe Mode in /usr/local/httpdocs/servers.php on line 8
function ping($link) {
$link = preg_replace('![url]http://www.[/url]!','',$link);
$link = eregi_replace('unreal://','',$link);
$link = preg_replace('/:.*/','',$link);
$cmd = `ping -c1 -w1 $link`;
if (preg_match('!time=(.+) ms!', $cmd, $m)) {
print "<font color='lime'><strong>UP</strong></font> (".round($m[1]) . "ms)";
} else {
print "<font color='red'><strong>DOWN</strong></font>";
}
}
I wrote that function a while ago and it worked perfectly fine until we moved servers.
How can I adjust the code to work now?
And using exec("ping"); as the $cmd variable doesn't work either.