510 <?php |
510 <?php |
511 $val = ( $coppa ) ? 'yes' : 'no'; |
511 $val = ( $coppa ) ? 'yes' : 'no'; |
512 echo '<input type="hidden" name="coppa" value="' . $val . '" />'; |
512 echo '<input type="hidden" name="coppa" value="' . $val . '" />'; |
513 ?> |
513 ?> |
514 </form> |
514 </form> |
515 <script type="text/javascript"> |
515 <!-- Don't optimize this script, it fails when compressed --> |
516 // <![CDATA[ |
516 <enano:no-opt> |
517 var namegood = false; |
517 <script type="text/javascript"> |
518 function validateForm() |
518 // <![CDATA[ |
519 { |
519 var namegood = false; |
520 var frm = document.forms.regform; |
520 function validateForm() |
521 failed = false; |
|
522 |
|
523 // Username |
|
524 if(!namegood) |
|
525 { |
521 { |
526 if(frm.username.value.match(/^([A-z0-9 \!@\-\(\)]+){2,}$/ig)) |
522 var frm = document.forms.regform; |
|
523 failed = false; |
|
524 |
|
525 // Username |
|
526 if(!namegood) |
527 { |
527 { |
528 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/unknown.gif'; |
528 if(frm.username.value.match(/^([A-z0-9 \!@\-\(\)]+){2,}$/ig)) |
529 document.getElementById('e_username').innerHTML = ''; // '<br /><small><b>Checking availability...</b></small>'; |
529 { |
|
530 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/unknown.gif'; |
|
531 document.getElementById('e_username').innerHTML = ''; // '<br /><small><b>Checking availability...</b></small>'; |
|
532 } else { |
|
533 failed = true; |
|
534 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
535 document.getElementById('e_username').innerHTML = '<br /><small>Your username must be at least two characters in length and may contain only alphanumeric characters (A-Z and 0-9), spaces, and the following characters: :, !, @, #, *.</small>'; |
|
536 } |
|
537 } |
|
538 document.getElementById('b_username').innerHTML = ''; |
|
539 if(hex_md5(frm.real_name.value) == '5a397df72678128cf0e8147a2befd5f1') |
|
540 { |
|
541 document.getElementById('b_username').innerHTML = '<br /><br />Hey...I know you!<br /><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Bill_Gates_2004_cr.jpg/220px-Bill_Gates_2004_cr.jpg" />'; |
|
542 } |
|
543 |
|
544 // Password |
|
545 if(frm.password.value.match(/^(.+){6,}$/ig) && frm.password_confirm.value.match(/^(.+){6,}$/ig) && frm.password.value == frm.password_confirm.value) |
|
546 { |
|
547 document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/good.gif'; |
|
548 document.getElementById('e_password').innerHTML = '<br /><small>The password you entered is valid.</small>'; |
530 } else { |
549 } else { |
531 failed = true; |
550 failed = true; |
532 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif'; |
551 if(frm.password.value.length < 6) |
533 document.getElementById('e_username').innerHTML = '<br /><small>Your username must be at least two characters in length and may contain only alphanumeric characters (A-Z and 0-9), spaces, and the following characters: :, !, @, #, *.</small>'; |
552 { |
|
553 document.getElementById('e_password').innerHTML = '<br /><small>Your password must be at least six characters in length.</small>'; |
|
554 } |
|
555 else if(frm.password.value != frm.password_confirm.value) |
|
556 { |
|
557 document.getElementById('e_password').innerHTML = '<br /><small>The passwords you entered do not match.</small>'; |
|
558 } |
|
559 else |
|
560 { |
|
561 document.getElementById('e_password').innerHTML = ''; |
|
562 } |
|
563 document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
564 } |
|
565 |
|
566 // E-mail address |
|
567 |
|
568 // workaround for idiot jEdit bug |
|
569 if ( validateEmail(frm.email.value) ) |
|
570 { |
|
571 document.getElementById('s_email').src='<?php echo scriptPath; ?>/images/good.gif'; |
|
572 } else { |
|
573 failed = true; |
|
574 document.getElementById('s_email').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
575 } |
|
576 if(failed) |
|
577 { |
|
578 frm.submit.disabled = 'disabled'; |
|
579 } else { |
|
580 frm.submit.disabled = false; |
534 } |
581 } |
535 } |
582 } |
536 document.getElementById('b_username').innerHTML = ''; |
583 function checkUsername() |
537 if(hex_md5(frm.real_name.value) == '5a397df72678128cf0e8147a2befd5f1') |
|
538 { |
584 { |
539 document.getElementById('b_username').innerHTML = '<br /><br />Hey...I know you!<br /><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Bill_Gates_2004_cr.jpg/220px-Bill_Gates_2004_cr.jpg" />'; |
585 var frm = document.forms.regform; |
|
586 |
|
587 if(!namegood) |
|
588 { |
|
589 if(frm.username.value.match(/^([A-z0-9 \.:\!@\#\*]+){2,}$/ig)) |
|
590 { |
|
591 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/unknown.gif'; |
|
592 document.getElementById('e_username').innerHTML = ''; |
|
593 } else { |
|
594 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
595 document.getElementById('e_username').innerHTML = '<br /><small>Your username must be at least two characters in length and may contain only alphanumeric characters (A-Z and 0-9), spaces, and the following characters: :, !, @, #, *.</small>'; |
|
596 return false; |
|
597 } |
|
598 } |
|
599 |
|
600 document.getElementById('e_username').innerHTML = '<br /><small><b>Checking availability...</b></small>'; |
|
601 ajaxGet('<?php echo scriptPath; ?>/ajax.php?title=null&_mode=checkusername&name='+escape(frm.username.value), function() { |
|
602 if(ajax.readyState == 4) |
|
603 if(ajax.responseText == 'good') |
|
604 { |
|
605 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/good.gif'; |
|
606 document.getElementById('e_username').innerHTML = '<br /><small><b>This username is available.</b></small>'; |
|
607 namegood = true; |
|
608 } else if(ajax.responseText == 'bad') { |
|
609 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
610 document.getElementById('e_username').innerHTML = '<br /><small><b>Error: that username is already taken.</b></small>'; |
|
611 namegood = false; |
|
612 } else { |
|
613 document.getElementById('e_username').innerHTML = ajax.responseText; |
|
614 } |
|
615 }); |
540 } |
616 } |
541 |
617 function regenCaptcha() |
542 // Password |
|
543 if(frm.password.value.match(/^(.+){6,}$/ig) && frm.password_confirm.value.match(/^(.+){6,}$/ig) && frm.password.value == frm.password_confirm.value) |
|
544 { |
618 { |
545 document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/good.gif'; |
619 var frm = document.forms.regform; |
546 document.getElementById('e_password').innerHTML = '<br /><small>The password you entered is valid.</small>'; |
620 document.getElementById('captchaimg').src = '<?php echo makeUrlNS("Special", "Captcha/"); ?>'+frm.captchahash.value+'/'+Math.floor(Math.random() * 100000); |
547 } else { |
621 return false; |
548 failed = true; |
|
549 if(frm.password.value.length < 6) |
|
550 document.getElementById('e_password').innerHTML = '<br /><small>Your password must be at least six characters in length.</small>'; |
|
551 else if(frm.password.value != frm.password_confirm.value) |
|
552 document.getElementById('e_password').innerHTML = '<br /><small>The passwords you entered do not match.</small>'; |
|
553 else |
|
554 document.getElementById('e_password').innerHTML = ''; |
|
555 document.getElementById('s_password').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
556 } |
622 } |
557 |
623 validateForm(); |
558 // E-mail address |
624 setTimeout('checkUsername();', 1000); |
559 if(frm.email.value.match(/^(?:[\w\d]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$/)) |
625 // ]]> |
560 { |
626 </script> |
561 document.getElementById('s_email').src='<?php echo scriptPath; ?>/images/good.gif'; |
627 </enano:no-opt> |
562 } else { |
|
563 failed = true; |
|
564 document.getElementById('s_email').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
565 } |
|
566 if(failed) |
|
567 { |
|
568 frm.submit.disabled = 'disabled'; |
|
569 } else { |
|
570 frm.submit.disabled = false; |
|
571 } |
|
572 } |
|
573 function checkUsername() |
|
574 { |
|
575 var frm = document.forms.regform; |
|
576 |
|
577 if(!namegood) |
|
578 { |
|
579 if(frm.username.value.match(/^([A-z0-9 \.:\!@\#\*]+){2,}$/ig)) |
|
580 { |
|
581 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/unknown.gif'; |
|
582 document.getElementById('e_username').innerHTML = ''; |
|
583 } else { |
|
584 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
585 document.getElementById('e_username').innerHTML = '<br /><small>Your username must be at least two characters in length and may contain only alphanumeric characters (A-Z and 0-9), spaces, and the following characters: :, !, @, #, *.</small>'; |
|
586 return false; |
|
587 } |
|
588 } |
|
589 |
|
590 document.getElementById('e_username').innerHTML = '<br /><small><b>Checking availability...</b></small>'; |
|
591 ajaxGet('<?php echo scriptPath; ?>/ajax.php?title=null&_mode=checkusername&name='+escape(frm.username.value), function() { |
|
592 if(ajax.readyState == 4) |
|
593 if(ajax.responseText == 'good') |
|
594 { |
|
595 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/good.gif'; |
|
596 document.getElementById('e_username').innerHTML = '<br /><small><b>This username is available.</b></small>'; |
|
597 namegood = true; |
|
598 } else if(ajax.responseText == 'bad') { |
|
599 document.getElementById('s_username').src='<?php echo scriptPath; ?>/images/bad.gif'; |
|
600 document.getElementById('e_username').innerHTML = '<br /><small><b>Error: that username is already taken.</b></small>'; |
|
601 namegood = false; |
|
602 } else { |
|
603 document.getElementById('e_username').innerHTML = ajax.responseText; |
|
604 } |
|
605 }); |
|
606 } |
|
607 function regenCaptcha() |
|
608 { |
|
609 var frm = document.forms.regform; |
|
610 document.getElementById('captchaimg').src = '<?php echo makeUrlNS("Special", "Captcha/"); ?>'+frm.captchahash.value+'/'+Math.floor(Math.random() * 100000); |
|
611 return false; |
|
612 } |
|
613 validateForm(); |
|
614 setTimeout('checkUsername();', 1000); |
|
615 // ]]> |
|
616 </script> |
|
617 <?php |
628 <?php |
618 } |
629 } |
619 else |
630 else |
620 { |
631 { |
621 $year = intval( date('Y') ); |
632 $year = intval( date('Y') ); |