i think your problem may be here:
echo "<img src=\"/$pics[$random]\" border=\"0\">";
should be:
echo "<img src=\"/{$pics[$random]}\" border=\"0\">";
when you call a variable in a string, php stops when it find a valid variable, so it would stop at $pics and not see that you are calling an element within that array, so you must surround the variable in brackets so that php knows what you are talking about. Or, my personal fav: don't put variables inside of strings, its dirty! do this:
echo "<img src=\"/". $pics[$random] . "\" border=\"0\">";