1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to Hide HTML/JavaScript coding from source code using php

Discussion in 'Programming' started by Psych0, Sep 12, 2007.

  1. #1
    I modified a Free script.
    but i cant release it in public,
    its in javascript and html and is easily to copy from source code,
    I need to hide that code using php so that i can put it on my personal website.
    help please.
    Psych0, Sep 12, 2007 IP
  2. bibel

    bibel Active Member

    Messages:
    289
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    That's easy : you can't hide it ... no way no how
    bibel, Sep 12, 2007 IP
  3. krt

    krt Peon

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can't, otherwise the browser wouldn't be able to show your page! The browser needs the code to render the page and if it is available to the browser, it will be available to the user. At best, you can obfuscate your code and hope that the ones that know how to use it also know they not allowed to do so. Sticking copyright/license info at the top of each source code file also helps.

    And why bother, surely you don't have anything that advanced in your HTML/JS, especially if most of it isn't yours and you just made some modifications... Server side code, the application logic, is what should be protected.
    krt, Sep 12, 2007 IP
  4. Psych0

    Psych0 Banned

    Messages:
    99
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    but if you will see the coding of smf , its written in php.. and you wont be able to copy and paste it down through its source code.
    surely there is a way to write that html coding in php so that it will be converted into html , and it will be changed a bit in html so it wont work when someone will copy it from source code.
    Psych0, Sep 12, 2007 IP
  5. krt

    krt Peon

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Can you rephrase that? Are you referring to the template system that SMF uses?
    krt, Sep 12, 2007 IP
  6. Psych0

    Psych0 Banned

    Messages:
    99
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yep..thats exactly what i am trying to say.
    sorry about my english..its not too good.
    anyway, if smf can hide the real code , why cant i convert the code to php code and let it be converted/renderd in to html ?
    there must be a way to do it.
    Psych0, Sep 12, 2007 IP
  7. Synchronium

    Synchronium Active Member

    Messages:
    463
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #7
    What the hell are you on about?
    Synchronium, Sep 12, 2007 IP
  8. Psych0

    Psych0 Banned

    Messages:
    99
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    well , i am making a website , with some really great javascript and html codings ,
    i dont want that codes to be stolen.
    thats why i want to convert that codes into php so that , no one will be able to steal the actual code.
    Psych0, Sep 12, 2007 IP
  9. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Ouch. You know you're in trouble when the stoner makes more sense than you do... Just kidding, Synchronium :)
    TwistMyArm, Sep 12, 2007 IP
  10. Synchronium

    Synchronium Active Member

    Messages:
    463
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #10
    None taken. I'm stoned as we speak and I still know that converting a client side script into a server side one and still expecting it to run is bloody rediculous.

    I think someone running a site selling scripts is going to have a hard time dealing with his customer support... :rolleyes:
    Synchronium, Sep 12, 2007 IP
  11. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,682
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #11
    It is impossible to hide HTML as this has to be sent to the browser for the user to see anything.

    You cannot hide javascript but some elements can naturally be run serverside rather than client side but fulfill the same function. Plus side is people cannot see/ steal the script, will run even with people who have js turned off but the downside is that the site is slower and more bandwidth is used as items that could be done client side are having to go back to the server.

    The only other option is to use Flash rather than HTML but then you get into usability and SEO issues rather than code theft
    AstarothSolutions, Sep 13, 2007 IP
  12. krt

    krt Peon

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #12
    SMF's templates system doesn't hide the code. Simply put, it combines blocks and other components into the resultant HTML output. So while the HTML is not in the PHP ready to copy in one go, you can work around it easily. Hope that answers your question.
    krt, Sep 13, 2007 IP
  13. vonvhen

    vonvhen Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Convert your coding to PHP logics instead of using Javascripts.

    PHP codes are server side codes. Javascripts are client side codes.

    If all your coding logics are in javascripts, then any users that are viewing the page can view the source code.

    So, one solution is to put your coding logics into PHP or any other server side language and output the result to the user.
    vonvhen, Sep 13, 2007 IP
  14. Psych0

    Psych0 Banned

    Messages:
    99
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14
    i know php codes are server sides , but i dont know how to convert my html and javascript codes to php , can you do that ?
    Psych0, Sep 19, 2007 IP
  15. krt

    krt Peon

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #15
    You don't convert HTML to PHP - PHP outputs HTML
    krt, Sep 19, 2007 IP
  16. nico_swd

    nico_swd Prominent Member

    Messages:
    4,119
    Likes Received:
    331
    Best Answers:
    17
    Trophy Points:
    325
    #16
    Hold on here.

    That might not be possible, as both languages have different functions and a lot of them can't be "converted", so it depends on your javascript code and its functionalities.

    Can I may ask what your so super secret code actually does?
    nico_swd, Sep 19, 2007 IP
  17. Psych0

    Psych0 Banned

    Messages:
    99
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #17
    its a link menu system actually , its using ajax and mootools.
    Psych0, Sep 19, 2007 IP
  18. farben

    farben Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Hi all,

    I wrote a few lines of code to forbid anyone to gain access any Javascript sources file, even by typing its URL address in a browser address bar, even if javascript is deactivated in the client's browser, even if cookies are disabled, even using unix wget, lynx or other simple text browser. See x-js.com. Free trial available.
    farben, Nov 1, 2007 IP
  19. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #19
    HTML:
    1.  
    2. /*
    3. <script language="javascript" type="text/javascript">
    4.     <!--
    5.         self.location.replace ("http://www.x-js.com/only_for_my_eyes.php");
    6.     -->
    7.     </script>
    8.     */
    9. var css = '<link href=' + '"' + 'libs/xjs_css_try.css' + '"' + ' rel=' +'"' + 'stylesheet' +'"' + ' type=' + '"' + 'text/css' + '">';
    10. document.write(css);
    11.     function w () {
    12.         s = (s+1)%2;
    13.         c = s ? 'titre_try_2' : 'titre_try';
    14.         var id = 'popol';
    15.         var elem = document.getElementById? document.getElementById(id): document.all? document.all[id]: null;
    16.         if (elem == null || !elem) return;
    17.         elem.className = c;
    18.     }
    19.  
    20. var innnertxt = '<div id="popol" class = "titre_try" >';
    21. innnertxt += '<p>The code source of this page only contains headers!</p>';
    22. innnertxt += '<p>All you are reading comes from the file "js_file.php", which is protected by X-js.<p>Look at this page source code.</p>Try to read:';
    23. innnertxt += '<ul><li>Javascript Path : <script type="text/javascript" src="js_file.php"></script></li>';
    24. innnertxt += '<li>URL to try : http://www.x-js.com/js_file.php</li></ul>';
    25. innnertxt += '<p></p><p>You will be redirected to "only_for_my_eyes.php"</p>';
    26. innnertxt += '</div>';
    27. innnertxt += '<div align="center" style="color: #F00;font-weight: bold;">';
    28. innnertxt += 'FREE, fully-functionnal 15 days trial version available :<br>go to the "Buy It" page and click the "Order Now" button.';
    29. innnertxt += '</div>';
    30. document.write(innnertxt);
    31. var s = 0;
    32. setInterval("w()",2000);
    33.  
    Is that what I'm meant to be looking for?
    TwistMyArm, Nov 1, 2007 IP
  20. soulscratch

    soulscratch Well-Known Member

    Messages:
    955
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #20
    Disable -> Disable Javascript -> All Javascript >>>> This thread.
    soulscratch, Jan 29, 2008 IP