Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
contact form validation & captcha thru javascript makes problems
Old 02-02-2009, 04:05 AM contact form validation & captcha thru javascript makes problems
Candyman87's Avatar
Experienced Talker

Posts: 42
Name: Mike
Trades: 0
Hello there!

I know what you might think now: Uhhh this guy's making a javascript validation and javascript-captcha for his form when he can use PHP... BUT this poor guy doesn't know anything in PHP and knows only a little bit of js.

I have liked my html page with these two javascript forms and this is how it's looking:

HTML-file, the name is admin_contact.html

(head section)
<!--bot or not-->
HTML Code:
<script src="../js/botornot.js"></script>

<!--general form check-->
<script src="../js/form_check.js"></script>


(body section)
HTML Code:
<body onload="ActivateFlash();" bgcolor="#000000" onload="loadBotCheck()">

<form action="contact_admin.php" method="post" enctype="multipart/form-data" name="admin-inquiries" target="_self" id="admin-inquiries" lang="en" onsubmit="general_check();">

<tr>
    <td>&nbsp;<div id="botCheck" style="font-size: 18px;"></div></td>
    <td>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;
      <input name="OK" type="submit" onclick="return general_check();" onclick="return checkAnswer()" value="send" />
      <span class="form_guide">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="resetform" type="reset" id="reset2" value="reset" />
      <!--or reset the form--></span></td>
  </tr>



***



1st javascript file (that checks if every field is filled), the name is form_check.js

Code:
<script language="javascript">

//General check
function general_check()
{
 res = true;
 a = document.admin-inquiries;
 if(a.subject.value == ''){res = false;}
 if(a.message.value == ''){res = false;}
 if(a.customername.value == ''){res = false;}
 if(a.mail.value == ''){res = false;}
 
 
 //Textarea-check
 <textarea onkeypress="
                 this.form.message.value = 500-this.value.length;  
                 if(this.value.length >= 500){return false;}">
 
</textarea>
<input type="text" value="0" name="message">
 
 
 //email-field check 
reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+    //Name
                  '(\\@)'+                       //@-Zeichen
                  '([a-zA-Z0-9\\-\\.]+)'+        //Domain
                  '(\\.)'+                       //Punkt
                  '([a-zA-Z]{2,4})$');           //TLD
if(reg.test(a.email.value) == false){res = false;


 if(res == false){alert('Please make sure to fill out every form field')}
 return res;
}
</script>



***



2nd javascript file (for the captcha), the name is botornot.js

