Gossamer Forum
Home : Products : Links 2.0 : Customization :

Mod Idea - Auto Check for Duplicate URL

Quote Reply
Mod Idea - Auto Check for Duplicate URL
Hi,
I have been having a number of people submitting the same URL over and over to multiple categories (despite a "guidelines" page). I have Loony's multiple category mod installed, which makes it unnecessary to submit to multiple categories. However, I find it very inconvenient to have to click on "duplicate check" each time, and then have to delete the listing, which is not nice for those that submit either. An automatic duplicate check in add.cgi is my idea here (check in existing links and the validate database), to verify that the URL is not already listed, and giving an error message if it is. Any idea how this can be done? I'm not that familiar with Links at this time, even though I have written a few CGIs and have done a number of mods on my version of Links. But I'm sure this would be an interesting mod for many users, and I hope that someone who has more experience with Links can help with this. Thanks!
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
You would want to look at one of those modify.cgi security system things, but copy and paste it again to check the validate also.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
even if you managed to write such a script, it's not 100% proof. let's say i submit
htp://www.mysite.com
then i can submit http://mysite.com and you would not know it's a duplicate or
also some guys would try short url such as come.to fly.to and so on. i no longer accept such sites.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi Theguy,
Thanks for your input - well, it would then need a subroutine to check for http://www.site.com, http://site.com and http://(www.)site.com/index.htm(l) ... that part should not be so bad, and it should be possible to opt for disallowing known forwarders (I think I saw a mod for that somewhere). The main point is, it would help to reduce duplicate listings if they get stopped before the submission is even added to validate.db. Saves me from having to click on "duplicate check" for each new submission.
There will never be a 100% safe method, unless there is a way to compare the content of the page to be submitted with the contents of all pages listed in validate.db and in links.db - this would not be very practical unless it could be done in the background (via cron with notifcation to the webmaster via e-mail when duplicates are found). Not sure if this could be done and if it would be practical or too much load on the server.
As this would be much more difficult, I'd really like to see a simpler solution comparing the URL of the submission with the URLs in validate.db and links.db (with and without "www.") - I hope somebody can help me with this!
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi Bmxer,
I tried to search for that but came up with nothing that relates to my idea. If you can give me more details, I'd appreciate that. Thanks.
Greetings,
Gerrit
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
You would put something like this in
Code:
my ($key, $status, @values, $found);
local (%original);

# Make sure we have an ID, URL, and Email address for the resource to modify.
# If any are missing, return an error message to the submitter.
((!$in{'Current URL'}) or
(!$in{'LinkID'}) or
(!$in{'LinkContact'})) and &site_html_modify_failure (qq|<ul>
<li>Missing the ID, URL, or Contact Email address of the resource to modify
</ul>|) and return;

# Let's check to make sure the link we want to update is actually in the
# database and that the link ID and Contact Email address match what is
# specified in the submission form.
open (DB, "<$db_file_name") or
&cgierr("Error in validate_records. Unable to open $db_file_name. Reason: $!");
$found = 0;
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
# Check for matching record ID, URL, and Contact Email address.
# If everything matches, get the record, stop searching.
if (($data[0] eq $in{'LinkID'}) and
($data[$db_url] eq $in{'Current URL'}) and
($data[$db_contact_email] eq $in{'LinkContact'})) {
$in{$db_key} = $data[0];
$found = 1;
%original = &array_to_hash (0, @data);
last LINE;
}
}
close DB;
# If no matching record found, display error message to user
!$found and &site_html_modify_failure (qq|<ol>
<li>The requested Link URL was not found in the database.
<li>The requested Link URL does not match the database URL for the specified Link ID.
<li>The requested Link Contact Email address does not match the database Contact Email
address for the specified Link ID.
<li>The Link ID doesn't exist.
</ol>|) and return;

