* User: Liu
 * Date: 2016/3/10
 * Time: 15:20
 */
include_once "../dao/getNode.php";
include_once "../dao/getLink.php";
$nid = $_POST['nid'];
$startNid = $_POST['from'];
$node = getNodeByNid($nid);
if ($node == null || $node == array()) {
    echo "inactive";
} else {
    $result = getInactiveNodes();
    $list = array();
    while ($row = mysql_fetch_array($result)) {
        array_push($list, $row['nid']);
    }
    if (in_array($nid, $list)) {
        echo "inactive";
    } else {
        if ($nid != $startNid) {
            if (linkExists($startNid, $nid)) {
                echo "active";
            } else {
                echo "inactive";
            }
        } else {
            echo "active";
        }
    }
}
Beispiel #2
0
    }
}
$count = getLinkCountByNid($from);
if ($connector == 0 && $count < 3) {
    foreach ($to as $key => $value) {
        $linkCount = getLinkCountByNid($value);
        $receiver = getNodeConnector($value);
        if ($receiver != 0) {
            if (linkExists($from, $value) == 0) {
                insertLink($from, $value);
            } else {
                $result = "Link already exists";
            }
        }
        if ($receiver == 0 && $linkCount < 3) {
            if (linkExists($from, $value) == 0) {
                insertLink($from, $value);
            } else {
                $result = "Link already exists";
            }
        }
        if ($receiver == 0 && $linkCount == 3) {
            echo "222";
            $result = "failure";
        }
    }
} else {
    if ($connector == 0 && $count == 3) {
        echo "333";
        $result = "failure";
    }