js file modified by php, receives parameter

#Modification:
1. JS file is now a php file, which receives JSON string of patterns for
url, to which token need to be attached.
2. Bug in setCookie() fixed
convert js to php to receive url rules from library