Gossamer Forum
Skip to Content


Home : Plugins Support - FREE : Recommend_It & Recommend_It_Stats :

error in new recommend-it plug

Quote Reply
error in new recommend-it plug
Hi,
When I use this plug I get the following error after submiting the form. I am using the newest version of the plug 3.0.1

Software error:Column SentList cannot be left blank at recommend_it.cgi line 167.
Quote Reply
Re: [tkporcel] error in new recommend-it plug In reply to
Do wuestions in this forum get answered or should I ask in the GT forum?
Quote Reply
Re: [tkporcel] error in new recommend-it plug In reply to
Andy usually answers the questions very quickly- something must be wrong at the moment because there is no word for him.
Quote Reply
Re: [scottish] error in new recommend-it plug In reply to
Andy, or anyone else can you please help me out with this?
Quote Reply
Re: [tkporcel] error in new recommend-it plug In reply to
Best thing to do is ask on the GT forums.
Quote Reply
Re: [scottish] error in new recommend-it plug In reply to
I did it's been sitting there unanswered for 2 days
Quote Reply
Re: [tkporcel] error in new recommend-it plug In reply to
Hi,

What happens if you change recommend_it.cgi,, the main() routine, so it looks like;


Code
sub main {  

# Define the variables
# ---------------------------------------------------
my ($id, $db_links, $rec, $SendList);

# only ask them to login if the admin has set this to 'Yes' in the setup...
if ($RequireLogin == 1) {
if (!$USER) {
print $IN->redirect( Links::redirect_login_url ('add') );
exit;
}
}

# print our header now, as we are safe to print content to the browser..
print $IN->header();

# Get the Links ID number from the input.
$id = $IN->param('ID');

# check to see if an ID was submitted and that it was numeric
if (!(defined $id) or !($id =~ /^\d+$/)) {

print Links::SiteHTML::display('error', {error => "Invalid id: $id"});
exit;
}

# Check to see if the ID/Link record exists
$db_links = $DB->table('Links'); # first grab a new db handle

$rec = $db_links->get ($id); # see if the ID record exists

# show an error if the link they are trying to refer is not valid...
if (!$rec) {
print Links::SiteHTML::display ('error', { error => Links::language ('JUMP_INVALIDID', $id) });
exit;
}

# pass the script URL, so we can access this tag in the templates etc....
$rec->{'ScriptURL'} = $REC_CFG->{'ScriptURL'};


# now lets decide if we want to show the form, or actually do the sending...
# here we show the form
if (!$IN->param('action')) {

print Links::SiteHTML::display('recommend_it_form', $rec);
exit;

# and down here is where the magic goes on , and the emails etc are sent...
} else {

# work out how many people we should be sending too...
my $number_of_users = $IN->param('number_of_fields');

for (my $i = 1; $i <= $number_of_users; $i++) {

# skip this record if they don't need to be sent too...
if (!$IN->param("recipemail_$i")) { next; }

# first of all, lets check how valid the email address is...
if (!$IN->param("recipemail_$i") || valid_address($IN->param("recipemail_$i")) == 0) {
$rec->{'error'} .= "The email address for person $i doesn't seem to be valid....";
print Links::SiteHTML::display('recommend_it_form', { %$rec, %$IN });
exit;
}

# now lets check how valid the name is...
if (!$IN->param("recipname_$i") || length($IN->param("recipname_$i")) < 3) {
$rec->{'error'} .= "The name you entered for person $i doesn't seem to be valid (or is empty)....";
print Links::SiteHTML::display('recommend_it_form', { %$rec, %$IN });
exit;
}

# get the list ready, so we can put it in the stats table...
$SendList .= $IN->param("recipname_$i") . " - " . $IN->param("recipemail_$i") . "<BR>";

#print "Would have sent to " . $IN->param("recipname_$i") . "(" . $IN->param("recipemail_$i") . ") <BR>";

}

# now lets check how valid the name is...
if (!$IN->param("sendername") || length($IN->param("sendername")) < 3) {
$rec->{'error'} .= "The name you entered for yourslef doesn't seem to be valid (or is empty)....";
print Links::SiteHTML::display('recommend_it_form', { %$rec, %$IN });
exit;
}

# first of all, lets check how valid the email address is...
if (!$IN->param("senderemail") || valid_address($IN->param("senderemail")) == 0) {
$rec->{'error'} .= "The email address you entered for yourself, doesn't seem to be valid....";
print Links::SiteHTML::display('recommend_it_form', { %$rec, %$IN });
exit;
}

# get the date, so we can track stuff...
use GT::Date;
my $now_time = GT::Date::date_get();

if (length $SendList < 5) {
$rec->{'error'} .= "You don't seem to have entered any valid addresses to send to!";
print Links::SiteHTML::display('recommend_it_form', { %$rec, %$IN });
exit;
}

$db_links->update( { 'Recommend_Count' => \"Recommend_Count + 1" }, { ID => $IN->param('ID') } ) || die $GT::SQL::error;

my $stats_hash;
$stats_hash->{'IP'} = $ENV{'REMOTE_ADDR'};
$stats_hash->{'SenderEmail'} = $IN->param("senderemail");
$stats_hash->{'SenderName'} = $IN->param("sendername");
$stats_hash->{'SentList'} = $SendList;
$stats_hash->{'Date'} = $now_time;

$DB->table('Rec_Stats')->add( $stats_hash ) || die $GT::SQL::error;

# now we need to actually send the emails....
&do_sending;

# print out the success template...
print Links::SiteHTML::display('recommend_it_sent', { %$rec, %$IN, $SendList });

}



} # end the 'main' sub routine...


Cheers
Andy
Programmer/Designer/LinksSQL Freak Cool

http://www.ultranerds.com
http://www.imagesql.com