Protege
22-03-2008, 05:06 PM
I'm in the middle of completing a member system using, PHP, javascript and my trusty old friend MySQL as the database.
I've been trying to figure out the best way of hiding my javascript file from being viewed be viewed by the praying eyes of code stealer's...
I've taken into account that yes, some people who are clever enough can check their temporary folder for the JS file, but I want to make it a little bit harder for someone to exploit it via the way I'm hiding it, so any suggestions are most appreciated.
I've used this to hide it...
<?php // <--- Happy guys?
session_start();
header("Cache-Control: no-store, no-cache");
$_SESSION["reg"] = md5("true");
?> Thats on the main page where I want to include the javascript file, this is "javascript.php" below;
<?php
session_start();
if($_SESSION["reg"] == md5("true")) {
include_once("somejava.js");
} else {
echo("Please don't attempt to steal my javascript");
}
$_SESSION["reg"] = md5("false");
session_destroy();
?> including the javascript.php like this
<script src="javascript.php" type="text/javascript"></script>Live example http://members.driftpanzy.co.uk <<-- check the source out too :O! (http://members.driftpanzy.co.uk)
Feedback.
I've been trying to figure out the best way of hiding my javascript file from being viewed be viewed by the praying eyes of code stealer's...
I've taken into account that yes, some people who are clever enough can check their temporary folder for the JS file, but I want to make it a little bit harder for someone to exploit it via the way I'm hiding it, so any suggestions are most appreciated.
I've used this to hide it...
<?php // <--- Happy guys?
session_start();
header("Cache-Control: no-store, no-cache");
$_SESSION["reg"] = md5("true");
?> Thats on the main page where I want to include the javascript file, this is "javascript.php" below;
<?php
session_start();
if($_SESSION["reg"] == md5("true")) {
include_once("somejava.js");
} else {
echo("Please don't attempt to steal my javascript");
}
$_SESSION["reg"] = md5("false");
session_destroy();
?> including the javascript.php like this
<script src="javascript.php" type="text/javascript"></script>Live example http://members.driftpanzy.co.uk <<-- check the source out too :O! (http://members.driftpanzy.co.uk)
Feedback.