Skip to content

A simple way for you to use javascript from a PHP file without its function being easily seen in the page source code or in the inspector. There still remains a weakness in the Developer Tools because the Network tab shows the requested file and its result, but it makes it a little more difficult, as the information there is also coded.

License

Notifications You must be signed in to change notification settings

piroposantosdev/Javascript-PHP-HiddenFunctions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Javascript-PHP-HiddenFunctions

GitHub repo size GitHub language count GitHub forks Bitbucket open issues Bitbucket open pull requests

🚀 How to use Javascript-PHP-HiddenFunctions

This is a simple HTML + Javascript + PHP configuration to make your JS functions more hidden, in order to make it a little more difficult to access script folders, etc.
This script was created because many customers generally use simple hosting (Apache) on their domains, which often does not allow them to install a NodeJs or ReactJs server, so I developed this script to try to make access a little more difficult. to the website source.
Basically what this script does is convert the javascript function to a Base64 string and then return it as a response to an AJAX or XMLHttpRequest communication.
In this script too, on the backend side it forces checking whether the PHP file is being accessed via a direct URL or whether it is being requested by some script on the domain.
Another thing added is checking whether the HTTP_REFERER comes from the same server to avoid requests from outside the domain.

And the last information is that it is passing the javascript function that comes from PHP through Headers, more specifically

header('data:'. $jsCode);

and in the page's Javascript, just use

var content = xhr.getResponseHeader('data');
eval(eval(content));

If you have any question or suggestion, please submit 😀

🤝 Collaborators

Agradecemos às seguintes pessoas que contribuíram para este projeto:

Foto do Iuri Silva no GitHub
Decco Piropo

📝 License

This design is free to use.

⬆ Voltar ao topo

About

A simple way for you to use javascript from a PHP file without its function being easily seen in the page source code or in the inspector. There still remains a weakness in the Developer Tools because the Network tab shows the requested file and its result, but it makes it a little more difficult, as the information there is also coded.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published