Gossamer Forum
Quote Reply
Email rate and hits
Hi,
I searched the forum but did'nt find something like that

Is there a way to send only one email which shows rate and hits of each entry a user has.
For example
username xyz has five link entries and he is getting a mail
Link 1 - Hits:75 - Rate:7
Link 2 - Hits:74 - Rate:9
Link 3 - Hits:43 - Rate:4,5
Link 4 - Hits:38 - Rate:6,5
Link 5 - Hits:23 - Rate:3

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

Man, I'm just too kind Tongue

1) Upload the .cgi script into your admin folder. Be sure to update the bit saying: /path/to/your/admin
2) Upload the .eml template into your /admin/templates/luna folder.

Then, try running the script via SSH :)

Once you've tested it, and it works ok - be sure to setup the cronjob , or else it won't run =)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
Hi Andy,
thanks very much for the code.
Andy wrote:

Then, try running the script via SSH :)

I have no SSH :-(
Is it possible to test it just with one email or with my entries before I sent it to 1000 users?

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

Mmm.. ok.

Try changing:

Code:
my $sth = $DB->table('Links')->select( ['DISTINCT(LinkOwner)'] ) || die $GT::SQL::error;

..to:

Code:
print $IN->header();
my $sth = $DB->table('Links')->select( ['DISTINCT(LinkOwner)'] ) || die $GT::SQL::error;

...and to test with just your username, try changing:

Code:
while (my $hit = $sth->fetchrow_hashref) {
print "Working on: $hit->{LinkOwner} \n";
send_email($hit->{LinkOwner});
}

..to:

Code:
# while (my $hit = $sth->fetchrow_hashref) {
# print "Working on: $hit->{LinkOwner} \n";
# send_email($hit->{LinkOwner});
# }
send_email('admin');

(if your test username is "admin")

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
Hi Andy,
I chmod the cgi-file to 755. But when I try to start the script in the browser, it starts to download it.
There must be an error?
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

I just took a look for you, and it was because you had the wrong path to perl =) You needed: #!/usr/bin/perl, not #!/usr/local/bin/perl

Did you get the test email ok? I didn't get any errors when running it.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
Hi Andy,
the email was just perfect.
If I were you. I would make a plugin out of this.
I think there are some people out there, which love this script, too.

Thanks again
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

Glad to hear it :)

I've changed:

Code:
# while (my $hit = $sth->fetchrow_hashref) {
# print "Working on: $hit->{LinkOwner} \n";
# send_email($hit->{LinkOwner});
# }
send_email('Matthias_Lunz');

..back to:

Code:
while (my $hit = $sth->fetchrow_hashref) {
print "Working on: $hit->{LinkOwner} \n";
send_email($hit->{LinkOwner});
}
#send_email('Matthias_Lunz');

..for you now - so it will send to all people now, instead of just you - so you know :))

Quote:
I think there are some people out there, which love this script, too.

Nah, I'll keep this one as a freebie :) If anyone wants to send a donation / buy something from my Amazon Wishlist, that would be appreciated - but no need to if you don't want to :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
Hi Andy,
thank you very much.

Andy wrote:

I've changed:


You were faster than me Smile

Andy wrote:
Nah, I'll keep this one as a freebie :) If anyone wants to send a donation / buy something from my Amazon Wishlist, that would be appreciated - but no need to if you don't want to :)

Certainly I will paypal you for this ;-)
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi Andy,
I know it's a freebie,
but is there a way, to sent these statistics only to user who set admin email to yes?

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

You should be able to do it by adding:

Code:
if ($user_hash->{RecieveMail} eq "No") { return; }

..just below:

Code:
my $user_hash = $DB->table('Users')->select( { Username => $user } )->fetchrow_hashref;

Hore that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
Hi Andy,
works fine and at the moment there are no complaints from any users ;-)
So I think the code is right.

Thank you
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Andy] Email rate and hits In reply to
Upps Andy,
there is another problem. I have to many users, so there is a timeout and only half the user get an email!
Is there an easy way to split the script in more parts?

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

Mmm.. not really :/ And your running it via SSH/Telnet?

Only way I can think of - is either doing it as "su" (superuser), or having it setup on cronjob - which should just carry on to the very end.

Hope that helps,.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
Hi Andy,
I called the script from the browser and it ends half the way.

I just asked my host if a cronjob has the same timeout.
And he told me there is no difference between cronjob and call by browser :-(

I'm wondering cause I thought cronjobs have no timeouts.
What do you think?

Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

Quote:
I just asked my host if a cronjob has the same timeout.
And he told me there is no difference between cronjob and call by browser :-(

I'm wondering cause I thought cronjobs have no timeouts.
What do you think?

I don't believe them :P Give it a go - and setup the cronjob with something like this - so you can track where it gets to:

Code:
perl /path/to/script/user_stats.cgi > /path/to/script/log.txt

..and then see what the contents of /path/to/script/log.txt hold after its run. I'm almost 100% sure it will run through to the end =)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
O.K. thanks Andy I will try the cronjob in a few weeks. Cause I don't want to spam my users...

By the way. I'm getting some complaints now ;-)
The code change below did not work. The script sents out an email to users who set RecieveMail to No, too.


Andy wrote:
Add
Code:
if ($user_hash->{RecieveMail} eq "No") { return; }


..just below:

Code:
my $user_hash = $DB->table('Users')->select( { Username => $user } )->fetchrow_hashref;

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Email rate and hits In reply to
Hi,

Are you sure?

I think what you are szeeing, is:

Code:
print "Working on: $hit->{LinkOwner} \n";
send_email($hit->{LinkOwner});

..as this bit doesn't take into consideration the settings for the user (its done in the send_emai() function further down =))

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Email rate and hits In reply to
O.K. I see, thanks Andy for the explanation.
I will tell you in a few weeks if the cronjob is working without timeout.

Matthias

Matthias
gpaed.de