osCommerce最好的电子商务程序 2.2
源代码在线查看: account_check.js.php
/*
$Id: account_check.js.php,v 1.1.2.1 2004/10/10 16:00:41 cvsadmin Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
?>
if (substr(basename($PHP_SELF), 0, 12) == 'admin_member') {
?>
function validateForm() {
var p,z,xEmail,errors='',dbEmail,result=0,i;
var adminName1 = document.newmember.admin_firstname.value;
var adminName2 = document.newmember.admin_lastname.value;
var adminEmail = document.newmember.admin_email_address.value;
if (adminName1 == '') {
errors+='';
} else if (adminName1.length < ) {
errors+='- Firstname length must over \n';
}
if (adminName2 == '') {
errors+='';
} else if (adminName2.length < ) {
errors+='- Lastname length must over \n';
}
if (adminEmail == '') {
errors+='';
} else if (adminEmail.indexOf("@") = (adminEmail.length - 3) || adminEmail.indexOf(".") = (adminEmail.length - 2) || adminEmail.indexOf("@.") >= 0 ) {
errors+='';
} else if (adminEmail.length < ) {
errors+='';
}
if (errors) alert('The following error(s) occurred:\n'+errors);
document.returnValue = (errors == '');
}
function checkGroups(obj) {
var subgroupID,i;
subgroupID = eval("this.defineForm.subgroups_"+parseFloat((obj.id).substring(7)));
if (subgroupID.length > 0) {
for (i=0; i if (obj.checked == true) { subgroupID[i].checked = true; }
else { subgroupID[i].checked = false; }
}
} else {
if (obj.checked == true) { subgroupID.checked = true; }
else { subgroupID.checked = false; }
}
}
function checkSub(obj) {
var groupID,subgroupID,i,num=0;
groupID = eval("this.defineForm.groups_"+parseFloat((obj.id).substring(10)));
subgroupID = eval("this.defineForm."+(obj.id));
if (subgroupID.length > 0) {
for (i=0; i < subgroupID.length; i++) {
if (subgroupID[i].checked == true) num++;
}
} else {
if (subgroupID.checked == true) num++;
}
if (num>0) { groupID.checked = true; }
else { groupID.checked = false; }
}
//-->
} else {
?>
function validateForm() {
var p,z,xEmail,errors='',dbEmail,result=0,i;
var adminName1 = document.account.admin_firstname.value;
var adminName2 = document.account.admin_lastname.value;
var adminEmail = document.account.admin_email_address.value;
var adminPass1 = document.account.admin_password.value;
var adminPass2 = document.account.admin_password_confirm.value;
if (adminName1 == '') {
errors+='';
} else if (adminName1.length < ) {
errors+='\n';
}
if (adminName2 == '') {
errors+='';
} else if (adminName2.length < ) {
errors+='\n';
}
if (adminEmail == '') {
errors+='';
} else if (adminEmail.indexOf("@") = (adminEmail.length - 3) || adminEmail.indexOf(".") = (adminEmail.length - 2) || adminEmail.indexOf("@.") >= 0 ) {
errors+='';
} else if (adminEmail.length < ) {
errors+='';
}
if (adminPass1 == '') {
errors+='';
} else if (adminPass1.length < ) {
errors+='\n';
} else if (adminPass1 != adminPass2) {
errors+='';
}
if (errors) alert('The following error(s) occurred:\n'+errors);
document.returnValue = (errors == '');
}
//-->
}
?>