anujgarg Posted December 10, 2009 Share Posted December 10, 2009 Hello Everyone, I have a page that needs a javascript code to be written between PHP code but the condition is that javascript code should not be executed. How can I prevent javascript code to be executed? Please suggest... TIA Anuj Link to comment https://forums.phpfreaks.com/topic/184628-php-and-javascript/ Share on other sites More sharing options...
Adam Posted December 10, 2009 Share Posted December 10, 2009 You can place it within a function and just never call it. Link to comment https://forums.phpfreaks.com/topic/184628-php-and-javascript/#findComment-974678 Share on other sites More sharing options...
Mchl Posted December 10, 2009 Share Posted December 10, 2009 Or do not put it in <script> tags... What's the point of having JavaScript that's not going to be executed anyway? Link to comment https://forums.phpfreaks.com/topic/184628-php-and-javascript/#findComment-974681 Share on other sites More sharing options...
Adam Posted December 10, 2009 Share Posted December 10, 2009 I was thinking that but assumed he meant as the page loads.. Link to comment https://forums.phpfreaks.com/topic/184628-php-and-javascript/#findComment-974698 Share on other sites More sharing options...
anujgarg Posted December 10, 2009 Author Share Posted December 10, 2009 My question was related to avoid my site from SQL Injection. I have a textarea in my site and some hacker comes to the site and start writing javascript code into it, so I want to prevent my site to get affected from the effect of that JS code. Is it possible? Link to comment https://forums.phpfreaks.com/topic/184628-php-and-javascript/#findComment-974704 Share on other sites More sharing options...
Mchl Posted December 10, 2009 Share Posted December 10, 2009 That's more XSS than SQL injection. At least use strip_tags when saving to database. You can also implement some advanced filtering. Link to comment https://forums.phpfreaks.com/topic/184628-php-and-javascript/#findComment-974706 Share on other sites More sharing options...
anujgarg Posted December 10, 2009 Author Share Posted December 10, 2009 thanks for all replies... Link to comment https://forums.phpfreaks.com/topic/184628-php-and-javascript/#findComment-974728 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.