Username: Posted November 30, 2010 Share Posted November 30, 2010 >subject. Why does it do this and how can I fix it? Example: I write <?php echo"hello world!"; ?> other stuff/html here After I submit I see this: <?php echo"hello world!"; ?> other stuff/html here 1 I'm using Geshi w/ highlight_string This also happens if I use htmlspecialchars + highlight_string Quote Link to comment https://forums.phpfreaks.com/topic/220215-highlight_string-adds-a-1-to-the-end-of-everything/ Share on other sites More sharing options...
Username: Posted November 30, 2010 Author Share Posted November 30, 2010 Guess I should've posted this before.. <?php define('ROOT', '../'); include ROOT.'common/common.php'; include ROOT.'common/header.php'; include('geshi/geshi.php'); print("<fieldset class='menu main'>"); $paste = $_GET['paste']; $myFile = "pastes/$paste"; $fh = fopen($myFile, 'r'); $banip = fread($fh, filesize($myFile)); $source = highlight_string($banip); $language = 'php'; $path = 'geshi/'; $geshi = new GeSHi($source, $language, $path); echo $geshi->parse_code(); print("<br /><hr><center><a href='index.php'>Index</a></center>"); include ROOT.'common/footer.php'; exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/220215-highlight_string-adds-a-1-to-the-end-of-everything/#findComment-1141278 Share on other sites More sharing options...
trq Posted November 30, 2010 Share Posted November 30, 2010 Ive not used Geshi in a long while but according to the docs, parse_code returns void. I wouldn't echo it, I'm fairly certain its going to print the code itself. Quote Link to comment https://forums.phpfreaks.com/topic/220215-highlight_string-adds-a-1-to-the-end-of-everything/#findComment-1141280 Share on other sites More sharing options...
Username: Posted November 30, 2010 Author Share Posted November 30, 2010 Ive not used Geshi in a long while but according to the docs, parse_code returns void. I wouldn't echo it, I'm fairly certain its going to print the code itself. I don't quite understand what you mean. Quote Link to comment https://forums.phpfreaks.com/topic/220215-highlight_string-adds-a-1-to-the-end-of-everything/#findComment-1141288 Share on other sites More sharing options...
trq Posted November 30, 2010 Share Posted November 30, 2010 Instead of... echo $geshi->parse_code(); Try... $geshi->parse_code(); Quote Link to comment https://forums.phpfreaks.com/topic/220215-highlight_string-adds-a-1-to-the-end-of-everything/#findComment-1141303 Share on other sites More sharing options...
Username: Posted November 30, 2010 Author Share Posted November 30, 2010 Instead of... echo $geshi->parse_code(); Try... $geshi->parse_code(); That fixed it! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/220215-highlight_string-adds-a-1-to-the-end-of-everything/#findComment-1141342 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.