home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / JanaSetup.exe / admin / seiten_js / pw_create.js < prev    next >
Text File  |  2006-05-08  |  2KB  |  125 lines

  1. document.title = txt[74][0];
  2.  
  3. /**/
  4.  
  5. function selec()
  6. {
  7.     var query = self.location.search.substring(1, self.location.search.length);
  8.     var optio = query.split('&');
  9.  
  10.     if ((isNaN(optio[1]) == true) || (optio[1] < 4) || (optio[1] > 20))
  11.         optio[1] = 4;
  12.  
  13.     for (i = optio[1]; i <= 20; i++)
  14.     {
  15.         if (i < 10)
  16.             document.write('<option value="' + i + '">    ' + i + '  </option>');
  17.         else
  18.             document.write('<option value="' + i + '">  ' + i + '  </option>');
  19.     }
  20. }
  21.  
  22. /**/
  23.  
  24. var gopw = 0;
  25.  
  26. function start()
  27. {
  28.     gopw = 1;
  29.     go();
  30. }
  31.  
  32. /**/
  33.  
  34. function stop()
  35. {
  36.     gopw = 0;
  37.     setTimeout('uebergabe();', 200);
  38. }
  39.  
  40. /**/
  41.  
  42. function go()
  43. {
  44.     document.passwd.ausgabe.value = erstellen();
  45.  
  46.     if (gopw == 1)
  47.         setTimeout('go();', 50);
  48. }
  49.  
  50. /**/
  51.  
  52. function erstellen()
  53. {
  54.     var pwaus  = '';
  55.     var plen   = '';
  56.     var tmp    = '';
  57.     var satz   = 3;
  58.     var anza   = document.passwd.anzahl;
  59.     var pwcode = new Array('abcdefghijklmnopqrstuvwxyz', '1234567890', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
  60.     var parts  = Math.round(anza.value / 2) + 1;
  61.  
  62.     for (p = 0; p < parts; p++)
  63.     {
  64.         if (!p && !plen)
  65.             plen++;
  66.  
  67.         plen = rand(anza.value / (parts + 1)) + 1;
  68.  
  69.         if ((p == parts - 1) && (plen < anza.value - pwaus.length) || (plen > anza.value - pwaus.length))
  70.             plen = anza.value - pwaus.length;
  71.  
  72.         while (plen)
  73.         {
  74.             plen--;
  75.             pwaus = pwaus + pwcode[p % satz].charAt(rand(pwcode[p % satz].length));
  76.         }
  77.     }
  78.  
  79.     for (i = 0; i < pwaus.length; i++)
  80.         tmp = tmp + pwaus.charAt(i);
  81.  
  82.     pwaus = tmp;
  83.  
  84.     return substring(pwaus, 0, anza.value);
  85. }
  86.  
  87. /**/
  88.  
  89. function rand(za)
  90. {
  91.     return Math.round(Math.random() * za);
  92. }
  93.  
  94. /**/
  95.  
  96. function substring(inp, offs, len)
  97. {
  98.     var ausgabe = '';
  99.  
  100.     for (i = offs; i < (offs + len); i++)
  101.         ausgabe = ausgabe + inp.charAt(i);
  102.  
  103.     return ausgabe;
  104. }
  105.  
  106. /**/
  107.  
  108. function uebergabe()
  109. {
  110.     var query    = self.location.search.substring(1, self.location.search.length);
  111.     var feld     = query.split('&');
  112.     var passfeld = opener.document.formular.elements[feld[0]];
  113.     var pwd      = document.passwd.ausgabe.value;
  114.  
  115.     if (document.passwd.ausgabe.value != '')
  116.     {
  117.         passfeld.value = '';
  118.         passfeld.value = pwd;
  119.     }
  120.     else
  121.     {
  122.         alert(txt[74][1] + '!');
  123.         document.passwd.anzahl.focus();
  124.     }
  125. }