html in echo help

Discussion in 'PHP' started by mrpixel, Apr 14, 2010.

  1. #1
    Hello,
    Newbie here... i want to write a lot of html code into echo'' but something is going wrong, and i know there is a php function to write the exactly html code into echo, pls help

    THX
     
    mrpixel, Apr 14, 2010 IP
  2. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #2
    Use heredoc syntax
    
    <?php 
    $html = <<<HTML
    	<html>
    	<head>
    		<title>Test</title>
    	</head>
    	<body>
    		Test Apa Aja Dah
    	</body>
    	</html>	
    HTML;
    echo $html;
    ?>
    
    PHP:
     
    guardian999, Apr 14, 2010 IP
  3. mrpixel

    mrpixel Member

    Messages:
    433
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #3
    can't make it work... I want to encrypt a WP footer with gzinflate like here http://www.kavoir.com/2009/08/one-simple-way-to-encrypt-obfuscate-hide-or-protect-your-php-code.html. But in this line
    echo base64_encode(gzdeflate('echo "You can\'t find me!";'));
    PHP:
    i have to change what is between double quotes with this html content
    <hr />
    <div id="footer" role="contentinfo">
    	<p>
    		<span><?php bloginfo('name'); ?> - All rights reserved</span><br/>Design by <a href="#">Designer Link</a><br/>Sponsored by <a href="#">Link1</a> | <a href="#">Link2</a> | <a href="#">Link3</a>
    	</p>
    </div>
    </div>
    
    		<?php wp_footer(); ?>
    </body>
    </html>
    HTML:
    I think is messing up becouse the php lines in the html content
     
    mrpixel, Apr 14, 2010 IP
  4. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    
    <?php
    $code = <<<HTML
    <p>
        <span><?php bloginfo('name'); ?> - All rights reserved</span><br/>Design by <a href="#">Designer Link</a><br/>Sponsored by <a href="#">Link1</a> | <a href="#">Link2</a> | <a href="#">Link3</a>
    </p>
    HTML;
    
    echo base64_encode(gzdeflate('echo '.$code));
    ?>
    
    PHP:
     
    Last edited: Apr 14, 2010
    guardian999, Apr 14, 2010 IP
  5. mrpixel

    mrpixel Member

    Messages:
    433
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #5
    Hello,

    Still not working,

    This is my code

    <?php
    $code = <<<HTML
    <hr />
    <table width="200" border="1">
    <tr>
    <td align="left">cell 1</td>
    <td>cell 2</td>
    
    </tr>
    
    </table>
    HTML;
    
    echo base64_encode(gzdeflate('echo'.$code));
    ?>
    
    <?php eval(gzinflate(base64_decode('LY1LCsAgDET3hd4h5AJ+1upd/KRVCBWC0Ou31W6G4T2GoVy7qwIq7JsbMTHB3cqoHq3WCKlLIfFocHqZWSByOy+PTMfAkIkZjFOjLLuA/cGL1NzN8h2EBw== '))); ?>
    PHP:
     
    mrpixel, Apr 15, 2010 IP
  6. Kaimi

    Kaimi Peon

    Messages:
    60
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    
    <?php
    $code = <<<HTML
    <hr />
    <table width="200" border="1">
    <tr>
    <td align="left">cell 1</td>
    <td>cell 2</td>
    
    </tr>
    
    </table>
    HTML;
    
    echo base64_encode(gzdeflate("echo '$code';"));
    ?>
    
    <?php eval(gzinflate(base64_decode('LY07CoAwEER7wTss26TMpzXJXfJZTWAxEAJeX402w/Aew1AqDYQtHaRfFztCZIKr5lEcGqUQYuuZukON0/eZGQLX43TItA/0iZhBWznyZz9gfvAgOXezvAdebDc='))); 
    ?>
    
    PHP:
     
    Kaimi, Apr 15, 2010 IP
  7. amaroks

    amaroks Peon

    Messages:
    242
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Try :

    1.
    Put your html code in a file alone , call it html.php

    2.
    add this following code above your encryption code
    <?php
    function echohtml(){
    include('html.php');
    }

    function code(){

    $getcode = echohtml();

    $printout = stripslashes($getcode);

    echo $printout;
    }
    ?>

    Change This
    echo base64_encode(gzdeflate('echo'.$code));

    To This
    echo base64_encode(gzdeflate('code()'));



    Hope This Works
     
    amaroks, Apr 15, 2010 IP
  8. mrpixel

    mrpixel Member

    Messages:
    433
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #8
    Still not working :(
    I get this error
    Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\encoding\index.php(17) : eval()'d code on line 1
    Code (markup):
     
    mrpixel, Apr 17, 2010 IP
  9. amaroks

    amaroks Peon

    Messages:
    242
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    its a Syntax error , Look in Line (17) where there is '<' that is not needed ?
     
    amaroks, Apr 17, 2010 IP
  10. hiuf1

    hiuf1 Peon

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    its a syntax error
     
    hiuf1, Apr 17, 2010 IP
  11. mrpixel

    mrpixel Member

    Messages:
    433
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #11
    i can't find it :(
    <?php
    $code = <<<HTML
    <hr />
    <table width="200" border="1">
    <tr>
    <td align="left">cell 1</td>
    <td>cell 2</td>
    
    </tr>
    
    </table>
    HTML;
    
    echo base64_encode(gzdeflate('echo'.$code));
    ?>
    
    <?php eval(gzinflate(base64_decode('LY1LCsAgDET3hd4h5AJ+1upd/KRVCBWC0Ou31W6G4T2GoVy7qwIq7JsbMTHB3cqoHq3WCKlLIfFocHqZWSByOy+PTMfAkIkZjFOjLLuA/cGL1NzN8h2EBw== '))); ?>
    PHP:
    Maybe if you test the code you'll understand much better

    Thanks

    Regards
     
    mrpixel, Apr 17, 2010 IP
  12. amaroks

    amaroks Peon

    Messages:
    242
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I have No idea why would you do much work to encrypt a wordpress theme , try this codeproject.com/KB/security/PHPEncoder.aspx or google a free php encoder , will make it much easier for you
     
    amaroks, Apr 17, 2010 IP
  13. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #13
    You do know that decoding an encrypted footer/theme is a 30 second job? It isnt worth your time doing it.... Also, if your using eval() you seriously need to look at your coding practices
     
    lukeg32, Apr 17, 2010 IP
  14. Kaimi

    Kaimi Peon

    Messages:
    60
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #14
    You can decode every encryption type in 30 sec?
     
    Kaimi, Apr 17, 2010 IP
  15. amaroks

    amaroks Peon

    Messages:
    242
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    yeah its easy , try it :

    Find an encrypted theme ,
    openup the footer.php , where it starts <?php eval type 'start' before it and type 'end' at the very end , Now view site and view source , then find start and copy everything between start and end and place them instead of the encryption code :)
     
    amaroks, Apr 17, 2010 IP