Re: Source Code Protection
From: MD Websunlimited (none_at_none.com)
Date: 08/26/04
- Next message: Murray: "Re: Source Code Protection"
- Previous message: Steve Easton: "Re: Publishing"
- In reply to: Kevin Spencer: "Re: Source Code Protection"
- Next in thread: Murray: "Re: Source Code Protection"
- Reply: Murray: "Re: Source Code Protection"
- Reply: MD Websunlimited: "Re: Source Code Protection"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 26 Aug 2004 12:07:43 -0500
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 "Kevin Spencer" <kspencer@takempis.com> wrote in message news:eGgeD24iEHA.2660@TK2MSFTNGP15.phx.gbl... > Challenge me, Mike! ;-) > > -- > HTH, > Kevin Spencer > .Net Developer > Microsoft MVP > Big things are made up > of lots of little things. > > "MD Websunlimited" <none@none.com> wrote in message > news:#wF7uu4iEHA.2340@TK2MSFTNGP11.phx.gbl... > > 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 > > > > "Kevin Spencer" <kspencer@takempis.com> wrote in message > news:%23DNiqU4iEHA.2412@TK2MSFTNGP15.phx.gbl... > > > 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][i].checked) { > > > sValue = oForm[token][i].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][i].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. > > > > > > "MD Websunlimited" <none@none.com> wrote in message > > > news:uAbTqK3iEHA.704@TK2MSFTNGP12.phx.gbl... > > > I disagree you can protect your source from the average consumer that > 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 > > > > > > > > > > > > "Murray" <forums@HAHAgreat-web-sights.com> wrote in message > > > news:eEEs9K2iEHA.1204@TK2MSFTNGP15.phx.gbl... > > > > > 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 words, there is > no > > > > practical way to do it, at least not in our use space. > > > > > > > > -- > > > > Murray > > > > > > > > "MD Websunlimited" <none@none.com> wrote in message > > > > news:uYOJpt1iEHA.712@TK2MSFTNGP09.phx.gbl... > > > > > 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 > > > > > > > > > > "Weaver" <warpigs@insightbb.com> wrote in message > > > > > news:d2c601c48aae$db01d710$a601280a@phx.gbl... > > > > >> How do I protect my source codes? ASP as well as HTML? > > > > >> > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
- Next message: Murray: "Re: Source Code Protection"
- Previous message: Steve Easton: "Re: Publishing"
- In reply to: Kevin Spencer: "Re: Source Code Protection"
- Next in thread: Murray: "Re: Source Code Protection"
- Reply: Murray: "Re: Source Code Protection"
- Reply: MD Websunlimited: "Re: Source Code Protection"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading