Click to See Complete Forum and Search --> : Access php script from applet ONLY


alexxz4
06-10-2010, 11:46 AM
Hi,
I'm going to have an applet that is hosted on remote server (call it http://server.com/appletpage.html) which is going to access a php script on the same server (http://server.com/script.php). Is it possible to make it so that only the applet has access to the PHP script, and calling the script from a browser or an external program wouldnt work? If so how would I go about it. I just want to protect the script from external invocation. Is there an alternative to what Im trying to do?

Alex

criterion9
06-10-2010, 11:52 AM
You can use a token when accessing the php script from the applet though a clever user could sniff the packets and replicate it. Maybe this is a band-aid to a different problem though. What does the php script do that you would only want the applet to have access to?

alexxz4
06-10-2010, 12:45 PM
it is a tile-based game and actually I have about 20 scripts. Some of those scripts retrieve game data, others save it. I also was thinking about passing a code as one of the parameters.
Ok, thanx.

criterion9
06-10-2010, 01:19 PM
Your best bet is to use some sort of authentication (just like regular user management) and then pass a session id with each request. This way your applet "logs in" and then can use the different files easily without re-authenticating. This would also help to hide a little better the method used to prevent outside use of the scripts plus it would set you up for opening up an API for third-party development should you desire.