Revision 1710
Added by Luisehahne about 13 years ago
| save.php | ||
|---|---|---|
| 3 | 3 |
* |
| 4 | 4 |
* @category admin |
| 5 | 5 |
* @package users |
| 6 |
* @author WebsiteBaker Project |
|
| 7 |
* @copyright 2004-2009, Ryan Djurovich |
|
| 8 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
| 6 |
* @author Ryan Djurovich, WebsiteBaker Project |
|
| 7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V. |
|
| 9 | 8 |
* @link http://www.websitebaker2.org/ |
| 10 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 11 | 10 |
* @platform WebsiteBaker 2.8.x |
| ... | ... | |
| 38 | 37 |
header("Location: index.php");
|
| 39 | 38 |
exit(0); |
| 40 | 39 |
} else {
|
| 41 |
$user_id = $_POST['user_id'];
|
|
| 40 |
$user_id = intval($_POST['user_id']);
|
|
| 42 | 41 |
} |
| 43 | 42 |
|
| 44 | 43 |
// Gather details entered |
| ... | ... | |
| 54 | 53 |
|
| 55 | 54 |
// Check values |
| 56 | 55 |
if($groups_id == "") {
|
| 57 |
$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back);
|
|
| 56 |
$admin->print_error($MESSAGE['USERS_NO_GROUP'], $js_back);
|
|
| 58 | 57 |
} |
| 59 |
if(!preg_match('/^[a-z]{1}[a-z0-9_-]{2,}$/i', $username)) {
|
|
| 58 |
if(!preg_match('/^[a-z]{1}[a-z0-9_-]{2,}$/i', $username))
|
|
| 59 |
{
|
|
| 60 |
|
|
| 61 |
// print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />'; |
|
| 62 |
// print_r( $_POST ); print '</pre>'; |
|
| 60 | 63 |
$admin->print_error( $MESSAGE['USERS_NAME_INVALID_CHARS'].' / '. |
| 61 | 64 |
$MESSAGE['USERS_USERNAME_TOO_SHORT'], $js_back); |
| 62 | 65 |
} |
| 63 | 66 |
if($password != "") {
|
| 64 | 67 |
if(strlen($password) < 2) {
|
| 65 |
$admin->print_error($MESSAGE['USERS']['PASSWORD_TOO_SHORT'], $js_back);
|
|
| 68 |
$admin->print_error($MESSAGE['USERS_PASSWORD_TOO_SHORT'], $js_back);
|
|
| 66 | 69 |
} |
| 67 | 70 |
if($password != $password2) {
|
| 68 |
$admin->print_error($MESSAGE['USERS']['PASSWORD_MISMATCH'], $js_back);
|
|
| 71 |
$admin->print_error($MESSAGE['USERS_PASSWORD_MISMATCH'], $js_back);
|
|
| 69 | 72 |
} |
| 70 | 73 |
} |
| 71 | 74 |
|
| ... | ... | |
| 73 | 76 |
{
|
| 74 | 77 |
if($admin->validate_email($email) == false) |
| 75 | 78 |
{
|
| 76 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
|
|
| 79 |
$admin->print_error($MESSAGE['USERS_INVALID_EMAIL'], $js_back);
|
|
| 77 | 80 |
} |
| 78 | 81 |
} else { // e-mail must be present
|
| 79 |
$admin->print_error($MESSAGE['SIGNUP']['NO_EMAIL'], $js_back);
|
|
| 82 |
$admin->print_error($MESSAGE['SIGNUP_NO_EMAIL'], $js_back);
|
|
| 80 | 83 |
} |
| 81 | 84 |
|
| 82 | 85 |
// Check if the email already exists |
| 83 | 86 |
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE email = '".$admin->add_slashes($_POST['email'])."' AND user_id <> '".$user_id."' ");
|
| 84 | 87 |
if($results->numRows() > 0) |
| 85 | 88 |
{
|
| 86 |
if(isset($MESSAGE['USERS']['EMAIL_TAKEN']))
|
|
| 89 |
if(isset($MESSAGE['USERS_EMAIL_TAKEN']))
|
|
| 87 | 90 |
{
|
| 88 |
$admin->print_error($MESSAGE['USERS']['EMAIL_TAKEN'], $js_back);
|
|
| 91 |
$admin->print_error($MESSAGE['USERS_EMAIL_TAKEN'], $js_back);
|
|
| 89 | 92 |
} else {
|
| 90 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
|
|
| 93 |
$admin->print_error($MESSAGE['USERS_INVALID_EMAIL'], $js_back);
|
|
| 91 | 94 |
} |
| 92 | 95 |
} |
| 93 | 96 |
|
| ... | ... | |
| 110 | 113 |
if($database->is_error()) {
|
| 111 | 114 |
$admin->print_error($database->get_error(),$js_back); |
| 112 | 115 |
} else {
|
| 113 |
$admin->print_success($MESSAGE['USERS']['SAVED']);
|
|
| 116 |
$admin->print_success($MESSAGE['USERS_SAVED']);
|
|
| 114 | 117 |
} |
| 115 | 118 |
|
| 116 | 119 |
// Print admin footer |
Also available in: Unified diff
! update folder admin/groups, admin/users, admin/skel/htt