revise index.js to php