CodeIgniter Forums
Adding PHP to HTML Code - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Adding PHP to HTML Code (/showthread.php?tid=50205)



Adding PHP to HTML Code - El Forum - 03-18-2012

[eluser]BigJoe[/eluser]
I was told and from what I can see in the video tutorials that CI all so requires php code to be added in the HTML Pages. I was and have been told that this is not a good idea to code in this way. If every one is telling me not to do this. Then why do all the video tutorials I have seen and what I been reading say it's Ok to do this. I have been told that it makes it easy for hackers to hack web sites by doing this. and there or maybe other reasons too.

Please post views and options.

Joe



Adding PHP to HTML Code - El Forum - 03-18-2012

[eluser]InsiteFX[/eluser]
Really! Put some php code in your html template and then do a view source and I'll bet you do not see any php code at all.

The thing is never never never trust user input!



Adding PHP to HTML Code - El Forum - 03-18-2012

[eluser]Zurtri[/eluser]
I concur that php in HTML is a relatively standard practice.

The danger comes when you trust user input. So always ensure you clean and escape the user input.

The input class does some of the heavy lifting for you: http://ellislab.com/codeigniter/user-guide/libraries/input.html