Updated PHP and javascript snippets