translation from javascript to php for algorithm upload