Gossamer Forum
Home : Products : Links 2.0 : Customization :

TELL YA FRIEND!

Quote Reply
TELL YA FRIEND!
Followed all the instructions and everything looks fine. However, when I send a message to a friend it seems like it send with no error message but the recipient did not received the mail.
Here is a copy of teller.cgi.
#!/usr/bin/perl
# -------------
# Links
# -------------
# Links Manager
#
# File: teller.cgi
# Lets visitors recommend your site to a friend
# Author: Glenn Utteridge
# Based on and designed to be used with
#Links 2 by: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
#
#
# Setup:
# Make sure the require statement below points to the config file.
# Required Librariers
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "/home/sites/site136/web/cgi-bin/search/admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
# ========================================================
eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.
sub main {
# --------------------------------------------------------
# Sends an email to a friend recommending this site
my %in = &parse_form();

my $site_url = "http://test.com";


# Make sure the email address at least looks like an email address.
my $receiver = $in{'receiver'};
my $rname = $in{'rname'};
($receiver =~ /.+@.+\..+/) or &site_html_refer_error ("The email address: '$receiver' doesn't look like a real email address.") and return;
($rname =~ /[A-Za-z]+/) or &site_html_refer_error ("Please enter their name as well as their email address.") and return;
my $sender = $in{'sender'};
my $sname = $in{'sname'};
($sender =~ /.+@.+\..+/) or &site_html_refer_error ("The email address: '$sender' doesn't look like a real email address.") and return;
($sname =~ /[A-Za-z]+/) or &site_html_refer_error ("Please enter your names as well as your email address.") and return;

$site =
# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");
my $to = $in{'receiver'};
my $from = $in{'sender'};
my $subject = "I've just seen a great site!";
my $msg = qq|

To $in{'rname'}
message = "I just found this page and I think its great. The url is http://test.com
check it out!"

Cheers


$in{'sname'}


|;
# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;
print &site_html_refer_mail;
}

Any input will be greatly appreciated!

Mack

Quote Reply
Re: TELL YA FRIEND! In reply to
Hi there, Same problem this side. Am trying out links before I make it public. Code changed as per insdtruction but no Email sent?

Quote Reply
Re: TELL YA FRIEND! In reply to
Can someone KINDLY post a link or working copy of TELLER.CGI !

Thanks

Quote Reply
Re: TELL YA FRIEND! In reply to
Hello

i use the script on Gleen's site.
I use a pop up.
I've put the absolut path of links.cfg like U,
chmod 755.

I use templates.

Try again to copy the codes.

I don't know if I can post the teller.cgi?
If yes, i'll make it

Ciao


Quote Reply
Re: TELL YA FRIEND! In reply to
Hi, when i tried to install Tell ya friend i also have some problems, not its working fine.

Here is the code of the cgi file im using. its called "tella2.cgi"

Hope this is usefull for you.

#!/usr/bin/perl
# -------------
# Links
# -------------
# Links Manager
#
# File: linkdead.cgi
# Notifies the webmaster of a deadlink
# Author: Glenn Utteridge
# Based on and designed to be used with
#Links 2 by: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
#
#
# Setup:
# Make sure the require statement below points to the config file.
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}

# ========================================================

eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.

sub main {
#-------------------------------------------------------------------
# Main Routine

my (%in) = &parse_form;


($in{'yemail'} =~ /.+@.+\..+/) or &site_html_tell_error ("The email address: '$in{'yemail'}' doesn't look like a real email
address.") and return;
($in{'yname'} =~ /[A-Za-z]+/) or &site_html_tell_error ("Please enter your name as well as your email address.")
and return;
($in{'tname'} =~ /[A-Za-z]+/) or &site_html_tell_error ("Please enter their name as well as your email address.")
and return;
($in{'temail'} =~ /.+@.+\..+/) or &site_html_tell_error ("The email address: '$in{'yemail'}' doesn't look like a real email
address.") and return;

my $to = $in{'temail'};
my $from = $in{'yemail'};
my $subject = " $in{'yname'} te recomienda este enlace!\n";
my $msg = qq|
Estimado $in{'tname'}

$in{'yname'} visitó arqui-red (http://www.arquired.net) y navegando
en su sección del buscador de arquitectura encontró la siguiente
página, la cual te recomienda visitar.

Titulo : $in{'Title'}
URL : $in{'URL'}
Descripción : $in{'Description'}

Este y mas enlaces los puedes encontrar en en el buscador de arquitectura
de arqui-red
http://www.arquired.net/buscador/

Saludos,
$in{'yname'}

---------------------------------------
arqui-red : arquitectura en la red
http://www.arquired.net
|;

# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;
&site_html_tell_mail;
# Writes the message to a logfile


# Set date variable to today's date.
$date = &get_date;

# Write the information to a logfile

open (VAL, ">>tella2.txt") or &cgierr("error in add_record. unable to open validate file: comments.db. Reason: $!");
flock(VAL, 2) unless (!$db_use_flock);
print VAL "$in{'ID'}|$date|$in{'Title'}|$in{'yname'}|$in{'yemail'}|$in{'temail'}|$in{'tname'}|\n";
close VAL; # automatically removes file lock
}



Carlos Alcocer
http://www.arquired.net
Quote Reply
Re: TELL YA FRIEND! In reply to
Hello chapsrulez,

maybe you should just tell us what kind of problem you have.
I am using Tell ya friend2 and it seems to work fine except for one thing. When not filling in the email form at all the cgi does not call the error page but gives me a fatal error message instead. When filling in an address that does not seem to be an email address it correctly calls the error page.

What kind of problem do you have?

Regards

Torsten

Quote Reply
Re: TELL YA FRIEND! In reply to
Hi Torsten.

Mack posted:
Can someone KINDLY post a link or working copy of TELLER.CGI !

Thanks
------

so i posted the script, it works great if all the fields in the form are filled correct.

But if some fills the TO field with an email like bla @bla.com or bla@ bla.com i have a 500 error, not the error page.

If the senders name or recipt name is left blank, the scripts calls the error page, but no error is displayed.

Thats the problem i have.




Carlos Alcocer
http://www.arquired.net
Quote Reply
Re: TELL YA FRIEND! In reply to
Hello

with tellyafriend 1,
i've got an internal servor error too,
if the email to the friend is like Carlos said :
xxx @ mail.com ... :

with :
malformed header from script. Bad header=djud... User unknown: /home/c03531/cgi-bin/links/cgi-bin/teller.cgi


Any idea to solve this?

Thanks Laugh

ciao