# Since we have a valid link, let's make sure the system fields are set to their
# proper values. We will simply copy over the original field values. This is to stop
# people from trying to modify system fields like number of hits, etc.
foreach $key (keys %add_system_fields) {
$in{$key} = $original{$key};
}
This is not my code.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi Bmxer,
Thanks, I'll try to adapt that to add.cgi and change it to kick out an error when the record IS found. Maybe I can get it to work.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Gerrit,
If you get it to work please post it here as I to am always getting multiple submissions in diffrent categories and it's a pain to manualy delete them.
thanks,
Lewis
www.atozfitness.com
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Awesome idea Gerrit.. Personally, im praying you pull it off.. Even if we are able to stop just a percentage of the cheaters, then its still worth it.. Its that much "less" work for us on a daily basis.

Please make sure to let us all know when its completed.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi lewisw and Conan,
Thank you for your support... I'm currently working on it.
First the good news: I have it so far to go that it checks for EXACTLY the same URL and kicks out an error if a duplicate is found (just as good as the duplicate checker included with Links) - however, I'm still working on the routine to fight the trick with including or not including www., a trailing slash, or index.htm(l) - i.e. it would be possible to submit
http://www.domain.com
http://www.domain.com/
http://www.domain.com/index.htm(l)http://domain.com
http://domain.com/
http://domain.com/index.htm(l)
I'll post the finished mod when I get done! Looks like this will be an easy one to install - only one set of code in one place!
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi everyone,
I think I may have the solution. I have tested this several times to the point where it appears to work just fine on my system. If you have any problems, let me know! This mod gives an error message if a duplicate URL is found in links.db or validate.db so we should, hopefully, no longer be flooded with duplicate listings. It not only ignores www., but also capitalization, and any index.htm or index.html, as well as trailing slash(/). More to ignore could be easily added. Here it is:

http://www.gossamer-threads.com/...rces/jump.cgi?ID=788

[to easier reflect changes and bug fixes, I now posted this on my site]

Let me know how it goes! If you have any suggestions or comments, please post them here!

[This message has been edited by Gerrit (edited November 24, 1999).]
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
let's say someone submit a site http://www.mysite.com under category a
then he comes back a minute later and submit the same site, does he get an error or not using your mod?
what i'm trying to say if the site is not validated, and he tries to submit it to adiffernt category, does he get an error or not?
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Gerrit!! "YOU ARE THE MAN"! The routine works great. We tried everything, and it stopped all.. Congrats...



By the way, since you seem to be pretty good at CGI, i need a alternative way of protecting my admin.cgi file, as htaccess does not seem to work on my server.. Any ideas?
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi TheGuy,
If someone just submitted
http://www.mysite.com
it gives an error if that person tries to submit any of these under any category:
http://www.mysite.com
http://www.mysite.com/
http://www.mysite.com/index.htm
http://www.mysite.com/index.html
http://mysite.com
http://mysite.com/
http://mysite.com/index.htm
http://mysite.com/index.html
That should cover just about all chances of duplicate URLs. What it will not do, is stop anyone adding something like
http://mysite.com/page1.html
but I don't think that should be necessary, at least I allow people to submit various sections of their sites to be submitted under various categories. I just don't want the same page to be listed more than once, and this should do it.
Greetings
Gerrit
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi Conan,
Thanks for the feedback! As far as I know, what would be needed is a password routine within the script. It won't be near as safe as .htaccess, but will reduce the chance of foul play.

I came up with something I pieced together to protect admin.cgi to a certain point - but be advised that this is a simple protection, and that I can see a way for those familiar with how Links works to circumvent this protection. I don't want to post the way to hack this here for obvious reasons.

http://204.180.41.204/links2mod2.htm

Let me know if this works for you.

Greetings
Gerrit

[This message has been edited by Gerrit (edited November 25, 1999).]
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Gerrit:

Great job, but something might be missing, or is it just an error from my side?

I've implemented the changes as you described. It works great for new submissions, but Links now returns "Duplicate URL error - already listed!" if I try to modify an existing link with the same URL as it had before.

If I change the link URL to a new, it's no problem modifying, but sometimes it might not be the URL that is changed, and then we're not able to update the link because the error message...

