Ajax.php
function checkLink()
    {
        if (!isset($_POST['link'])) {
            $this->sendError();
        }

        $link = strtolower(str_replace([" ",'"',"'",';','.',','], ["-",""], preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities(trim($_POST['link'])))));

        $base = new Model\Base;
        $status = $base->checkLink($link, $_POST['aID']) === false ? 'ok' : 'error';

        $this->send(['status'=>$status,'link'=>$link]);
    }
function checkLink()
    {
        if (!isset($_POST['link'])) {
            $this->sendError();
        }

        $link = strtolower(str_replace([" ",'"',"'",';','.',','], ["-",""], preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities(trim($_POST['link'])))));

        $base = new Model\Base;
        $status = $base->checkLink($link, $_POST['aID']) === false ? 'ok' : 'error';

        $this->send(['status'=>$status,'link'=>$link]);
    }
function checkLink ( ) { if ( ! isset ( $ _POST [ 'link' ] ) ) { $ this -> sendError ( ) ; } $ link = strtolower ( str_replace ( [ " " , '"' , "'" , ';' , '.' , ',' ] , [ "-" , "" ] , preg_replace ( "/&([a-z])[a-z]+;/i" , "$1" , htmlentities ( trim ( $ _POST [ 'link' ] ) ) ) ) ) ; $ base = new Model \ Base ; $ status = $ base -> checkLink ( $ link , $ _POST [ 'aID' ] ) === false ? 'ok' : 'error' ; $ this -> send ( [ 'status' => $ status , 'link' => $ link ] ) ; }
Check if "link" is "in use"
@return void Send data to javascript (Json)
Check if link is in use