get_val( 'upload', $md5, 'id' ); if ( $id )die( 'Уже есть такое' ); @mkdir( MYDIR . '/img/users', 0700 ); @mkdir( MYDIR . '/img/users/' . $_SESSION['user_id'], 0700 ); require_once MYDIR . '/api/php/genpass.php'; $img_name = generate_password( 20 ); $source = $_FILES['file']['tmp_name']; $target_original = MYDIR . '/img/users/' . $_SESSION['user_id'] . '/' . $img_name . '.jpg'; copy( $source, $target_original ); unset( $a ); $a['rnd_name'] = $img_name; $a['pages_id'] = $_SESSION['page_id']; $a['original_name'] = $_FILES['file']['name']; $a['type'] = 'img'; $a['user_id'] = $_SESSION['user_id']; $a['md5'] = $md5['md5']; $db -> add( 'upload', $a ); } } break; case 'update_settings': unset($_POST['act']); $db->update_settings($_POST); break; default: } ?>