Any workaround for this?

Thanks!

Hugs
Nina

[This message has been edited by oktrg500 (edited November 24, 1999).]
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Thanks for pointing this out - I'll check and see if I have the same problem, and if so, I'll try to fix this and post the fix here.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Yihaa! 2 good news! :-)

1. It looks like the problem mentioned above wasn't an error from my side. First I thought that I had lost the things mentioned below during some copy/paste raids, but I checked the original package, and it looks like the same has to be added there too.

2. I think I have the solution.

I'm not using templates, and in my site_html.pl I had to do this:

In site_html_add_form
Find <input type="SUBMIT" value="Add Resource">
Change to <input type="SUBMIT" name="add_record" value="Add Resource">

In site_html_add_failure
Find <input type="SUBMIT" value="Add Resource">
Change to <input type="SUBMIT" name="add_record" value="Add Resource">

In site_html_modify_form
Find <input type="SUBMIT" value="Modify Resource">
Change to <input type="SUBMIT" name="modify_record" value="Modify Resource">

In site_html_modify_failure
Find <input type="SUBMIT" value="Modify Resource">
Change to <input type="SUBMIT" name="modify_record" value="Modify Resource">

I guess the same goes for the templates. Find the 4 add/failed, modify/failed templates and add name="add_record"/name="modify_record" to the submit button code.

Strange no one has mentioned this before, or had problems with it?

Anyway, great mod! Thanks Gerrit!
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
you are right, it's not your mistake, it's a bug. i only made changes to modify.html and modify_error.html and it worked fine for me.
i do not think you need to make changes to add.html and add_error.html. doing so may reverse what this mode does in the first place. check it out and let us know
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Great idea - however, since I (and maybe some others) have the password mod for modifying URLs, it didn't work for me - but with a few minor changes, it did:

Try this:

In site_html_add_form
Find
<input type="SUBMIT" value="Add Resource">

Change to
<input type="SUBMIT" name="add_record" value="Add Resource">

In site_html_add_failure
Find
<input type="SUBMIT" value="Add Resource">
Change to
<input type="SUBMIT" name="add_record" value="Add Resource">

and change in my mod (in site_html.pl) in the first line of the mod
unless ($rec{'modify_record'})
to
if ($rec{'add_record'})

That did the trick for me! Thanks for your help!


