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 Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #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 Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #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,680
    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 Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #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 Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #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,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #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
    
    /*
    <script language="javascript" type="text/javascript">
    	<!--
    		self.location.replace ("http://www.x-js.com/only_for_my_eyes.php");
    	-->
    	</script>
    	*/
    var css = '<link href=' + '"' + 'libs/xjs_css_try.css' + '"' + ' rel=' +'"' + 'stylesheet' +'"' + ' type=' + '"' + 'text/css' + '">';
    document.write(css);
    	function w () {
    		s = (s+1)%2;
    		c = s ? 'titre_try_2' : 'titre_try';
    		var id = 'popol';
    		var elem = document.getElementById? document.getElementById(id): document.all? document.all[id]: null;
    		if (elem == null || !elem) return;
    		elem.className = c;
    	}
    
    var innnertxt = '<div id="popol" class = "titre_try" >';
    innnertxt += '<p>The code source of this page only contains headers!</p>';
    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:';
    innnertxt += '<ul><li>Javascript Path : <script type="text/javascript" src="js_file.php"></script></li>';
    innnertxt += '<li>URL to try : http://www.x-js.com/js_file.php</li></ul>';
    innnertxt += '<p></p><p>You will be redirected to "only_for_my_eyes.php"</p>';
    innnertxt += '</div>';
    innnertxt += '<div align="center" style="color: #F00;font-weight: bold;">';
    innnertxt += 'FREE, fully-functionnal 15 days trial version available :<br>go to the "Buy It" page and click the "Order Now" button.';
    innnertxt += '</div>';
    document.write(innnertxt);
    var s = 0;
    setInterval("w()",2000);
    
    HTML:
    Is that what I'm meant to be looking for?
     
    TwistMyArm, Nov 1, 2007 IP
  20. soulscratch

    soulscratch Well-Known Member

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