ArtphotoasiA Posted March 3, 2012 Share Posted March 3, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/258193-hi-and-help-with-duplicate-link-submission-in-php-directory-script/ Share on other sites More sharing options...
QuickOldCar Posted March 3, 2012 Share Posted March 3, 2012 You don't provide enough of the code for the part that creates and inserts the $link_id . You are just showing the error message if it's blank value. Which plugin are you using? Quote Link to comment https://forums.phpfreaks.com/topic/258193-hi-and-help-with-duplicate-link-submission-in-php-directory-script/#findComment-1323518 Share on other sites More sharing options...
ArtphotoasiA Posted March 3, 2012 Author Share Posted March 3, 2012 I understand what you mean. The plugin is called wpdir But no idea how can find the right place and code for $link_id Quote Link to comment https://forums.phpfreaks.com/topic/258193-hi-and-help-with-duplicate-link-submission-in-php-directory-script/#findComment-1323537 Share on other sites More sharing options...
ArtphotoasiA Posted March 3, 2012 Author Share Posted March 3, 2012 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; } Quote Link to comment https://forums.phpfreaks.com/topic/258193-hi-and-help-with-duplicate-link-submission-in-php-directory-script/#findComment-1323543 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.