<?php

require '../dao/ConcernDao.php';
$userId = $_REQUEST['userId'];
$concernTarget = $_REQUEST['concernTarget'];
$concernDao = new ConcernDao();
if ($concernDao->setConcern($userId, $concernTarget) > 0) {
    echo json_encode(array('mesg' => 'success', 'result' => true));
} else {
    echo json_encode(array('mesg' => 'fail', 'result' => false));
}
<?php

require '../dao/UserDao.php';
require '../dao/ConcernDao.php';
$userId = $_REQUEST['userId'];
$visitUser = empty($_REQUEST['visitUser']) ? null : $_REQUEST['visitUser'];
$userDao = new UserDao();
$obj = json_decode($userDao->getUserInfo($userId));
if ($visitUser != null || ($visitUser = $userId)) {
    $concernDao = new ConcernDao();
    $obj->hasConcerned = $concernDao->isConcern($visitUser, $userId);
}
echo json_encode($obj);
<?php

require '../dao/ConcernDao.php';
$userId = $_REQUEST['userId'];
$concernTarget = $_REQUEST['concernTarget'];
$concernDao = new ConcernDao();
if ($concernDao->cancelConcern($userId, $concernTarget) > 0) {
    echo json_encode(array('mesg' => 'success', 'result' => true));
} else {
    echo json_encode(array('mesg' => 'fail', 'result' => false));
}
<?php

require '../dao/ConcernDao.php';
$userId = $_REQUEST['userId'];
$concernDao = new ConcernDao();
echo $concernDao->getConcernList($userId);