Code:
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1a 1x(){D=1y.1z;r.s("1b").1c="1d://1e.1A.1f/1B.1C?D="+D;b(r.s(y).1D.1E()==1g){1h 1F}1G{b(r.s("z").A.1H(/E o 1i. 1j 1k 1l./)==-1){r.s("z").A=r.s("z").A+"<F><B 1I=\\"#1J\\">E o 1i. 1j 1k 1l.</B>"}1h 1K}}1a 1L(){u=e.f(e.g()*11);v=e.f(e.g()*11);G=e.f(e.g()*11);H=e.f(e.g()*11);I=e.f(e.g()*11);J=e.f(e.g()*11);w=e.f(e.g()*11);x=e.f(e.g()*11);1m=k(G)+k(H);C=k(u)-k(v);1n=k(I)*k(J);p=k(w)/k(x);t=1M 1N();q=t.K();1o=t.K()-1;1p=t.K()+1;d=t.1O();c=t.1P();b(d==0){l="L"}b(d==1){l="M"}b(d==2){l="N"}b(d==3){l="O"}b(d==4){l="P"}b(d==5){l="Q"}b(d==6){l="R"}b(d==0){m="N"}b(d==1){m="O"}b(d==2){m="P"}b(d==3){m="Q"}b(d==4){m="R"}b(d==5){m="L"}b(d==6){m="M"}b(d==0){d="M"}b(d==1){d="N"}b(d==2){d="O"}b(d==3){d="P"}b(d==4){d="Q"}b(d==5){d="R"}b(d==6){d="L"}b(c==0){h="S"}b(c==1){h="T"}b(c==2){h="U"}b(c==3){h="V"}b(c==4){h="W"}b(c==5){h="X"}b(c==6){h="Y"}b(c==7){h="Z"}b(c==8){h="12"}b(c==9){h="14"}b(c==10){h="15"}b(c==11){h="16"}b(c==0){j="15"}b(c==1){j="16"}b(c==2){j="S"}b(c==3){j="T"}b(c==4){j="U"}b(c==5){j="V"}b(c==6){j="W"}b(c==7){j="X"}b(c==8){j="Y"}b(c==9){j="Z"}b(c==10){j="12"}b(c==11){j="14"}b(c==0){c="16"}b(c==1){c="S"}b(c==2){c="T"}b(c==3){c="U"}b(c==4){c="V"}b(c==5){c="W"}b(c==6){c="X"}b(c==7){c="Y"}b(c==8){c="Z"}b(c==9){c="12"}b(c==10){c="14"}b(c==11){c="15"}1q(C<0){u=e.f(e.g()*11);v=e.f(e.g()*11);C=k(u)-k(v)}1q(p<0||p!=e.1Q(p)||p=="1R"){w=e.f(e.g()*11);x=e.f(e.g()*11);p=k(w)/k(x)}1r=[G+" + "+H+" = ",u+" - "+v+" = ",I+" × "+J+" = ",w+" ÷ "+x+" = ","n q o 1s?","n q o 1t q?","n q 17 1u q?","n 18 o d?","n 18 o m?","n 18 17 l?","n c o 1s?","n c 17 1u c?","n c o 1t c?"];1v=[1m,C,1n,p,q,1p,1o,d,m,l,c,j,h];19=e.f(e.g()*13);y="1S"+e.f(e.g()*1T);r.s("z").A="1U: <i>"+1r[19]+"</i><F>E: <1V 1W=\\"1X\\" 1Y="+y+" 1w="+y+" /><1Z 1w=\\"1b\\" 1c=\\"\\" 20=\\"21: 22;\\" /><F><B 23=\\"-1\\">24 25 26 27 <a 28=\\"1d://1e.29.1f\\" 2a=\\"2b\\">2c 2d 2e</a></B>";1g=1v[19]}',62,139,'|||||||||||if|month|today|Math|floor|random|nextmonth||lastmonth|parseInt|yesterday|tomorrow|What|is|divNum|year|document|getElementById|currentTime|num1Sub|num2Sub|num1Div|num2Div|answerboxname|botCheck|innerHTML|font|subNum|site|Answer|br|num1Add|num2Add|num1Mul|num2Mul|getFullYear|saturday|sunday|monday|tuesday|wednesday|thursday|friday|february|march|april|may|june|july|august|september|||october||november|december|january|was|day|number|function|statimg|src|http|www|com|answer|return|incorrect|Please|try|again|addNum|mulNum|lastyear|nextyear|while|questions|it|next|last|answers|id|checkAnswer|location|hostname|darkcoast|human_click|php|value|toLowerCase|true|else|search|color|FF0000|false|loadBotCheck|new|Date|getDay|getMonth|round|Infinity|answerBox|10001|Question|input|type|text|name|img|style|display|none|size'.split('|'),0,{}))

any help would be highly appreciated... Of course I can also upload a file here in the forum...

if you wanna see how it's working in "real" visit the following link:
http://virtual-oz.com/html/contact_admin-old.html

Peace,
C@ndy

Last edited by Candyman87; 02-02-2009 at 04:26 PM.. Reason: ohh... ok here is the version with the code tags! thanks for the reminder, chris!
Candyman87 is offline
Reply With Quote
View Public Profile Visit Candyman87's homepage!
 
 
Register now for full access!
Old 02-02-2009, 07:50 AM Re: contact form validation & captcha thru javascript makes problems
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,520
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use code "tags" please http://www.webmaster-talk.com/php-fo...st-my-php.html
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-02-2009, 04:30 PM Re: contact form validation & captcha thru javascript makes problems
Candyman87's Avatar
Experienced Talker

Posts: 42
Name: Mike
Trades: 0
OMG that second javascript code is in one huge line. if you cannot read it i will upload the file...

xo C@ndy
Candyman87 is offline
Reply With Quote
View Public Profile Visit Candyman87's homepage!
 
Old 02-02-2009, 05:15 PM Re: contact form validation & captcha thru javascript makes problems
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
That's a dean packer compressed file. It is very hard for a human to read it, since it is a big long string that is parsed by an eval(). It's a way to save space.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 02-02-2009, 08:33 PM Re: contact form validation & captcha thru javascript makes problems
Candyman87's Avatar
Experienced Talker

Posts: 42
Name: Mike
Trades: 0
Hi Dean,

So... should I abandon this captcha (2nd javascript-file)?
but what about the first one (the one to validate the fields)?
Candyman87 is offline
Reply With Quote
View Public Profile Visit Candyman87's homepage!
 
Reply     « Reply to contact form validation & captcha thru javascript makes problems
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15844 seconds with 12 queries