Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Perl code 1

Status
Not open for further replies.

hermes1

Programmer
Oct 22, 2003
38
US
I have a script in perl which is basically prints html code. Is there a way i can hide the the source so if someone tried to view the source they would see nothing. Thanks
 
Once the HTML page is rendered on a browser, there is really nothing you can do to prevent seeing the HTML source code. Your PERL code will never be seen as part of the source code - only the portion of the code that generates the HTML page.

There's always a better way. The fun is trying to find it!
 
You can try obfuscating it, ie using javascript to generate the page which (ie javascript) has been written by perl

But the HTML once written has to be visible on the client machine somewhere otherwise the page can't be rendered as tviman said

You could try a 1x1 pixel gif, and stretching it to fill the screen, so if they go view source (as a right click) it'll ask them to save picture, that's only going to annoy them, and make them malicious

HTH
--Paul
 
like previously mentioned, your perl code will not be seen, but the HTML that it generates will be seen.

IF you want to hide the HTML code:
while it is not possible to completly hide the HTML code,
there are deterrents, that make it difficult
One thing to do is (using JavaScript, I think) change the right-click menu so that one cannot view source by right-clicking....
 
the JS no-right click method is the worst to do to a left handed person. PHP has the ability to make the code invisible to the viewer, who doesn't know php, by displaying an alternate page as the view source page.
 
Yes i would not want to employ a javascript type method because i think it may make any person want what is hidden more and when they figure out to disable JS.... Hello. PHP sounds interesting i was thinking of switching the script over anyway.


I am very much a PHP newbie though and still need to write more involved scripts.
 
How is using PHP going to hide the HTML source? When I say view source, it opens the page that the browser rendered, plain and simple. You could nest frames and make it a pain, but if the browser can render it, the user can view it. Period.

Why on earth are you trying to hide HTML code?

----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
That looks good i'll play around with that in a few minutes.

BTW the reason i want to hide the code is because i came up with a unique idea and i really don't want people just copying my work which is so easy.


 
That's a great resource, Chris, thanks. :)

----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
Why do you not want people to copy you? Just about everything you have learned in your HTML/CGI development has probably been from copying others.

Heck, your even here copying us in your quest, I guess that makes us dummies.

You'd also be suprised at how many 'unique' ideas are really not so unique...
 
I mean i am all for providing code but and i have given out code to people at other boards. But it is like tThis there are some things you don't want people to copy off you. Like if someone imitates how act or buys a similiar outfit you bought that may be kind of flattering, but you wouldn't want them to copy your bank PIN # or Credit Card Info. Someone asking for help (and getting it :)) is not "copying" at all.
 
hermes1...

Yes, there are ways to make it difficult for some to see your HTML code but there is NO WAY to prevent it for those who want to see it. There's been hundreds, if not thousands, of posts here and on other forums that back this up. The key to this is that in order to render your page on a browser, it has to see the html code, which means that the source, no matter how hard you try, will be available to the user. Additionally, images on a web page are AUTOMATICALLY saved in the browsers cache directory and will, for a period of time, reside on the users machine.

It boils down to this... with the exception of password protected sites, the 'net is like a giant billboard. What's on it is there for all to see. If you don't want others to see your stuff - don't put it on the billboard!

There's always a better way. The fun is trying to find it!
 
There is no real way to keep your http clients from seeing the html output of your CGI, but, you should not let users (http clients) see your cgi code. That is a HUGE security no-no if you are doing anything with the OS in your code. It is an invitation to get hacked. Most web servers, when set up correctly, will not let users/clients see the text contents of files in the cgi-bin branch of the directory tree for that reason.

'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top