We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,605 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

escape the outcome of an included PHP file

How does this work?

<?php
echo '<script type="text/javascript">
var str='.include("engine.php").';
var str_esc=escape(str);
document.write(str_esc)
</script>';
?>

What this script should do in my point of view outcome is to escape the whole page so the source page is not viewing the html and everything, rather then the escaped characters.

this won't work, i don't know why, can anyone help?

3
Contributors
3
Replies
1 Day
Discussion Span
1 Year Ago
Last Updated
4
Views
Voltimolt
Newbie Poster
16 posts since Jul 2011
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0

Perhaps if you explain what you are trying to achieve... Or show what's inside engine.php

pritaeas
Posting Prodigy
Moderator
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86

<?php echo '<script type="text/javascript">var str="';
include("engine.php");
echo '"; var str_esc=escape(str);document.write(str_esc);
</script>'; ?>

almostbob
Nearly a Senior Poster
3,279 posts since Jan 2009
Reputation Points: 585
Solved Threads: 397
Skill Endorsements: 7

OOPS::
ensure that the output of engine.php does not output any unescaped dquotes, which would terminate the variable str and cause errors

almostbob
Nearly a Senior Poster
3,279 posts since Jan 2009
Reputation Points: 585
Solved Threads: 397
Skill Endorsements: 7

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.2922 seconds using 2.68MB