Menu

#12 link.php does not verify if link is valid

open
nobody
None
5
2006-01-22
2006-01-22
No

The link.php allows invalid links.

I added a check to see that you get at lease 20
characters back to declate a valid link.

Original:
if(!($this->html = $xxx)) {
return;
}

Fixed:

if(!($this->html = $xxx) || strlen($xxx) < 20) {
$this->valid = false;
return;
}

Added || strlen($xxx) < 20

And

$this->valid = false;

Discussion

  • Aviran Mordo

    Aviran Mordo - 2006-01-22

    Fixed file

     
  • Nobody/Anonymous

    Logged In: NO

    The correct fix is to change the code as follows:

    if(!($this->html == $xxx)) {
    $this->valid = false; return;
    }

    This will put the user back on the initial url entry page.

     
  • clancey

    clancey - 2006-01-31

    Logged In: YES
    user_id=1440149

    The solution to this problem that I implemented was:

    [code]
    function get($url) {
    $url=trim($url);

    if( !preg_match( '/^(http|https|ftp):\/\/[a-
    z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}'
    .'((:[0-9]{1,5})?\/.*)?$/i' ,$url))
    {
    $this->valid = false; return;
    }

    if( CHECK_SPAM && $this->check_spam( $url))
    { $this->valid = false; return; }

    [/code]

     

Log in to post a comment.