[This message has been edited by Gerrit (edited November 24, 1999).]
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Seems like a decent Mod, however, it does NOT work with the Add Confirmation Mod.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi Elliot,
Interesting - I wanted to add such confirmation, but since it was only for templates, what I found, I haven't taken the time to figure out how to adapt for non-templates. I'm sure there has to be a way to make it compatible - if someone could tell me how to add the confirmation (or where I can find a thread for it - search didn't help me) for non-templates, I can see about finding a way to make it compatible.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
If you ever have the time to update the documentation for us template users I would love to install this mod Smile
Great work and thanks for the contribution.
Lewis
www.atozfitness.com
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
i really do not understand why you guys are making changes to site_html_add_form and
site_html_add_failure
you only need to make chnages to modify forms
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi TheGuy,
I know that there are two ways, and changing only the modify part would work if it wasn't for the password mod for modifying, which makes it more difficult. This seemed easier to me - if you have a better idea, let us know! Thanks!
Greetings
Gerrit

P.S.: An updated version with the changes marked in red for those that already use the mod has been posted here: http://www.gossamer-threads.com/...rces/jump.cgi?ID=788

[This message has been edited by Gerrit (edited November 25, 1999).]
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
i'm using templates and there is not much difference. step1 is the same
step2 you just make changes to add.html, add_error.html, modify.html, modify_error.html in the templates.
depending on what other modes you are using, you may not need to make changes add.html and add_error.html
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Has anyone ever tried to use this on a template version? I wouldn't know why it should not work with templates... since I do without templates, I cannot test it though... As far as I can tell, you would just have to make the changes to add.html and add_error.html, instead of site_html.pl:
change
<input type="SUBMIT" value="Add Resource">
to
<input type="SUBMIT" name="add_record" value="Add Resource">
in both templates.
The rest should be the same as for non-templates. If someone could test this, that would be great, so we can have this for any user.

For those using the ADD CONFIRM mod, try to replace in db_utils.pl in the Auto Duplicate Check mod (the first thing in the mod):
if ($rec{'add_record'})
with:
if ($rec{'process_form'})
and also use process_form instead of add_record where ever it is used in the mod, i.e. the modification to links_html.pl or where indicated right above for template users. This might fix the incompatibility, from what I saw in the mod. Since I haven't been able to try it, because I haven't adapted the ADD CONFIRM mod to non-templates, I can only guess here but it should - in theory - work this way.

It would be appreciated if someone could try this and let us all know here if this fixes it for templates and/or users with the add confirm mod.

Greetings
Gerrit

[This message has been edited by Gerrit (edited November 25, 1999).]
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
If using Templates/Confirmation,

1. On add.html and add_error.html, use:
Code:
<input type="SUBMIT" value="SUBMIT" name="process_form">

2. On modify.html and modify_error.html, use:
Code:
<input type="SUBMIT" value="SUBMIT" name="modify_record">

3. In db_utils.pl, use:
Code:
if ($rec{'process_form'}) { # don't need to worry about duplicate if modifying (unless, however, URL is changed!)
$testURL = $in{'URL'};
$testURL =~ tr/A-Z/a-z/;
$testURL =~ s/www\.//; # disregards www.
$testURL =~ s/\///g; # ignores slashes
$testURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
open (DB, "<$db_file_name") or &cgierr("error in validate_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already listed!");} # so let's add it as an error
}
close DB;
open (DB, "<$db_valid_name") or &cgierr("error in validate_records. unable to open db file: $db_valid_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already submitted!");} # so let's add it as an error
}
close DB;
}

So far, this is working okay for me. I use templates/confirmation. I've run the gamut of add, add_error, add_confirm, add_success, and modify, modify_error, modify_success, and it worked okay. Everything was either added, modified, or blocked correctly.

The wrinkle with modify.html/modify_error.html (name="modify_record") , as mentioned above by oktrg500 (Nina), should be added to the author's site.

Thanks for this mod!

Hope this helps.

------------------
ARMYNAVY.COM
MilitarySurplus Ring



[This message has been edited by TrainedMonkey (edited November 30, 1999).]
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
this mode got a bug. try modifying multiple links at the same time and most of your data will be deleted. luckily i had a backup copy.
check my post here:

http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/004140.html
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi TrainedMonkey,
Thank you for your contribution. I'm glad to hear that it works fine for templates and the confirm mod. I don't know why it is needed to make any changes to the modification part, the modify.html and modify_error.html or, if not using templates, in the sub site_html_modify_form or sub site_html_modify_failure (the name="modify_record" part). This mod version has nothing to do with modifying, just with adding, thus with the newer version of it, there should be no need to make the changes to the modify part - I didn't and have no problems with it! The mod is only called when we have add_record (or process_form, if using the confirm mod). Thus, it should not be needed to add the name="modify_record" part, IMHO - let me know if it is not so! Greetings,
Gerrit

P.S.: Some day I'd like to add a part for checking when modifying as well - would have to find a way to exclude the current record for checking for duplicates! Haven't had time to try to implement this yet. Then, the name="modify_record" would definitely be needed.
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
I did only single modifies. I'll try multiples and get back to you.


------------------
ARMYNAVY.COM
MilitarySurplus Ring





Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
 
Gerrit, I have a odd problem here, that i dont know how to correct.

Everytime i try to Modify a listing from within the site, i get the error:

There were the following errors trying to modify your resource:

Category (Can not be left blank)

It seems that i dont even have the option of changing my category. The screen shows the category my link is presently sitting in, but allows me to change everything EXCEPT the category.

How can i fix this please?

