Email users a copy of there picks when entered

Post here to discuss topics relate to the 4.x version for the ASP Football Pool software program. All support topics should go here.
Post Reply
kingmullet
Posts: 59
Joined: Thu Sep 05, 2013 3:21 pm

Email users a copy of there picks when entered

Post by kingmullet »

Has anyone ever messed around with this? I am trying to see if there is a way to send users a copy of their picks when they enter them into the pool. There are other sites that do the similar thing and it would be pretty cool if this was possible here.
PAUDASH
Posts: 10
Joined: Fri Sep 13, 2013 9:13 am

Re: Email users a copy of there picks when entered

Post by PAUDASH »

I just implemented this recently...
Also added the ability to include the IP address of the person making the picks...
Great for audit trails...

I'll do my best to communicate the changes you need to make to weeklyEntry.asp,
Changes in RED, Black text is for reference point of existing code... YMWV

Add Include for Email and encryption at top so we can reuse the email function and access the decryption routine for the email...

<!-- #include file="includes/email.asp" -->
<!-- #include file="includes/encryption.asp" -->


Around line 715

call DbConn.Execute(sql)

'Create array of player picks to eventually email
dim playerpick, playerpicks
playerpick = playerpick &","& pick


next

Then around line 733, again your mileage will vary...

call DbConn.Execute(sql)

'trim the first comma from the list
playerpicks = Right(playerpick,Len(playerpick)-1)


'Email the Picks to the player for their records
if not IsAdmin() then

'Pull the Users email from the Database

dim email, USER_EMAIL
sql = "SELECT * FROM Users WHERE Username = '" & SqlEscape(username) & "'"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
email = GetFieldValue("email", Decrypt(rs.Fields("EmailAddress").Value))
USER_EMAIL = email
EMAIL_SUBJECT = "Your Picks have been made"
end if

call SendMail (USER_EMAIL, EMAIL_SUBJECT, "Your weekly picks for <b>"& USERNAME &"</b> have been recorded on "&Request.ServerVariables ("SERVER_NAME")&"<br/>USERNAME: <b>"& SqlEscape(username) & "</b><br/>WEEK: <b>"& week &"</b><br/>PICKS: <b>"& playerpicks &"</b><br/>TIE BREAKER: <b>"& tb &"</b> <br/>IP ADDRESS: <b>"& Request.ServerVariables ("REMOTE_ADDR")&"</b>")
end if



'Clear any saved weekly results data.
call ClearWeeklyResultsCache(week)
Attachments
weeklyEntry.zip
Attached WeeklyEntry.asp
(9.72 KiB) Downloaded 447 times
kingmullet
Posts: 59
Joined: Thu Sep 05, 2013 3:21 pm

Re: Email users a copy of there picks when entered

Post by kingmullet »

Put this in, but then received the following error when pressing update

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Is this for SQL or the access version?
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: Email users a copy of there picks when entered

Post by philwojo »

Based on the notes he made it would appear to be for the SQL version, but that is just a guess on my part.

Phil
PAUDASH
Posts: 10
Joined: Fri Sep 13, 2013 9:13 am

Re: Email users a copy of there picks when entered

Post by PAUDASH »

I am running access Version....

Maybe have to declare EMAIL_SUBJECT

dim email, USER_EMAIL, EMAIL SUBJECT

I also have call sendmail on one line....
Sorry the forum made two lines...

If you like Ill help troubleshoot...

Can you turn on error reporting and see what the actual error is?

I've uploaded another weeklyEntry.asp...
I just realized my original one had some code in it that also sent a secret email to an audit email...
Helpful if you have someone else managing the day to day and want to know when they make changes for other users...

J
Attachments
weeklyEntry.zip
(9.66 KiB) Downloaded 444 times
kingmullet
Posts: 59
Joined: Thu Sep 05, 2013 3:21 pm

Re: Email users a copy of there picks when entered

Post by kingmullet »

Awesome, anyway to incorporate the confidence points selected as well? Everything else works great.
PAUDASH
Posts: 10
Joined: Fri Sep 13, 2013 9:13 am

Re: Email users a copy of there picks when entered

Post by PAUDASH »

Perhaps change the code on Line 720 of my modified weeklyentry.asp

playerpick = playerpick &","& pick

to

playerpick = playerpick &","& pick &"-"& conf
kingmullet
Posts: 59
Joined: Thu Sep 05, 2013 3:21 pm

Re: Email users a copy of there picks when entered

Post by kingmullet »

Yup that did it! Thanks buddy..
PAUDASH
Posts: 10
Joined: Fri Sep 13, 2013 9:13 am

Re: Email users a copy of there picks when entered

Post by PAUDASH »

You're very welcome! Glad I could contribute...
nananaja003
Posts: 9
Joined: Fri Oct 30, 2015 11:08 pm

Re: Email users a copy of there picks when entered

Post by nananaja003 »

Thanks buddy..

golden slot
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email users a copy of there picks when entered

Post by fbonani »

This is my first year working with ASP files and as such have no knowledge of how to "fix" things. The Entry Form that I am using is supposed to send out a copy of the picks to the player (downloaded the edited weeklyEntry.asp file from here) and the following is what the email looks like.

Your weekly picks for <b>Nick K</b> have been recorded on fredspools.somee.com<br/>USERNAME: <b>Nick K</b><br/>WEEK: <b>1</b><br/>PICKS: <b>GB,MIN,BAL,NYJ,KC,LAR,CLE,PHI,SEA,LAC,DET,DAL,TB,NE,NO,DEN</b><br/>TIE BREAKER: <b>41</b> <br/>IP ADDRESS: <b>99.45.56.80</b>

Evidently the <br/> code is not being picked up so the picks are not listed in a column as expected. Does anyone know how to edit the file to make this display in columnar form instead of horizontal as shown? Thanks.
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email users a copy of there picks when entered

Post by fbonani »

This is such a great add on...doesn't anyone know how to change the code to display the picks vertical instead of horizontal?
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: Email users a copy of there picks when entered

Post by philwojo »

Try changing the code to replace the <br/> with just <br> and see if that works.
I'm no expert that is just a shot in the dark but I don't believe that <br> can ever use the slash.

Phil
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email users a copy of there picks when entered

Post by fbonani »

I never thought about that, but after reading about that tag, it is quite possibly the cause of the problem. I won't know until next week as everyone's picks have been submitted for this week. I will update once I have determined if this is in fact the problem. Thanks for the heads up Phil. BTW, are you the same Philwojo that is on the Turbo Tourney forum?
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: Email users a copy of there picks when entered

Post by philwojo »

Yes that is me also.
User avatar
fbonani
Posts: 50
Joined: Thu Aug 15, 2019 12:07 pm

Re: Email users a copy of there picks when entered

Post by fbonani »

philwojo wrote: Thu Sep 19, 2019 4:33 pm Try changing the code to replace the <br/> with just <br> and see if that works.
I'm no expert that is just a shot in the dark but I don't believe that <br> can ever use the slash.

Phil
Changing the code from <br /> to <br> did not change the formatting of the email confirmation. I'm hoping someone can give me a hint as to what I have to do to make the picks display vertically instead of horizontally in the email confirmation.
Post Reply