758 exit; |
758 exit; |
759 } |
759 } |
760 fwrite($handle, '<?php $cryptkey = \''.$cryptkey.'\'; ?>'); |
760 fwrite($handle, '<?php $cryptkey = \''.$cryptkey.'\'; ?>'); |
761 fclose($handle); |
761 fclose($handle); |
762 } |
762 } |
763 ?> |
763 // Sorry for the ugly hack, but this f***s up jEdit badly. |
|
764 echo ' |
764 <script type="text/javascript"> |
765 <script type="text/javascript"> |
765 function verify() |
766 function verify() |
766 { |
767 { |
767 var frm = document.forms.login; |
768 var frm = document.forms.login; |
768 ret = true; |
769 ret = true; |
769 var ip_regexp = new RegExp('^(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$', ''); |
770 if ( frm.admin_user.value.match(/^([A-z0-9 \\-\\.]+)$/) && !frm.admin_user.value.match(/^(?:(?:\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$/) && frm.admin_user.value.toLowerCase() != \'anonymous\' ) |
770 var valid_username = new RegExp('^([A-z0-9 \-\.]+)$', ''); |
771 { |
771 if ( frm.admin_user.value.match(valid_username) && !frm.admin_user.value.match(ip_regexp) && frm.admin_user.value.toLowerCase() != 'anonymous' ) |
772 document.getElementById(\'s_user\').src = \'images/good.gif\'; |
772 { |
773 } |
773 document.getElementById('s_user').src = 'images/good.gif'; |
774 else |
774 } |
775 { |
775 else |
776 document.getElementById(\'s_user\').src = \'images/bad.gif\'; |
776 { |
|
777 document.getElementById('s_user').src = 'images/bad.gif'; |
|
778 ret = false; |
777 ret = false; |
779 } |
778 } |
780 if(frm.admin_pass.value.length >= 6 && frm.admin_pass.value == frm.admin_pass_confirm.value) |
779 if(frm.admin_pass.value.length >= 6 && frm.admin_pass.value == frm.admin_pass_confirm.value) |
781 { |
780 { |
782 document.getElementById('s_password').src = 'images/good.gif'; |
781 document.getElementById(\'s_password\').src = \'images/good.gif\'; |
783 } |
782 } |
784 else |
783 else |
785 { |
784 { |
786 document.getElementById('s_password').src = 'images/bad.gif'; |
785 document.getElementById(\'s_password\').src = \'images/bad.gif\'; |
787 ret = false; |
786 ret = false; |
788 } |
787 } |
789 var valid_email = new RegExp('^(?:[\w\d]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$', ''); |
788 if(frm.admin_email.value.match(/^(?:[\\w\\d]+\\.?)+@(?:(?:[\\w\\d]\\-?)+\\.)+\\w{2,4}$/)) |
790 if(frm.admin_email.value.match(valid_email)) |
789 { |
791 { |
790 document.getElementById(\'s_email\').src = \'images/good.gif\'; |
792 document.getElementById('s_email').src = 'images/good.gif'; |
791 } |
793 } |
792 else |
794 else |
793 { |
795 { |
794 document.getElementById(\'s_email\').src = \'images/bad.gif\'; |
796 document.getElementById('s_email').src = 'images/bad.gif'; |
|
797 ret = false; |
795 ret = false; |
798 } |
796 } |
799 if(ret) frm._cont.disabled = false; |
797 if(ret) frm._cont.disabled = false; |
800 else frm._cont.disabled = true; |
798 else frm._cont.disabled = true; |
801 return ret; |
799 return ret; |
805 function cryptdata() |
803 function cryptdata() |
806 { |
804 { |
807 if(!verify()) return false; |
805 if(!verify()) return false; |
808 } |
806 } |
809 </script> |
807 </script> |
|
808 '; |
|
809 ?> |
810 <form name="login" action="install.php?mode=confirm" method="post" onsubmit="runEncryption();"> |
810 <form name="login" action="install.php?mode=confirm" method="post" onsubmit="runEncryption();"> |
811 <?php |
811 <?php |
812 $k = array_keys($_POST); |
812 $k = array_keys($_POST); |
813 for($i=0;$i<sizeof($_POST);$i++) { |
813 for($i=0;$i<sizeof($_POST);$i++) { |
814 echo '<input type="hidden" name="'.htmlspecialchars($k[$i]).'" value="'.htmlspecialchars($_POST[$k[$i]]).'" />'."\n"; |
814 echo '<input type="hidden" name="'.htmlspecialchars($k[$i]).'" value="'.htmlspecialchars($_POST[$k[$i]]).'" />'."\n"; |
849 <input type="hidden" name="crypt_key" value="<?php echo $cryptkey; ?>" /> |
849 <input type="hidden" name="crypt_key" value="<?php echo $cryptkey; ?>" /> |
850 <input type="hidden" name="crypt_data" value="" /> |
850 <input type="hidden" name="crypt_data" value="" /> |
851 </form> |
851 </form> |
852 <script type="text/javascript"> |
852 <script type="text/javascript"> |
853 // <![CDATA[ |
853 // <![CDATA[ |
|
854 var frm = document.forms.login; |
854 frm.admin_user.focus(); |
855 frm.admin_user.focus(); |
855 function runEncryption() |
856 function runEncryption() |
856 { |
857 { |
857 str = ''; |
858 str = ''; |
858 for(i=0;i<keySizeInBits/4;i++) str+='0'; |
859 for(i=0;i<keySizeInBits/4;i++) str+='0'; |