HTML within PHP

C++, C#, Java, PHP, ect...
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: HTML within PHP

Post by hallsofvallhalla »

thats what I mean Jack. Use PHP to hide any unwanted source. No point in trying to hide HTML output because its being output but combine that with some JS file pointers and you will be able to hide much of your code.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: HTML within PHP

Post by Jackolantern »

What's the point if you are not using JS? A competent web designer does not even need the code to know what is going on with your page. All they can see is the design, and nothing about the inner-working of the game. You could make the HTML as readable or as unreadable as you can, but it can all be auto-formatted in a high-end web development IDE. I guess I could see there being some issues with the users seeing your field names for interception of the post data, but that is where conformity checking on the server-side comes in to make sure what you are expecting to receive is exactly what you receive. HTML just can't be obfuscated very well, and not to any usable degree that would be worth the effort.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: HTML within PHP

Post by hallsofvallhalla »

I have seen well designed HTML pages hide their code to keep their designs hidden. You are right about a plain ol' website but HTML is far more dynamic than you give it credit for. Some sites use HTML design tactics that I have been trying to get my hands on for quite a while.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: HTML within PHP

Post by Jackolantern »

But why would you want to have HTML do anything other than provide text/image content and CSS to style it? If it is openly viewable by your users, you would have to be out of your mind to add anything you don't want your users to know in it :D

And what PHP techniques are you referring to about hiding HTML? Unless I am missing some massive idea here, the browser can only react to each tag that it receives, and if it reacts to it, it is viewable in the view source page. How can you use PHP to hide HTML, but still have the browser register it? As far as I know (and I admit I don't know everything), if the PHP parser doesn't generate the HTML and send it to the user, its like it didn't do anything at all.
The indelible lord of tl;dr
User avatar
MAruz
Posts: 117
Joined: Fri Nov 20, 2009 12:31 pm

Re: HTML within PHP

Post by MAruz »

On a side note, if you don't want your users to see CSS and JavaScript, how do you go about doing that? Even if I use external files they are viewable from the "view source" by clicking on a link.

I've been trying to use PHP files as external CSS instead of the normal .css but it haven't worked that good yet.
PHP, Java, JavaScript, HTML, CSS, XML, MySQL / Oracle
Photoshop, Illustrator
www.cuddly-zombie.com
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: HTML within PHP

Post by hallsofvallhalla »

just make the javascript a include file, but it must be a include .js file type. Also you will have to define all your php-->JS variables in the main script.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: HTML within PHP

Post by Jackolantern »

hallsofvallhalla wrote:just make the javascript a include file, but it must be a include .js file type. Also you will have to define all your php-->JS variables in the main script.
Ahhh, so you are referring to using JS. I had just seen above where you said "Use PHP to hide your source", which makes no sense ;) However, I also now see that you did mention JS as well :P

For JS, it makes sense to not have your code readable, hence why obfuscators exist. However, I am still glad that JS can be viewable from a user perspective. JS can be made to do some rotten and annoying things, so for security purposes it is good that it can be seen. It can make game development with it somewhat of a pain, though.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: HTML within PHP

Post by hallsofvallhalla »

I am now lost on what you mean. You can hide Javascript as I showed above. You can only use PHP to hide certain things but you must re-write your code to have PHP parse it instead of standard HTML. I don't know I think we are both talking about different things :)
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: HTML within PHP

Post by Jackolantern »

I am honestly not very familiar with Javascript. I only know the basics with it, so I really don't know what you are talking about as far as hiding with it. I was only focusing on the "hiding source with PHP" part, which doesn't really make sense to me. If it has to do with a combination of PHP and JS, then it is just the JS side I am not familiar with. If it is just hiding HTML with PHP, then I am really lost on that, because that doesn't make sense to me with the way PHP works.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: HTML within PHP

Post by hallsofvallhalla »

eh oh well, but yeah with JS you can hide your code by putting it in side a .js file then including it. If you try to include it in another php file it won't hide it.
Post Reply

Return to “Coding”