dado.d 0 Newbie Poster

This is my process.php which I use to post data on my page's wall
PHP Code:

include_once("config.php"); 


//HTTP POST request to PAGE_ID/feed with the publish_stream 
$post_url = '/'.$userPageId.'/feed'; 

//after login redirect him and if i can get message submit it to page 
if(isset($_GET["message"])) 
{ 
    $msg_body = array( 
    'message' => $_GET["message"], 
    ); 

    try 
    { 
        $postResult = $facebook->api($post_url, 'post', $msg_body ); 
        //header('Location: ' . $homeurl."?success=true"); 
        $homeurl=$homeurl."?success=true"; 
        echo "<script>window.location='$homeurl'</script>"; 
    } 

    catch (FacebookApiException $e)  
    { 
        echo $e->getMessage(); 
    } 


} 

if($_POST) 
{ 

    //Post variables we received from user 
    $userMessage    = $_POST["message"]; 

    if(strlen($userMessage)<1)  
    { 
        //message is empty 
        $userMessage = 'No message was entered!'; 
    } 


        /* 
        // posts message on page feed 
        $msg_body = array( 
            'message' => $userMessage, 
            'name' => 'Message Posted from Saaraan.com!', 
            'caption' => "Nice stuff", 
            'link' => 'http://www.saaraan.com/assets/ajax-post-on-page-wall', 
            'description' => 'Demo php script posting message on this facebook page.', 
            'picture' => 'http://www.saaraan.com/templates/saaraan/images/logo.png' 
            'actions' => array( 
                                array( 
                                    'name' => 'Saaraan', 
                                    'link' => 'http://www.saaraan.com' 
                                ) 
                            ) 
        ); 
        */ 

        //posts message on page statues  
        $msg_body = array( 
        'message' => $userMessage, 
        ); 

    if ($fbuser)  
    { 
        try  
        { 
            $postResult = $facebook->api($post_url, 'post', $msg_body ); 
            $homeurl=$homeurl."?success=true"; 
            echo "<script>window.location='$homeurl'</script>"; 
            //header('Location: ' . $homeurl."?success=true"); 
        }  

        catch (FacebookApiException $e)  
        { 
            echo $e->getMessage(); 
        } 
    } 
    else 
    { 
        $redirect_url=$loginredirect."?message=".$userMessage; 
        $loginUrl = $facebook->getLoginUrl(array('redirect_uri'=>$redirect_url,'scope'=>$fbPermissions)); 
        header('Location: ' . $loginUrl); 
        echo "<script>window.location='$loginUrl'</script>"; 
    } 

}  

This is config.php

PHP Code:

include_once("inc/facebook.php"); //include facebook SDK 

######### edit details ########## 
$appId = '604912379583740'; //Facebook App ID 
$appSecret = '<APP SECRET>'; // Facebook App Secret 
//$return_url = 'http://localhost/test/postt/process.php';  //return url (url to script) 
$homeurl = 'http://www.trbovic.info/lega/index.php';  //return to home 
$fbPermissions = 'publish_stream,manage_pages,publish_actions';  //Required facebook permissions 
$loginredirect = 'http://www.trbovic.info/lega/fb/process.php';  //return to home 
//Post variables we received from user 
$userPageId = "267294363430972";//$_POST["userpages"]; 
################################## 

//Call Facebook API 
$facebook = new Facebook(array( 
  'appId'  => $appId, 
  'secret' => $appSecret 
)); 

$fbuser = $facebook->getUser();  

in index.php I'm just using simple form with textarea and submit button to submit to process.php
It just says (#200) The user hasn't authorized the application to perform this action. I'm not sure where did I make a mistake. I tried with 2 different accounts and they all allowed my app to preform those actions