Gossamer Forum
Home : Products : Links 2.0 : Customization :

Rate.cgi - fails to use error page...

Quote Reply
Rate.cgi - fails to use error page...
I noticed a glitch on my site, so I checked out a few other links2 sites and found the same problem:

When a site is rated via rate.cgi, if --- is selected instead of a number, the rate_error page does not come up; instead the rate page is reloaded (minus the ?ID=23 or whatever number). Has anyone else noticed this, and/or fixed it?

As far as I can tell, I didn;t change anything that would affect the rate.cgi. The cgi is unchanged, the form is the same as stock, and site_html_templates is fine.

Frown


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Rate.cgi - fails to use error page... In reply to
I'm not sure this is a bug. In rate.html, you could try;

Code:
<%if rate eq "---"%>
Error: Please rate the link !!
<%endif%>

NB: This is untested =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Rate.cgi - fails to use error page... In reply to
I have been using Links2 for several years, but I never used the Rate feature; a new site I am setting up will use it, which led to this "discovery".
Here is the code from rate.cgi that would seem to be where a rating of --- would be invalid:


my $rating = $in{'rate'};
# Make sure we have a valid rating.
unless (($rating =~ /^\d\d?/) and ($rating >= 1) and ($rating <= 10)) {
&site_html_rate_failure ("Your rating '$rating' is invalid.");
return;
}

Isn't that saying that the input 'rate' should match a number between 1 and 10, and if it is not, that the error page should be displayed? 'Rate' is the name of the select field, which only offers the choice of --- (default) and 1-10.

I changed the rate form to include the value of each option:


<form
action="<%db_cgi_url%>/rate.cgi"
method="post">
<input
type="hidden"
name="ID"
value="<%ID%>" />
<select
name="rate">
<option value="---">
---
</option>
<option value="1">
1
</option>

<option value="10">
10
</option>
</select> <input
type="submit"
value="Rate this Link" />
</form>

I'll look at this a bit more this morning, hopefully the answer will reveal itself. Unsure


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Rate.cgi - fails to use error page... In reply to
No luck yet. I even changed the code to do this:

if ($rating eq '---') {
&site_html_rate_failure ("Your rating '$rating' is invalid.");
return;
}

...and put the rest in an 'else' statement. I can add a rate just fine, but if I select '---' i still get no error page.

Oh well... Unsure


Leonard
aka PerlFlunkie