K
Kevin Spencer
Hi Mike,
I don't either, any more. Again, congratulations!
--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
I don't either, any more. Again, congratulations!
--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
technique and I do not get the nosource.asp file in my tempMD Websunlimited said:Kevin,
I didn't fully read your message in my post, sorry. So I tried your
files.
--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 Released Special Pricing
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
Hi Mike,
Sorry about publishing your other JavaScript. I don't think you'll mind if I
publish this one:
document.write('<table border="1" width="100%" id="table1">');
document.write('<tr>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td> </td>');
document.write('<td>');
document.write('<p align="center">This pages source HTML is protected from
viewing</td>');
document.write('<td> </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('<td> </td>');
document.write('</tr>');
document.write('</table>');
document.write('<p align="center">');
document.write('<img border="0" src="images/cab_bus_columns1.gif" width="56"
height="56"></p>');
document.write('');
In case anyone is interested, here's how I did it: I cleaned out my
Temporary Internet Files folder to make it easier to find stuff. Then I
opened your page. After that, I opened Notepad, browsed my temporary Intenet
files folder, and dragged "nosource.asp" to the NotePad instance. Voila!
Interestingly, if I requested "nosource.asp" in the browser, I got a message
stating that it was protected, and in Temporary Internet files, there were
TWO "nosource.asp" files, one containing the message, and the other with the
code. How you did that, Mike, I don't know. But I DO know how to view your
source code! ;-)
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
consumerMD Websunlimited said:Here is your protected source page:
http://www.websunlimited.com/samples/no_source_view.htm
--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 Released Special Pricing
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
You bet!
--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 Released Special Pricing
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
Challenge me, Mike! ;-)
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
Kevin, Murry,
Oops, I was in a hurry to set it up. Let me see what I did wrong.
Like I said it can be time consuming.
--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 Released Special Pricing
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
Hi Mike,
Is this the protected script?
[formcalc.asp]
var token = ''; // holds the token found
var prog = '';
var progIndex = 0;
var oForm;
var places = 2;
var prepend = 0;
var DELIMITER = 1;
var VARIABLE = 2;
var NUMBER = 3;
var TOKEN_SIZE = 32;
var TRUE = -1;
var FALSE = 0;
function Expression(theForm,theExpression,Places,Prepend) {
places = Places;
prepend = Prepend;
progIndex = 0;
prog = theExpression;
oForm = theForm;
get_token();
if(!token) {
serror(2);
}
Level1();
}
// process an assignment statement
function Level1()
{
var slot;
var ttok_type;
var temp_token;
var result = 0.0;
if(tok_type == VARIABLE) {
// save old token
temp_token = token;
ttok_type = tok_type;
if(typeof oForm[token] != "undefined" ) {
slot = oForm[token];
} else {
serror(3);
}
get_token();
if(token != '=') {
putback();
token = temp_token;
tok_type = ttok_type;
} else {
get_token();
result = Level2();
slot.value = round(result,places);
return;
}
}
result = Level2();
return result;
}
function Level2()
{
var op = '';
var hold = 0;
var result = 0;
result = Level3();
while((op = token) == '+' || op == '-') {
get_token();
hold = Level3();
result = arith(op,result, hold);
}
return result;
}
// multiply or divide two terms
function Level3()
{
var op = '';
var hold = 0;
var result = 0.0;
result = Level4();
while((op = token) == '*' || op == '/') {
get_token();
hold = Level4();
result = arith(op,result, hold);
}
return result;
}
// process integer expoent
function Level4()
{
var hold = 0;
var result = 0;
result = Level5();
if((token) == '^') {
get_token();
hold = Level4();
result = arith('^',result, hold);
}
return result;
}
// unary + or -
function Level5()
{
var op = '';
var result = 0.0;
op = 0;
if((tok_type==DELIMITER) && token == '+' || token == '-') {
op = token;
get_token();
}
result = Level6();
if(op)
result = unary(op,result);
return result;
}
// process parenthesized expression
function Level6()
{
var result = 0.0;
if((token == '(') && (tok_type == DELIMITER)) {
get_token();
result = Level1();
if(token != ')')
serror(1);
get_token();
} else
result = primitive();
return result
}
function primitive()
{
var slot = 0;
var result = 0.0;
var sValue = '';
var i = 0;
switch(tok_type) {
case VARIABLE :
if(typeof oForm[token] == "undefined")
result = 0.0;
else {
switch (oForm[token].tagName) {
case 'INPUT' :
sValue = oForm[token].value;
while(sValue.charAt(i) == ' ') ++i;
if(sValue.charAt(i) == '$') ++i;
sValue = sValue.substr(i,sValue.length-i);
if (!isNumber(sValue)) serror(4);
result = parseFloat(sValue);
if (isNaN(result)) result = 0;
break;
case 'SELECT' :
sValue = oForm[token].options[oForm[token].selectedIndex].value;
while(sValue.charAt(i) == ' ') ++i;
if(sValue.charAt(i) == '$') ++i;
sValue = sValue.substr(i,sValue.length-i);
if (!isNumber(sValue)) serror(0);
result = parseFloat(sValue);
if (isNaN(result)) result = 0;
break;
default:
if( oForm[token].length > 0 ) {
for(i=0; i < oForm[token].length; i++) {
if(oForm[token].checked) {
sValue = oForm[token].value;
while(sValue.charAt(i) == ' ') ++i;
if(sValue.charAt(i) == '$') ++i;
sValue = sValue.substr(i,sValue.length-i);
if (!isNumber(sValue)) serror(4);
isNaN(parseFloat(sValue)) ? result += 0 : result +=
parseFloat(sValue);
var sType = oForm[token].type.toLowerCase();
sType = sType.toLowerCase();
if (sType == 'radio') break;
}
}
}
break;
}
}
get_token();
return result;
case NUMBER:
result = parseFloat(token);
get_token();
return result;
default:
return result;
}
}
// do the math functions
function arith(o,r,h)
{
var t = 0.0;
var ex = 0.0;
switch(o) {
case '-':
r = r - h;
break;
case '+':
r = r + h;
break;
case '*':
r = r * h;
break;
case '/':
r = r / h;
break;
case '%':
t = ((r) / (h));
r = r - (t*(h));
break;
case '^':
ex = r;
if(h==0) {
r = 1.0;
break;
}
for(t=h-1; t>0; --t) r = (r) * ex; // brute force
break;
}
return r;
}
function unary(o, r)
{
if(o=='-') r = -(r);
return r;
}
// return a token to its resting place
function putback()
{
var t = '';
t = token;
for(;t;t++) progIndex--;
}
// find the value of a variable
function find_var(s)
{
var temp = '';
temp = oForm.s.value // if not defined then zero
if( temp == '' ) {
return(0.0);
}
return parseFloat(temp);
}
function serror(error)
{
var e = new Array;
e[0] = "Syntax error";
e[1] = "Unbalanced parentheses";
e[2] = "no expression present";
e[3] = "Form field does not exist " + token;
e[4] = "Not a number"
alert(e[error] + ' - ' + token);
}
function get_token()
{
var temp = '';
tok_type = 0;
while(prog.charAt(progIndex) == ' ') ++progIndex; // skip spaces
if(is_in(prog.charAt(progIndex), "+-*/%^=()")) {
tok_type = DELIMITER;
temp += prog.charAt(progIndex++);
} else if(isAlpha(prog.charAt(progIndex)) || prog.charAt(progIndex) ==
'$')
{
while(!isdelim(prog.charAt(progIndex))) temp +=
prog.charAt(progIndex++);
tok_type = VARIABLE;
} else if (isDigit(prog.charAt(progIndex)) || prog.charAt(progIndex) ==
'.') {
while(!isdelim(prog.charAt(progIndex)))
temp += prog.charAt(progIndex++);
tok_type = NUMBER;
}
//--temp;
//while(isspace(temp)) --temp ;
token = temp;
}
// test for delimiter
function isdelim(c)
{
if(is_in(c, "+-/*%^=() ") || c=='\t' || c=='\r')
return 1;
return 0;
}
//test for alpha
function isAlpha(c) {
var sAlpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if (is_in(c,sAlpha)) return 1; else return 0;
}
function isDigit(c) {
var Digits = '0123456789';
if (is_in(c,Digits)) return 1; else return 0;
}
function isNumber(s) {
var dec = 0;
var i = 0;
if(s.charAt(i) == '-' || s.charAt(i) == '+') ++i;
for(i; i<s.length; i++) {
if(!isDigit(s.charAt(i))) {
if (s.charAt(i) != '.' || dec )
return 0;
else
++dec;
}
}
return 1;
}
function is_in(ch,s)
{
if(s.indexOf(ch) > -1) return 1; else return 0;
}
function round(number,places) {
number = Math.round(number*Math.pow(10,places))/Math.pow(10,places);
number += '';
var x = number.lastIndexOf('.');
if (x == -1 && places > 0) { number += '.'; x = number.length -1; }
for ( i = ((number.length-1) - x); i < places; i++) number += '0';
return prepend ? '$' + number : number;
}
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
I disagree you can protect your source from the average
thatwords,does
not require a browser plugin or dongle.
On the following page the implementation script for Form Calculator is
protected. The same can be done to protect the HTML of the web page.
http://www.websunlimited.com/order/Product/FormCalc/formcalc.htm
--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 Released Special Pricing
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
It is possible to protect HTML but very very time consuming.
The only way I know of is to require the visitor to download and
install a
browser plugin, or to use a hardware dongle. In other
there isno
practical way to do it, at least not in our use space.
--
Murray
ASP scripting is automatically protected.
It is possible to protect HTML but very very time consuming.
--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 Released Special Pricing
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
How do I protect my source codes? ASP as well as HTML?