Файл: EasyHost v2.0/system/htdocs/admin/users/user/modify.pl
Строк: 77
<?php
$system->error('This feature has been disabled in demo mode') if $system->config('demo');
if (length $system->param('password') > 0)
{
$system->error('The password field must be between '.$system->config('password_min').' to '.$system->config('password_max').' characters in length') if (length $system->param('password') < $system->config('password_min') || length $system->param('password') > $system->config('password_max'));
$system->error('The password field must not be the same as your username') if ($system->param('password') eq $system->param('username'));
$system->error('The password field doesn't match what you re-typed') if ($system->param('password') ne $system->param('password2'));
}
$system->error('The email address field is required') if (!$system->param('email'));
$system->error('The email address field contains invalid characters') if ($system->param('email') !~ /^.+@[w-.]{4,}$/);
if ($system->param('email') ne $user->email && $system->service->config('distinct_email') > 0)
{
my $count = $system->db->selectrow_array('SELECT COUNT(*) FROM users WHERE email = ?',undef,$system->param('email'));
$system->error('The email address you entered has already been assigned to '.$count.' account(s)') if ($count >= $system->service->config('distinct_email'));
}
$system->error('You must select a package to assign the user') if ($system->param('package') < 1);
$system->error('The package you selected wasn't found in the database') if (!$system->db->selectrow_array('SELECT id FROM packages WHERE id = ?',undef,$system->param('package')));
if ($system->service->config('data_website') eq 'required')
{
$system->error('The website title field is required') if (length $system->param('data_title') == 0);
$system->error('The website description field is required') if (length $system->param('data_description') == 0);
}
if ($system->service->config('data_contact') eq 'required')
{
$system->error('The contact name field is required') if (length $system->param('data_contact') == 0);
$system->error('The phone number field is required') if (length $system->param('data_phone') == 0);
}
if ($system->service->config('data_address') eq 'required')
{
$system->error('The address field is required') if (length $system->param('data_address') == 0);
$system->error('The city field is required') if (length $system->param('data_city') == 0);
$system->error('The country field is required') if (length $system->param('data_country') == 0);
$system->error('The province field is required') if ($system->param('data_country') eq 'CA' && length $system->param('data_province') == 0);
$system->error('The state field is required') if ($system->param('data_country') eq 'US' && length $system->param('data_state') == 0);
$system->error('The zip/postal code field is required') if (length $system->param('data_zip_code') == 0);
}
$system->db->do('UPDATE users SET password = ?,email = ?,category_id = ?,package_id = ?,status = ? WHERE id = ?',undef,$system->param('password') || $user->password,$system->param('email'),$system->param('category') || '0',$system->param('package'),$system->param('status') || '0',$user->id);
$system->db->do('DELETE FROM users_data WHERE id = ?',undef,$user->id);
my $insert = $system->db->prepare('INSERT INTO users_data VALUES (?,?,?)');
foreach (grep { lc(substr($_,0,5)) eq 'data_' && length($system->param($_)) > 0 } $system->param)
{
$insert->execute($user->id,substr($_,5),$system->param($_));
}
$insert->finish;
$system->redirect;
?>