Modified mySQL.php and script.js

An earlier merge had broken the history functions and reverting wasn't
possible. This was essentially a manual revert.