Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Two links with the same ID (repost)

Quote Reply
Two links with the same ID (repost)
I posted this a week or so ago and got no response so I thought I'd give it another shot. It seems that if one user starts to add a link while you are adding a link at the same time, you may both end up with the same ID number. If you don't watch out for this, you will have two links pointing to the same place from the directory. It would seem logical that this is would be an easy thing to prevent by just incrementing the count when the person goes to add the link, rather than after he actually submits it. Numbers are cheap, so even if it doesn't get used, it wouldn't matter. Has anybody else ran into this, or have a fix?

Daniel Alexander
Quote Reply
Re: Two links with the same ID (repost) In reply to
 
Quote:
It would seem logical that this is would be an easy thing to prevent by just incrementing the count when the person goes to add the link, rather than after he actually submits it.

Think about it. How would the script know that a user is submitting a site before he actually submits it? If the script doesn't know, how would it increment the count? Smile
Quote Reply
Re: Two links with the same ID (repost) In reply to
Whenever somebody clicks on the "add site" and calls the add.cgi, could it not go ahead and increment the count then? Even if the person backs out and doesn't submit the link, so what? The ID number just wont be used. I assume it doesn't do this now until the person actually submits it. So, if one person starts to add a link, and your in the admin panel adding a link before he hits submit, you have two links with the same ID. Just seems like something that would be an easy fix. Make sense?
Quote Reply
Re: Two links with the same ID (repost) In reply to
Yeah. That makes sense. Ignore my previous post.
Quote Reply
Re: Two links with the same ID (repost) In reply to
I think I have a better solution.

When you add a site to an ID that already exists on the admin side, it should say, "Warning! This ID already exists. Are you sure you want to overwrite?"

Then, if someone submits it site while you are adding a site, you will get this warning when you validate the submission.

What do you think? If you think this would work, perhaps we should move this to the Links Modifications forum.

[This message has been edited by t_dog (edited July 24, 1999).]
Quote Reply
Re: Two links with the same ID (repost) In reply to
Yeah that would be ok too. My main concern is that I am made aware that this has happened so I can correct it rather than have it slip thru the system. It happened to me and I don't get near the hits some of the others here do I'm sure. If it would just reject the submission from the admin panel with an error like that where you could simply just change the number it would serve the same purpose I think.

Actually... now that I think about it, the problem was most likely that I was adding a link from the admin panel and somebody on my site added a link before I hit submit. Because I already had an ID number stuck in my form, that actually hadn't been used yet, the user just beat me to the punch.

[This message has been edited by vewdew (edited July 24, 1999).]
Quote Reply
Re: Two links with the same ID (repost) In reply to
 
Quote:
Actually... now that I think about it, the problem was most likely that I was adding a link from the admin panel and somebody on my site added a link before I hit submit. Because I already had an ID number stuck in my form, that actually hadn't been used yet, the user just beat me to the punch.

But you still have to validate that link, correct? Since you already added a link with that ID, when you validate, you will get the warning. Then you will just hit the [Back] button and change the ID.
Quote Reply
Re: Two links with the same ID (repost) In reply to
Can't remember exactly cuz I've slept (several times) since then. Smile But yeah, if it would just warn me that the ID was already used, I could back up and correct it and not have to worry about it happening and me not catching it. The only way I found out in this instance was when the user got his confirmation email, he went and tried his link and it sent him to the wrong site (hehe). Your idea seems like a simple solution.
Quote Reply
Re: Two links with the same ID (repost) In reply to
Alright. I'm going to open a thread in the Links Modification forum, 'cause I don't know Perl, so even though this sounds simple, I can't do it. Smile
Quote Reply
Re: Two links with the same ID (repost) In reply to
Nah I'm Perl illiterate. Smile

I do all of my own custom CGI work in TCL because it's the only language I'm good at.
Quote Reply
Re: Two links with the same ID (repost) In reply to
This discussion has been moved to the Links Modification forum.

http://www.gossamer-threads.com/...um3/HTML/002441.html