in

Community Server

The platform that enables you to build rich, interactive communities

Football Pool Software suggestion... sufficient positive ballance required to make picks

Last post 10-19-2010 8:29 AM by Spooky. 20 replies.
Page 2 of 2 (21 items) < Previous 1 2
Sort Posts: Previous Next
  • 11-30-2009 10:09 AM In reply to

    • Spooky
    • Top 10 Contributor
    • Joined on 08-19-2009
    • Denver CO
    • Posts 64

    Re: Football Pool Software suggestion... sufficient positive ballance required to make picks

      If you follow the instructions in the two summary posts I made about 5 posts back in this thread, and then make sure you push the new files out to your website, it should all work. It is possible you might have the old files cached, so closing all browser windows before testing may be necessary.

     Starting mid season should not make any difference. I've been using the code on my pool, so I am certain it works. What other modifications have you made, if any?
  • 12-01-2009 9:41 PM In reply to

    Re: Football Pool Software suggestion... sufficient positive ballance required to make picks

    Thanks Spooky, it worked.  A brain-fart on my part with the cached files.

    Bottoms up! Beer

  • 08-19-2010 9:55 AM In reply to

    • Spooky
    • Top 10 Contributor
    • Joined on 08-19-2009
    • Denver CO
    • Posts 64

    Re: Football Pool Software suggestion... sufficient positive ballance required to make picks

    Mike,

    I'm wondering if this modification will still function in the 4.0 Beta "as-is" or if further modification are needed.

     

    -Spooky

     

    Spooky:

     To summarize all changes for making this mod work:

    Start with adding this function to common.asp

    function GetAvailableFunds(username)

    dim sql, rs
    dim credits, fees

    GetAvailableFunds = 0

    'Get credits.
    credits = 0
    sql = "SELECT SUM(Amount) AS Total FROM Credits WHERE Username = '" & SqlEscape(username) & "'"
    set rs = DbConn.Execute(sql)
    if not rs.EOF then
    credits = credits + rs.Fields("Total").Value
    end if

    if not IsNumeric(credits) then
            credits = 0
        end if
     
    	'Get fees.
    fees = 0

    'Count each weekly entry.
    dim week, numWeeks
    numWeeks = GetWeekCount()
    for week = 1 to numWeeks
    if InWeeklyPool(username, week) then
    fees = fees + WEEKLY_ENTRY_FEE
    end if
    next

    'Add the side pool entry (if used).
    if InSidePool(username) then
    fees = fees + SIDE_ENTRY_FEE
    end if

    GetAvailableFunds = credits - fees

    end function


    See Next Post

     


     

    Spooky:
    Next, open up weeklyEntry.asp and add this at the top along with the other #includes:

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


     Now scroll down until you find the hasEntry section and add the bolded text below

        'Determine if the user has an entry for the given week (so we can display
        'the Delete button).
        dim hasEntry
        hasEntry = false
        if username <> "" and InWeeklyPool(username, week) then
            hasEntry = true
        end if

        'Get the user's available funds.
        dim availFunds
        availFunds = GetAvailableFunds(username)
        if hasEntry then
            availFunds = availFunds + WEEKLY_ENTRY_FEE
        end if 



    Now, scroll down again until you come to the "Process an update request" section and add the bold text

    'Process an update request.
    elseif Request.Form("submit") = "Update" then

       'Prevent entries by the Admin.
        if username = ADMIN_USERNAME then
            call DisplayErrorMessage("Error: User '" & ADMIN_USERNAME & "' may not make picks.")

        'If the user is disabled, prevent the entry.
        elseif IsDisabled() then
            call DisplayErrorMessage("Error: Your account has been disabled, changes not accepted.<br />Please contact the Administrator.")

        'If all games have been locked, prevent any updates (except by the Admin).
        elseif not IsAdmin() and allLocked then
            call DisplayErrorMessage("Error: All games for this week have been locked, changes not<br />accepted.")

        'If the player does not have sufficient funds, do not allow the picks
        elseif not IsAdmin() and availFunds < WEEKLY_ENTRY_FEE then
            call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")

    That should do it, just save the files and update your website.
     

     

    (edited post to include a small fix for users with no transactions yet)

  • 08-23-2010 6:50 PM In reply to

    Re: Football Pool Software suggestion... sufficient positive ballance required to make picks

     Those instructions should still work, there are no new pools or fees and the affected files are all still there with the same names.

  • 10-17-2010 12:53 PM In reply to

    Re: Football Pool Software suggestion... sufficient positive ballance required to make picks

     I finally got around to adding this in to my code because people playing and not paying is disturbing but it does not seem to be working.  I've restarted the browser and even used another one but it still lets me do picks with an insufficient fund. Any other thoughts?

     And in case it matters I'm still using v3, tks

  • 10-19-2010 8:29 AM In reply to

    • Spooky
    • Top 10 Contributor
    • Joined on 08-19-2009
    • Denver CO
    • Posts 64

    Re: Football Pool Software suggestion... sufficient positive ballance required to make picks

     Make sure you are using the code from my last summary in this thread (just a few posts back). There was a slight bug fix in the common.asp code that deals with what might be your issue.

     

    -Spooky

Page 2 of 2 (21 items) < Previous 1 2
Powered by Community Server (Non-Commercial Edition), by Telligent Systems