Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6551601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:21:27+00:00 2026-05-25T12:21:27+00:00

my script let’s people’s post and short 15 address per time: $err_msg = isValidFLR($flr_post,

  • 0

my script let’s people’s post and short 15 address per time:

$err_msg = isValidFLR($flr_post, $ip);
    if (!$err_msg) {
    list($randlink, $lastid, $scr) = addLink($flr_post, $ip);
      $flr_post = check_input($flr_post);
      $url_array[$i]['number'] = $i + 1;
      $url_array[$i]['flr'] = $flr_post;
      $url_array[$i]['flr_substr'] = (strlen($flr_post) > 33) ? substr($flr_post, 0, 33) . '...' : $flr_post;
      $url_array[$i]['randlink'] = $randlink;
      $url_array[$i]['fullrand'] = $config['indexurl'] . $config['mod_rewrite_char'] . $randlink;
      $url_array[$i]['scr'] = $scr;
      $url_array[$i]['id'] = $lastid;
      $url_array[$i]['flr_length'] = strlen($flr_post);
      $url_array[$i++]['randlink_length'] = strlen($config['indexurl'] . $config['mod_rewrite_char'] . $randlink);
        } else {
        die('Error, omg');
         }

function isValidFLR check address hostname, preg_match (if it an url) and if it not in block list.

Problem is, that if user post like this(one address per line):

google.com
google.net
ksajdkljaskldjalsd.com

Script return’s that all of the address wrong. If user try post only one, ALL good, valid address script works great.

So, problem with this script or URL validation check may be ?

What’s your suggestion ?

EDIT:

function isValidFLR(&$flr_post,&$ip) {
preg_match_all("!://!",$flr_post,$matches);
  $match_count = count($matches[0]);
  if ($match_count>=2) {
    $flr_post = preg_replace("!(.+)://((.+)://(.+))!",'\2',$flr_post);
  }
  elseif ($match_count==0) $flr_post = 'http://'.$flr_post;
  if (!preg_match('!^(http|https|ftp)://[\w-]+\.[\w-]+(\S+)?$!i', $flr_post)) {
      //if (!preg_match('/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i', $flr)) {
    return 'wromg address: '.$flr_post;
  }
  else {
    $m = parse_url($flr_post);
    $hostname = strtolower($m['host']);
  }

  // is such host..
  if (preg_match('/^\d+\.\d+\.\d+\.\d+/', $hostname)) {
    $ip = $hostname;
  } else {
    $ip = gethostbyname($hostname);
    if ($ip===$hostname) 
    return 'host not found: '.$flr_post;
  }

  // does host not blocked..
  if (in_array($ip,getIPs_array())) {
    return 'host blocked: '.$flr_post;
  }
  return false;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:21:28+00:00Added an answer on May 25, 2026 at 12:21 pm

    You should split the input using ‘explode()‘, searching for “\n” then run the check on each of the lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a Bash script called foo.sh . I'd like to call
Let's say I am writing installation script for the program which contains executable file
Let's assume I have a main script, main.py, that imports another python file with
Let's imagine I have a bash script, where I call this: bash -c some_command
Let's say I wanted to make a python script interface with a site like
Let's say i have an image uploader script, i want to prevent the upload
I want to let server to invoke client ActiveX via javascript. The script work
I've written a Perl script using OpenGL . It calls glutMainLoop() to let the
How to create a database using T SQL script on a specified location? Let's
Google is failing me on this one. Let's say I have some ECMA script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.