Jump to content

Hi and help with duplicate link submission in PHP directory script


ArtphotoasiA

Recommended Posts

Hello there

 

Really new by in PHP,  I find out your forums and look really professional, so I'm dropping in some questions.

Maybe can have some help.

 

I'm setting an old  plugin of WP and got some issues.

The plugin is really nice and dedicated to create a directory inside a website in WP but regretfully no one take care of that code, so no one to ask for.

 

There are some errors.

 

Example, lets go with the first one.

 

When I (or someone) add a new website in the directory the script does not manage correctly a duplicate submissions. I can submit more times the same url.

 

It is supposed to manage that problem,  here is the code that take care of all the errors.

 

 

     


if($title == "" || $url == " " || $url == "http://" || $description == "" || $description == " " || $keyword == "" || $contact_name == "" || $contact_email == "" || !$cat_id)
  {
    if($title == "") 
      $error_msg .= "- " . 'Please insert the title of the website!' . " - <br />";
    if($url == " " || $url == "http://" ) 
      $error_msg .= "- " . 'Please insert the URL of the website!' . " - <br />";
    if(!$cat_id) 
      $error_msg .= "- " . 'Please select a category for the website!' . " - <br />";
    if($description == " ") 
      $error_msg .= "- " . 'Please write the description of the website!' . " - <br />";
if($description == "") 
      $error_msg .= "- " . 'Please write the description of the website!' . " - <br />";
    if($keyword == "") 
      $error_msg .= "- " . 'Please write the keywords of the website!' . " - <br />";
    if($contact_name == "") 
      $error_msg .= "- " . 'Please insert your name!' . " - <br />";
    if($contact_email == "") 
      $error_msg .= "- " . 'Please insert your email address!' . " - <br />";
  }
  else 
  {
    $link_id = $class_link->GetLinkId($cat_id, $url, $title);
    if ($link_id != "") 
    {
      $error_msg .= "- " . 'This link currently exist!' . " - <br /> ";
    }
  }

 

 

 

It is working fine for all the errors but NOT for the last one...  is not working, no message ""This link currently exist"" and no error come out after the submission that go in smoothly.

 

 

So here is the problem.... but can't solve it.

 

  }
  else 
  {
    $link_id = $class_link->GetLinkId($cat_id, $url, $title);
    if ($link_id != "") 
    {
      $error_msg .= "- " . 'This link currently exist!' . " - <br /> ";
    }
  }

 

 

 

Any idea?

 

Link to comment
Share on other sites

I got this one in another file that define the function 

 

 function GetLinkId($cat_id,$url,$title)
  {
    global $wpdb;
  
    $query = "select * from ".$wpdb->prefix."wpdir_link where category_id = '$cat_id' and url = '$url' and title = '$title'";
    $data = $wpdb->get_row($query);
  
    return $data->link_id;
  }

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.