Gossamer Forum
Home : Products : Links 2.0 : Customization :

Mod Idea - Auto Check for Duplicate URL

(Page 2 of 3)
> > > >
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
> > > >