Conan


Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
BTW, for informations sake, i like the fact that my script is not allowing people to change their CATEGORY.. I have several categories, and approve sites only after confirming that they indeed belong in a certain category.. I really hate it when they take it upon themselves to move their link to a new (UN-RELATED) category..

So if at all possible, i would like to keep things like that.. But i need it to REMEMBER this info, so when the user is on the "modify.html" page, and clicks on the MODIFY RESOURCE button, the script will know that his current category is the category he is supposed to be in..

(did i make any sense?)

Thanks for any help...

Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Same type of problem related to the add/confirmation screens when trying to add a new site. I used the codes that TrainedMonkey so kindly provided, and when I add the site, I get a drop-down menu for the Category field.

Oh well.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Adding a site is no problem, its MODIFYING it that is the problem....

------------------
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
I wish I knew more to help you, Eliot. You've been so helpful to me. You can go to my Add URL page and try this thing to see if it helps you. The code that I posted does seem to work all right, but I haven't tried multiple modifies, as mentioned by theguy.

Maybe this is the difference: I have links.cfg set so that:
Code:
# Should your add.cgi automatically select what category the user
# is adding his link into?
$db_single_category = 0;

I have absolutely no idea if this makes any difference. It's just a thought.

If you'd like to look at my Add URL page, try http://www.armynavy.com/cgi-bin/links/add.cgi , then try adding http://www.armynavygame.com. You should be sent to the error page with a Duplicate URL message.

For anyone trying this, please Do Not click thru to Submit - just go to the Confirm page and then hit the Back button. The listing that I provided is a Real Listing and this is my Real Links Site.

If I can figure out anything else, I'll let you know. I still have to try the multiple modify for probs. And thank you for all of your help.

HTH


