Gossamer Forum
Home : Products : Links 2.0 : Customization :

How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help..

Quote Reply
How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help..
Links 2.0 NO TEMPLATES
-------------------------
Hello there!

Something should be done and save our time may be.... I have an idea but I dont know perl that much... * I M SORRY *...

Is there anyway or an idea already done... that the script will NOT allow people to submit their sites in the TOP or MAIN categories??? and they are required to click on the category such as:

Quote:
Entertainment/Movies/Actors

Which they don't need to choose the category for their submission but instead it shows up as they click Entertainment then Movies , then Actor and they click on ADD Resource right in where they are as Entertainment/Movie/Actor and the script set as it. so the people dont have to pick where they want the URL under which category... Because there are SO much categories that they are lazy to scrolling down and pick an appropriate one...

any brigh idea? or impossible...

Thank you VERY much!

------------------
WebKing
WebKing@trisoft.net
http://www.trisoft.net
My ICQ # 25356171
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
Alex,

Wouldn't it be easier just to prohibit adding to any category that contains a "/" character? If it has one, then it is not the top/main category. Wouldn't this work as well?

if ($in{'Category'} !~ "/") {
&html_add_failure ("You must choose a more specific topic!");
return;
}

[This message has been edited by Bobsie (edited April 06, 1999).]
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
Oops, I misread the question, I thought he didn't want posts to Entertainment/Movies/Actors, but to something more specific. Wink

Yes, if you just want to ban top level additions, go with what Bobsie posted. If you want to ban level 1 - level n additions, go with what I posted.

Cheers,

Alex
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
You could set a minimum depth with the following:

my $min_depth = 2;
my ($depth) = $in{'Category'} =~ tr,/,/,;
if ($depth <= $min_depth) {
&html_add_failure ("You must choose a more specific topic!");
return;
}

Add this just before:

# This will set system fields like Validated to their proper values.

in add.cgi (around line 88). This is untested, but should work. All it does is count the / in the category name to make sure you are a ceartain depth down.

Hope this helps,

Alex
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
Both Codes Are SERVER ERROR. Please go to
http://www.viet-usa.com/search
and test please... try to add it...

BOLD is where the codes inserted.

This is Alex Codes for ADD.cgi:
Quote:
sub process_form {
# --------------------------------------------------------
my ($key, $status, $line, $output);

# Check the referer.
if (@db_referers and $ENV{'HTTP_REFERER'}) {
$found = 0;
foreach (@db_referers) {
$ENV{'HTTP_REFERER'} =~ /$_/i and $found++ and last;
}
if (!$found) {
&site_html_add_failure ("Auto submission is not allowed in this directory. Please visit the site to add your entry.");
return;
}
}

my $min_depth = 2;
my ($depth) = $in{'Category'} =~ tr,/,/,;
if ($depth <= $min_depth) {
&html_add_failure ("You must choose a more specific topic!");
return;
}


# This will set system fields like Validated to their proper values.
foreach $key (keys %add_system_fields) {
$in{$key} = $add_system_fields{$key};
}




The Bold Section is Bobsie Codes:

Quote:
sub process_form {
# --------------------------------------------------------
my ($key, $status, $line, $output);

# Check the referer.
if (@db_referers and $ENV{'HTTP_REFERER'}) {
$found = 0;
foreach (@db_referers) {
$ENV{'HTTP_REFERER'} =~ /$_/i and $found++ and last;
}
if (!$found) {
&site_html_add_failure ("Auto submission is not allowed in this directory. Please visit the site to add your entry.");
return;
}
}

if ($in{'Category'} !~ "/") {
&html_add_failure ("You must choose a more specific topic!");
return;
}


# This will set system fields like Validated to their proper values.
foreach $key (keys %add_system_fields) {
$in{$key} = $add_system_fields{$key};
}


------------------
WebKing
WebKing@trisoft.net
http://www.trisoft.net
My ICQ # 25356171
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
Webking,

Change that &html_add_failure

TO

&site_html_add_failure
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
THANKS to SOc.

You the GREATEST!...

Thanks again!..

Thanks to Alex & Bobsie for their Codes!


Thanks all!


------------------
WebKing
WebKing@trisoft.net
http://www.trisoft.net
My ICQ # 25356171
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
There's still a problem with that:

The problem with that is that once reported to select a different category, you don't have the option to choose a different category, since it gets "fixed" by Links, and this may cause confussion to the user.

How can this be fixed then?

I got another problem.

Say I have the following:

Africa
Africa/Congo
NorthAmerica
NorthAmerica/Mexico
NorthAmerica/USA
NorthAmerica/USA/Alabama

I want people to be able to submit links to Africa/Congo and NorthAmerica/Mexico and NorthAmerica/USA/Alabama BUT ban people from submitting links to NorthAmerica, Africa and NorthAmerica/USA.

NorthAmerica/USA contains a / so Bobsie solution would not be accurate, neither ALex one, since depthness detection would be variable in this case.

Please advice!

Thanks.


------------------
Alex Tutusaus
Atyc WebDesigns
http://www.webcamworld.com/
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
I already checked it out. but it is not exactly what i want.
I have another script that i am using same categories.db.
The solution was something like below;

With this source code the top categories are not printed at selection menu.

Please, tell me where can i input or modify the following code.


print "<OPTION>--select one--\n";
for ($i=0;$i<$sizelines;$i++) {
($f1, $category, $f2, $f3, $f4, $f5, $f6, $f7) = split ('\|', $lines[$i]);
if ($category =~ /\//) {print "<OPTION>$category\n";}
}
print "</SELECT>";
Quote Reply
Re: How Do You Modify ADD.cgi so they are not allow to add to the Category?? Help.. In reply to
I had to deal with a problem like this awhile back. To make it even more challenging. I had over 2,000 2nd level SubCategories. I knew with the averge attention span of the everyday web surfer .. there was no way I would be able to get anyone to scroll through 2,000 choices. Lucky for me I only had to go one level deep.

So this is what I did, it was a bit of work but it came out nice and clean.

I created a pre-add page and added URL links to seperate Category Add Pages, 30 in all. Then from there I allowed them to input subcategory via a pull-down menu which only displayed the SubCategory name (no category/subcategory).

But in the value for the Subcategory name I did the "category/subcategory" thing.

Creating everything was like painting a house across the street from my front porch with a squirt gun, but it came out very nice and clean.Another benifit it gave me was more pages to submit to the search engines. ... wait is that a good thing or a bad thing Smile

for what it's worth,
Jeff