exit;
	} else if ($image_attributes[2] > IMAGETYPE_PNG) {
		$msg->addError(array('FILE_ILLEGAL', $extension));
		header('Location: '.$_SERVER['PHP_SELF'].'?member_id='.$member_id);
		exit;
	}

	// make sure under max file size
	if ($_FILES['file']['size'] > $_config['prof_pic_max_file_size']) {
		$msg->addError('FILE_MAX_SIZE');
		header('Location: '.$_SERVER['PHP_SELF'].'?member_id='.$member_id);
		exit;
	}

	// delete the old images (if any)
	profile_image_delete($member_id);

	$new_filename   = $member_id . '.' . $extension;
	$original_img  = AT_CONTENT_DIR.'profile_pictures/originals/'. $new_filename;
	$profile_img   = AT_CONTENT_DIR.'profile_pictures/profile/'. $new_filename;
	$thumbnail_img = AT_CONTENT_DIR.'profile_pictures/thumbs/'. $new_filename;

	// save original
	if (!move_uploaded_file($_FILES['file']['tmp_name'], $original_img)) {
		$msg->addError('CANNOT_OVERWRITE_FILE');
		header('Location: '.$_SERVER['PHP_SELF'].'?member_id='.$member_id);
		exit;
	}

	// resize the original and save it at $thumbnail_file
	$width  = $image_attributes[0];
Beispiel #2
0
 $dob = $yr . '-' . $mo . '-' . $day;
 if ($mo && $day && $yr && !checkdate($mo, $day, $yr)) {
     $msg->addError('DOB_INVALID');
 } else {
     if (!$mo || !$day || !$yr) {
         $dob = '0000-00-00';
         $yr = $mo = $day = 0;
     }
 }
 if ($missing_fields) {
     $missing_fields = implode(', ', $missing_fields);
     $msg->addError(array('EMPTY_FIELDS', $missing_fields));
 }
 if (!$msg->containsErrors()) {
     if (isset($_POST['profile_pic_delete'])) {
         profile_image_delete($id);
     }
     if ($_POST['website'] && !strstr($_POST['website'], "://")) {
         $_POST['website'] = "http://" . $_POST['website'];
     }
     if ($_POST['website'] == 'http://') {
         $_POST['website'] = '';
     }
     $_POST['postal'] = strtoupper(trim($_POST['postal']));
     if (isset($_POST['private_email'])) {
         $_POST['private_email'] = 1;
     } else {
         $_POST['private_email'] = 0;
     }
     /* insert into the db. (the last 0 for status) */
     $sql = "UPDATE %smembers SET\temail   = '{$_POST['email']}',\n                                        website    = '{$_POST['website']}',\n                                        first_name = '{$_POST['first_name']}',\n                                        second_name= '{$_POST['second_name']}',\n                                        last_name  = '{$_POST['last_name']}', \n                                        dob      = '{$dob}',\n                                        gender   = '{$_POST['gender']}', \n                                        address  = '{$_POST['address']}',\n                                        postal   = '{$_POST['postal']}',\n                                        city     = '{$_POST['city']}',\n                                        province = '{$_POST['province']}',\n                                        country  = '{$_POST['country']}', \n                                        phone    = '{$_POST['phone']}',\n                                        status   = {$_POST['status']},\n                                        language = '{$_SESSION['lang']}', \n                                        private_email = {$_POST['private_email']},\n                                        creation_date=creation_date,\n                                        last_login=last_login \n                                        WHERE member_id = {$id}";