<?
    $_id 
= isset($_GET['i']) ? intval($_GET['i']) : 0;
    
$_name = isset($_POST['name']) ? trim(strval($_POST['name'])) : ''
    
    
$community mysql_query("SELECT * FROM community WHERE community_id = " sq($_id));
    if (!
$community_row mysql_fetch_assoc($community))
    {
        
make_cookie('notice''Sorry, but this community does not exist.');
        
header('Location: ./?s=community_create');
        die;
    }
    
    require_once(
'include/functions/community_permissions.php');
    
community_permissions($community_row['community_id']);
    
    if (!
$GLOBALS['auth']['community']['administration'])
    {
        
make_cookie('notice''Sorry, you don\'t have permission to modify this community.');
        
header('Location: ./?s=community_create');
        die;
    }
    
    require_once(
'include/functions/community_name_valid.php');
    if (
$error community_name_valid($_name))    
    {
        
make_cookie('notice'$error);
        
header('Location: ./?s=community_modify&i=' $community_row['community_id']);
        die;        
    }

    
mysql_query("UPDATE community SET community_name = " sq($_name) . " WHERE community_id = '" $community_row['community_id'] . "'");

    
header('Location: ./?s=community_modify&i=' $community_row['community_id']);
    die;
?>