February 18th, 2003, 05:28 PM
Deny web access to PHP WML files
Could someone please tell me how to deny a PC user access to WML files that are written in PHP with a .php extension?
Eg, if someone using a PC accesses the WML website, it prompts the user to download the .php file - I would rather they were not able to download the coding.
I assume it is related to setting up mime types or identifying the browser and redirecting it to a proper HTML page.
Any suggestions would be greatly appreciated.
February 25th, 2003, 11:55 AM
July 14th, 2003, 10:32 AM
Did you ever get a workaround for this ? I have a similar problem.
I have a WML file I want to access from both a WAP and regular PC browser. The file has a .php extension with the WML headers set at the top. I can access the the script from a WAP phone fine and also from the PC, except that I get the messagebox stating the the file format is unknown. The script does what it's supposed to - its just that I get this ugly message. I want to be able to run the script as a cron job as well as a manual job from both PC and WAP. Therefore I need to be able to determine what type of device is accessing the page and then do something appropriate. Unfortunatly, as far as I know you cannot do any processing before setting the header info.
Any ideas (apart from having to seperate scripts) ?
July 14th, 2003, 02:24 PM
I got this from Evil Walrus, I haven't tried it yet though (essentially, just stick it at the top of your page before html is outputted. I am sure this is apaptable if you are using a template system or the likes):
$mobilephone = preg_match("!Nokia|KDDI|SHARP|portalmmm|UP.Browser|Wapagsim|DoCoMo|Alcatel|ATTWS|Doris|Hutc3G|J-PHONE|Java|KGT|LGE|MOT|ReqwirelessWeb|SAGEM|SIE-|SonyEricsson|Teleport Pro|UPG1!", $HTTP_USER_AGENT);
//parts of some different user_agent strings are between the |'s.
//If a cellphone is detected you see this page.
//If a computer is detected you see this page.
>_ My Music Blog | Losing weight @notsoheavyblog | My Tweets
Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.