Page 1 of 1
Encrypting an Html
Posted: Sun Jul 17, 2005 8:07 pm
by FTJoe
I don't want to go too technical but I came up with a simple idea that will keep people away for a while. Can someone show me how to make a php code that will make all of the html addresses in any html/php documents in the ftp folder flip around, so the html address is backward. I know that will be easy, but how would I make it so it also recognizes it and automaticaly flips it around to read it..
Posted: Sun Jul 17, 2005 9:03 pm
by Ambush Commander
Can someone show me how to make a php code that will make all of the html addresses in any html/php documents in the ftp folder flip around, so the html address is backward.
strrev() flips around text, but there's several problems in implementing this:
http:// is a protocol. You can't take "
http://www.google.com/" and flip it around to "/moc.elgoog.www//:ptth" and expect the server to even get the request.
Therefore, you'd probably have to flip around just the folder variables and leave the domain name alone. But I have a better idea:
Why don't you have Apache force a user to authenticate itself before it serves any requests? If you're trying to "keep people away". Or you could swamp your site with annoying ads and popups. That would keep people away too. </sarcasm>
Posted: Sun Jul 17, 2005 10:10 pm
by FTJoe
erm..no, I'm just trying to keep them from downloading things by getting the link from source codes.
Posted: Sun Jul 17, 2005 10:14 pm
by Ambush Commander
Then what's the point of putting up the thing in the first place?
Posted: Sun Jul 17, 2005 10:24 pm
by FTJoe
Ambush Commander wrote:Then what's the point of putting up the thing in the first place?
....so it will screw up the adresses and they won't find it as easily.
Posted: Sun Jul 17, 2005 10:31 pm
by Ambush Commander
If you're trying to make it hard for them to find (but not impossible), and you've got lots of free time on your hands:
1. Devise a puzzle program they have to solve before they can download the file.
2. Swamp the site in ads, making them click through lots of things and vote for you in site polls and stuff, and then finally get to the end where the file is there but mispelled.
Posted: Sun Jul 17, 2005 10:38 pm
by FTJoe
*sigh* we can't go and change the urls so they link to those kind of things, there are already over 1000 urls..
Posted: Sun Jul 17, 2005 10:42 pm
by FTJoe
ok, anyways, first of all how do I tell it to flip around things that start with www. and end with /
Posted: Sun Jul 17, 2005 10:47 pm
by Ambush Commander
If they're in HTML files, that's impossible without editing the HTML file into a PHP file (two ways, rename it PHP or have Apache parse HTML files under PHP). Then, I'd suggest at the beginning of the document do output buffering. Then, using a regexp, find the locations of all the URLs in the document. Then, with the locations, decompose the URLs, keep the
http://www.domain.com/ and then reverse everything after that.
BUT IT DOESN'T WORK! If you have Apache reverse the URL obfuscation via mod_rewrite or something, they can still use the URLs! Nothing changes!
I'm still not sure what you want to do. Perhaps it would be time better spent making a PHP script that slurps up all of the links to downloads (and associated metadata), put it into a database, and then have all links generated dynamically?
Posted: Mon Jul 18, 2005 3:17 am
by onion2k
http://scriptasylum.com/tutorials/encde ... ecode.html
It'd be quite simply to write a PHP script to encode the existing HTML and then wrap it in a page that decodes it on the client side.
But if anyone has JavaScript switched off they'd not be able to view the page.
Posted: Mon Jul 18, 2005 10:49 am
by FTJoe
onion2k I like this link, but could I make a php file like this that would automaticaly go through the files and encrypt them?
Posted: Mon Jul 18, 2005 11:11 am
by onion2k
Of course you could.
Posted: Mon Jul 18, 2005 12:04 pm
by FTJoe
Is that being sarcastic because I'm stupid, or are you serious?
Posted: Mon Jul 18, 2005 12:33 pm
by onion2k
FTJoe wrote:Is that being sarcastic because I'm stupid, or are you serious?
No, I'm completely serious.
Roughly speaking, the script would go something like:
Code: Select all
$dir = opendir("./directoryOfHTMLFiles/");
while ($file = readdir($dir)) {
if ($file != "." and $file != "..") {
//Open the file
//Strip out the header HTML and <body> tag
//Encode the data
//Add the JavaScript encoding stuff
//Save the file
}
}
Posted: Mon Jul 18, 2005 12:37 pm
by FTJoe
hmm...cool..but I just encountered a problem..it ends up he is just storing movie files in a folder, and an html page automaticaly displays the numbers for the movies, etc. So, he did not write the movie links in the browser, so even if I did encrypt it the link would still apear how it is..