------------------
ARMYNAVY.COM
MilitarySurplus Ring





Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
This is strange - I just tried to modify a site from the on-line site screen that users would use, and I had no problem modifying the category. Also, I've had plenty of additions since I added my mod, thus adding and modifying works just fine on my version.
Re: Multiple Links modifications ( http://www.gossamer-threads.com/...um3/HTML/004140.html ) - I have to say I'm puzzled - are you using the first version, or the newer one (with the change in the first line, changing
unless ($rec{'modify_record'})
to
if ($rec{'add_record'})
in theory - when you make any modifications, single or mulitple, the mod shouldn't even be called, thus I cannot understand why it would cause trouble. It is only called when adding records, as "if ($rec{'add_record'})" states. It could be that it is still an incompatibility with the confirm mod and that changing "if ($rec{'add_record'})" to "if ($rec{'process_form'})" causes the problem. Not sure, maybe someone who uses the same configuration as you are (the template version with the add confirm mod) could help here!
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Im assuming that my:
modify.html & modify_error.html

need this line:

<input type="SUBMIT" value="SUBMIT" name="modify_record">

I am however not sure where its supposed to be place.

Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
I am not using the Add Confirm mod..

I was using your original mod, and just tonight tried to replace it using your new one hoping that would correct the prob.. It didnt, but i dont think its a prob with your script. I think that something got messed up somewhere. or removed on accident.. So on the MODIFY RESOURCE page, when your modifying your acccount, any ideas what the correct code should be to get the drop-down menu for the categories?

heres is the exact url so you can see what its doing:

Here, so you can see whats going on, try to modify the description of this account:

ACCOUNT #588 PASSWORD: test

http://www.sexual-linkage.com/cgibin/links/modify.cgi

Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
i'm using the first version. should i change unless to if? does it make a difference?

i'm talking about modifying links from the admin section where you click modify from the left menue then you have a form to fill
let's say you want to modify 2 links in category1 so you choose category1, assuming you have more than 1 link in category1
and at the end you have
Modify Multiple at Once: choose it to modify more than one link at the same time
after that you will get at least 2 links to modify, check at least 2 links and click modify and see if you did indeed modify both records.

p.s. backup your data before you do this!!!
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
according to your page: you need to make changes db_utils.pl & add.html and add_error.html

but according to what you said in this forum:
db_utils.pl & modify.html & modify_error.html

i did make the changes to db_utils.pl to the newest version and i think that's what causing my problems.

i already made changes to modify.html and modify_errror.html so anyone can modify his link without changing the url

anyway i still having problems modifying multiple links from the admin section
the script will simply delete the second link i'm trying to modify and all the links that have bigger id #
but if i use the original copy of db_utils.pl
i have no problems.

i'm very sure it's a bug with this mode.
have you tried to modify multiple links from the admin section? please try it and see for yourself. BACKUP YOUR DATA
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
i take that back
the new version fixed the problem
as it tuned out i uploaded the new version to the wrong category Smile

i'm not using the confirmation page mode

i like to know if the chnages need to be made
add.html & add_error.html or
modify.html & modify_error.html

someone sugested for all
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
This Mode is bug free.
just use the latest edition of the mode and you will have NO PROBLEMS!!!

i tested it several times and it's working fine
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi theguy,
Oops, trying to reply quickly made me goof up... you're right, it's supposed to be that the changes are to be made to
add.html & add_error.html, NOT
modify.html & modify_error.html, as far as I can tell nothing should be changed there - this mod (so far) "only" prevents duplicate ADDITIONS, not modifications.
I'm really glad it's working just fine for you now! Thanks for the feedback!
Greetings, Gerrit
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
thank you very much. you been a great help!!!

i wish you could help me with translation mode.

check this thread if you like to try

http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/003265.html
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi Conan,
Okay, now I understand your problem - no, it doesn't look like it could be a result of my mod, like you suspect. I'll e-mail you to see if I can help.

Hi theguy,
I think it would really be much safer to switch to the newer version - there are only a few changes you need to make, then this mod can't mess you up with anything else, because it will only be called when someone tries to add a site, thus there should be no problems with modifying anywhere. In my post here posted 11-24-99 11:24 PM PST, you can find the modifications if using no templates, when using templates, go to modify.html and modify_error.html and make the changes there (not additions here, but changes - if in doubt, see http://204.180.41.204/links2mod1.htm
for more details, I had marked the changes to the original in red for easier upgrading. I hope this helps!
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
I use an image as a submit button:

<input type="image" src="http://www.marketuplinks.com/submit.gif" height="24" width="93" border=0 alt="Submit" name="add_record">

And have added the name="add_record" part but it doesn't work. Using a normal submit button does though. How can I use the image submit button with this mod?

Thanks
Shane

Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
It appears that the "name" tag does not work in type="image" buttons. The workaround I suggest would be this:
<input type="image" src="http://www.marketuplinks.com/submit.gif" height="24" width="93" border=0 alt="Submit"><input type="hidden" name="add_record" value="true">
I tried that and it worked for me.
Greetings, Gerrit
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Thanks Gerrit, works just fine now Smile


Shane
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
I added 3 mod success: 3 New /Update graphics mod +Add confirm mod+Automatic Duplicate URL Check.


see the Modify mod at;
http://www.gossamer-threads.com/scripts/forum/resources/Forum11/HTML/001661.html

I have changed in modify.html/modify_error.htmlmodify_confirm.html;
<input type="SUBMIT" value="Modify Resource">
read to:
<input type="SUBMIT" name="process_form" value="Modify Resource">
And have changed in
add.html/add_error.html/
add_confirm.html
;
<input type="SUBMIT" value="Add resource">
read to:
<input type="SUBMIT" name="process_form" value="Add resource">
I got the message "Link duplicate"

How come!any mistake



------------------
okbee
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Yes...act...

You need to use the following submit field in the modify.html file:

Code:
<input type="SUBMIT" name="submit_form" value="Modify Resource">

Then in the modify_error.html file, use the following submit field:

Code:
<input type="SUBMIT" name="submit_form" value="Modify Resource">

Then in the modify_confirm.html file, use the following submit field:

Code:
<input type="SUBMIT" name="process_form" value="Modify Resource">

Get it? I hope.

Wink

Regards,

------------------
Eliot Lee....
* Check Resource Center
* Search Forums

Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Just a note to say thanks to Gerrit. Hope this lowers my stress level.

------------------
Will
Webmaster
FishHoo! Search index for Fishermen
www.fishhoo.com
Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
Hi!
any idea with this error
CGI ERROR
==========================================
Error Message : fatal error: Undefined subroutine &main::site_html_add_failure called at /cgi-bin/links/add.cgi line 102.

any help would be great..this error i get when i szubmitt a site that is already in DB

gregor


Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
hey everyone her is an idea from a previous mod:


Step 1



In db_utils.pl, at sub validate_record, right below this:

if ($rec{'add_record'}) { # don't need to worry about duplicate key if modifying
open (DB, "<$db_file_name") or &cgierr("error in validate_records. unable to open db file:$db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
($data[$db_key_pos] eq $rec{$db_key}) and return "duplicate key error";
}
close DB;
}

add this:

if ($rec{'add_record'}) { # don't need to worry about duplicate if modifying (unless, however, URL is changed!)
$testURL = $in{'URL'};
$testURL =~ tr/A-Z/a-z/;
$testURL =~ s/www\.//; # disregards www.
$testURL =~ s/\///g; # ignores slashes
$testURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
open (DB, "<$db_file_name") or &cgierr("error in validate_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already listed!");} # so let's add it as an error
}
close DB;
open (DB, "<$db_valid_name") or &cgierr("error in validate_records. unable to open db file: $db_valid_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already submitted!");} # so let's add it as an error
}
close DB;
}

