[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/ -> account_check.js.php (source)

   1  <?php
   2  /*

   3  $Id: account_check.js.php 14 2006-07-28 17:42:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2009 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  ?>
  13  
  14  <?php
  15  if (substr(basename($PHP_SELF), 0, 12) == 'admin_member') {
  16  ?>
  17  
  18  <script language="JavaScript" type="text/JavaScript">
  19  <!--
  20  function validateForm() {
  21    var p,z,xEmail,errors='',dbEmail,result=0,i;
  22  
  23    var adminUserName = document.newmember.admin_username.value;
  24    var adminName1 = document.newmember.admin_firstname.value;
  25    var adminName2 = document.newmember.admin_lastname.value;
  26    var adminEmail = document.newmember.admin_email_address.value;
  27    if (adminUserName == '') {
  28      errors+='<?php echo JS_ALERT_USERNAME; ?>';
  29    } else if (adminUserName.length < <?php echo ENTRY_USERNAME_MIN_LENGTH; ?>) {
  30      errors+='- Username must be longer than  <?php echo (ENTRY_USERNAME_MIN_LENGTH); ?>\n';
  31    }
  32  
  33    if (adminName1 == '') {
  34      errors+='<?php echo JS_ALERT_FIRSTNAME; ?>';
  35    } else if (adminName1.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) {
  36      errors+='- First Name must be longer than  <?php echo (ENTRY_FIRST_NAME_MIN_LENGTH); ?>\n';
  37    }
  38  
  39    if (adminName2 == '') {
  40      errors+='<?php echo JS_ALERT_LASTNAME; ?>';
  41    } else if (adminName2.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) {
  42      errors+='- Last Name must be longer than  <?php echo (ENTRY_LAST_NAME_MIN_LENGTH);  ?>\n';
  43    }
  44  
  45    if (adminEmail == '') {
  46      errors+='<?php echo JS_ALERT_EMAIL; ?>';
  47    } else if (adminEmail.indexOf("@") <= 1 || adminEmail.indexOf("@") >= (adminEmail.length - 3) || adminEmail.indexOf(".") <= 3 || adminEmail.indexOf(".") >= (adminEmail.length - 2) || adminEmail.indexOf("@.") >= 0 ) {
  48      errors+='<?php echo JS_ALERT_EMAIL_FORMAT; ?>';
  49    } else if (adminEmail.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) {
  50      errors+='<?php echo JS_ALERT_EMAIL_FORMAT; ?>';
  51    }
  52  
  53    if (errors) alert('The following error(s) occurred:\n'+errors);
  54    document.returnValue = (errors == '');
  55  }
  56  
  57  
  58  function checkGroups(obj) {
  59    var subgroupID,i;
  60    subgroupID = eval("document.defineForm.subgroups_"+parseFloat((obj.id).substring(7)));
  61  
  62    if (subgroupID.length > 0) {
  63      for (i=0; i<subgroupID.length; i++) {
  64        if (obj.checked == true) { subgroupID[i].checked = true; }
  65        else { subgroupID[i].checked = false; }
  66      }
  67    } else {
  68      if (obj.checked == true) { subgroupID.checked = true; }
  69      else { subgroupID.checked = false; }
  70    }
  71  }
  72  
  73  function checkSub(obj) {
  74    var groupID,subgroupID,i,num=0;
  75    groupID = eval("document.defineForm.groups_"+parseFloat((obj.id).substring(10)));
  76    subgroupID = eval("document.defineForm."+(obj.id));
  77  
  78    if (subgroupID.length > 0) {
  79      for (i=0; i < subgroupID.length; i++) {
  80        if (subgroupID[i].checked == true) num++;
  81      }
  82    } else {
  83      if (subgroupID.checked == true) num++;
  84    }
  85    if (num>0) { groupID.checked = true; }
  86    else { groupID.checked = false; }
  87  }
  88  //-->

  89  </script>
  90  
  91  <?php
  92  } else {
  93  ?>
  94  
  95  <script language="JavaScript" type="text/JavaScript">
  96  <!--
  97  function validateForm() {
  98    var p,z,xEmail,errors='',dbEmail,result=0,i;
  99  
 100    var adminUserName = document.account.admin_username.value;
 101    var adminName1 = document.account.admin_firstname.value;
 102    var adminName2 = document.account.admin_lastname.value;
 103    var adminEmail = document.account.admin_email_address.value;
 104    var adminPass1 = document.account.admin_password.value;
 105    var adminPass2 = document.account.admin_password_confirm.value;
 106    if (adminUserName == '') {
 107      errors+='<?php echo JS_ALERT_USERNAME; ?>';
 108    } else if (adminUserName.length < <?php echo ENTRY_USERNAME_MIN_LENGTH; ?>) {
 109      errors+='<?php echo JS_ALERT_USERNAME_LENGTH . ENTRY_USERNAME_MIN_LENGTH; ?>\n';
 110    }
 111  
 112    if (adminName1 == '') {
 113      errors+='<?php echo JS_ALERT_FIRSTNAME; ?>';
 114    } else if (adminName1.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) {
 115      errors+='<?php echo JS_ALERT_FIRSTNAME_LENGTH . ENTRY_FIRST_NAME_MIN_LENGTH; ?>\n';
 116    }
 117  
 118    if (adminName2 == '') {
 119      errors+='<?php echo JS_ALERT_LASTNAME; ?>';
 120    } else if (adminName2.length < <?php echo ENTRY_LAST_NAME_MIN_LENGTH; ?>) {
 121      errors+='<?php echo JS_ALERT_LASTNAME_LENGTH . ENTRY_LAST_NAME_MIN_LENGTH;  ?>\n';
 122    }
 123  
 124    if (adminEmail == '') {
 125      errors+='<?php echo JS_ALERT_EMAIL; ?>';
 126    } else if (adminEmail.indexOf("@") <= 1 || adminEmail.indexOf("@") >= (adminEmail.length - 3) || adminEmail.indexOf(".") <= 3 || adminEmail.indexOf(".") >= (adminEmail.length - 2) || adminEmail.indexOf("@.") >= 0 ) {
 127      errors+='<?php echo JS_ALERT_EMAIL_FORMAT; ?>';
 128    } else if (adminEmail.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) {
 129      errors+='<?php echo JS_ALERT_EMAIL_FORMAT; ?>';
 130    }
 131  
 132    if (adminPass1 == '') {
 133      errors+='<?php echo JS_ALERT_PASSWORD; ?>';
 134    } else if (adminPass1.length < <?php echo ENTRY_PASSWORD_MIN_LENGTH; ?>) {
 135      errors+='<?php echo JS_ALERT_PASSWORD_LENGTH . ENTRY_PASSWORD_MIN_LENGTH; ?>\n';
 136    } else if (adminPass1 != adminPass2) {
 137      errors+='<?php echo JS_ALERT_PASSWORD_CONFIRM; ?>';
 138    }
 139  
 140    if (errors) alert('The following error(s) occurred:\n'+errors);
 141    document.returnValue = (errors == '');
 142  }
 143  
 144  //-->

 145  </script>
 146  
 147  <?php
 148  }
 149  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7