Step 2a (for most users - skip this only if you use images for buttons)



If you don't use templates

In links_html.pl, at sub site_html_add_form, find:

<input type="SUBMIT" value="Add Resource">

change to:

<input type="SUBMIT" name="add_record" value="Add Resource">

at sub site_html_add_failure, find:

<input type="SUBMIT" value="Add Resource">

change to:

<input type="SUBMIT" name="add_record" value="Add Resource">



If you use templates

In both add.html and add_error.html, find:

<input type="SUBMIT" value="Add Resource">

change to:

<input type="SUBMIT" name="add_record" value="Add Resource">



Step 2b (only if you use images for buttons, skip otherwise)



If you use images for buttons (templates version):

in both add.html and add_error.html, find: (/images/submit.gif should be what you have for image path, and height="25" width="100" for your image's dimensions)

<input type="image" src="/images/submit.gif" height="25" width="100" border=0 alt="Submit">

add this right below or behind:

<input type="hidden" name="add_record" value="true">



If you use images for buttons (non-templates version):

In links_html.pl, in both sub site_html_add_form, and sub site_html_add_failure, find: (/images/submit.gif should be what you have for image path, and height="25" width="100" for your image's dimensions)

<input type="image" src="/images/submit.gif" height="25" width="100" border=0 alt="Submit">

add this right below or behind:

<input type="hidden" name="add_record" value="true">



Step 3



Save, upload, and you should be safe from most duplicate URL submissions.



Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
hi!
i think i found a bug..or i hope just my fault.
when i submit a site that is already in links it gives me add_error.html. so far ok...so this means he found in db so till here everything works...then i have chance to change the information submitted and resubmit. Aha here comes my problems. If i don't change anything and resubmit...THE SITE IS ADDED!
is this a bug or my fault..hope my :)

bye
thanx
gregor

Quote Reply
Re: Mod Idea - Auto Check for Duplicate URL In reply to
I have installed this mod and it is great , except that on my site I have quite a few entries that don't have URLS, how would I modify it so that it would allow these. Currently it considers them to be duplicates.

Thanks

Rob



Quote Reply
Re: [RobL] Mod Idea - Auto Check for Duplicate URL In reply to
Where in db_utils.pl do you insert the code?




***************************************************************
Add your site to my directory at XEVA Links.
***************************************************************
Quote Reply
Re: [PynApple] Mod Idea - Auto Check for Duplicate URL In reply to
It shows you where in the post above:
http://www.gossamer-threads.com/...i?post=107538#107538


Leonard
aka PerlFlunkie