Coder Social home page Coder Social logo

rothkj1022 / phppickem Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 57.0 1.89 MB

PHP Pick 'Em is a free php web application that allows you to host a weekly NFL pick 'em football pool on your website.

License: MIT License

PHP 86.32% CSS 2.24% JavaScript 7.62% PLpgSQL 2.10% HTML 0.97% SCSS 0.72% Hack 0.03%

phppickem's People

Contributors

krothapigroup avatar rothkj1022 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phppickem's Issues

Error updating picks summary: Field 'tieBreakerPoints' doesn't have a default value

I didn't get this error on a simple XAMPP install. Then moved the install to another server, Linux.

Linux Server Specs.
CentOS 6.6
PHP 5.3.3
MySQL 5.6.25-2.el6

To "fix" this and get past the error, I modified the entry_form.php and commented out an error handler.

    //update summary table
    $sql = "delete from " . DB_PREFIX . "picksummary where weekNum = " . $_POST['week'] . " and userID = " . $user->userID . ";";
    $mysqli->query($sql) or die('Error updating picks summary: ' . $mysqli->error);
    $sql = "insert into " . DB_PREFIX . "picksummary (weekNum, userID, showPicks) values (" . $_POST['week'] . ", " . $user->userID . ", " . (int)$_POST['showPicks'] . ");";
   //      $mysqli->query($sql) or die('Error updating picks summary: ' . $mysqli->error);

Now I am unable to use the feature. The picks always display.
[X] Allow others to see my picks.

I recognize that the comment out of an error handler isn't a fix but it got me past the error and made this really fantastic app useable again.

BTW. I have donated as I think this is a great product!

Install Not Working

Hi,

Been trying to get your software to work with Inmotion Hosting but can't seem to get it right. At first I get a .htaccess error with php_flag, with this error I am not able to even open the install/index.php. If I remove that code from the .htaccess I can then access the install directory. I edit the includes/config.php, with all the correct information, and I am told it cannot connect to the database.

If I try to setup the database tables myself and run the software it seems to work and I create users but when logged in as an admin most the options do no show up and the software is useless.

Would anyone be able to help me get this setup? I tried creating an account on the forums but there doesn't seem to be a place to register.

Timezone Issue

Still having an issue with the time zone once the time zone was set back in Oct/Nov the games are closing an hour early. Is there updated code to fix this issue?

Thanks in advance!

php mailer script help using cron

Hello,
I am in need of help to move an older script to the new 2.2.2 version.
I am not quite sure why I can't move a script that was working with the older version of php pick'em... When I run this script it does nothing.. no email or nothing. I have substituted out
the real emails...

I have tried to figure out all that is different in php 5.4 but to no avail I still can't get this to work.
Reason I need this is because I use to have a cron job on the older server to run twice a week
to remind players to pick... but now with the newer version of php 5.4, this script will not run.

<?php

require('includes/application_top.php');
include('includes/classes/class.phpmailer.php');

    $week = (int)getCurrentWeek();
    $prevWeek = $week - 1;
    $firstGameTime = getFirstGameTime($week);


    //grab all the users who have not picked this week
    $totalGames = getGameTotal($week);
            $sql = "select u.firstname, u.email,";
            $sql .= "(select count(p.pickID) from nflp_picks p inner join nflp_schedule s on p.gameID = s.gameID where userID = u.userID and s.weekNum = " . $week . ") as userPicks ";
            $sql .= "from " . $db_prefix . "users u ";
            $sql .= "where u.userName <> 'admin' ";
            $sql .= "group by u.firstname, u.email ";
            $sql .= "having userPicks < " . $totalGames;

    $sql = mysql_query($sql);
    $emailBody = "";

    while($row = mysql_fetch_assoc($sql))
    {
        $emailBody .= "".$row['firstname']." \t\t".$row['userPicks']." \n ";
    }



    $to = “[email protected]"; 
    $subject = "NFL - Current Users that have NOT picked for week $week"; 
    $message = "$emailBody"; 
    $headers = "From: [email protected]";
    $headers = "Bcc: [email protected], [email protected]";
    mail($to, $subject, $message, $headers);
?>

Please advise what needs to occur since I really love this program, but having to understand different php versions is killing me.

Warning: Connection refused

I get the following error when I run both the (getHtmlScores.php) and (buildSchedule.php).
I am running both by entering url manually if that matters. I would appreciate any help you could offer with this error.

Warning: file_get_contents(http://www.nfl.com/ajax/scorestrip?season=2017&seasonType=REG&week=8): failed to open stream: Connection refused in /srv/disk14/2125293/www/site.com/phppickem/getHtmlScores.php on line 11

Warning: Invalid argument supplied for foreach() in /srv/disk14/2125293/www/site.com/phppickem/getHtmlScores.php on line 19
[]

Having Trouble

I installed all databases but install not working

Suggestions?

[Bug Fix] Load Scores no longer working (fix inside)

The NFL now requires an API key to access their data so the "Load Scores" button no longer works in the admin panel. I found a free feed from ESPN that I am using now. I have only tested this on the Chiefs and Texans game so far, so there could be some issues with it still. Specifically, I am not sure how the feed shows overtime, so I made a guess. I also don't know if all the team abbreviations will match up.

All you need to do is update the getHtmlScores.php file:

<?php
require('includes/application_top.php');

$week = (int)$_GET['week'];

//load source code, depending on the current week, of the website into a variable as a string
//$url = "http://www.nfl.com/ajax/scorestrip?season=".SEASON_YEAR."&seasonType=REG&week=".$week;
$url = "https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard?week=".$week;
if ($xmlData = file_get_contents($url)) {
	$games = json_decode($xmlData, true);
}

//build scores array, to group teams and scores together in games
$scores = array();
foreach ($games['events'] as $gameArray) {
	$game = $gameArray['competitions'][0];
	if ($game['status']['type']['completed'] == true) {
		$overtime = (($game['status']['period'] == '5') ? 1 : 0);
		foreach ($game['competitors'] as $gameTeams) {
			if ($gameTeams['homeAway'] == "home") {
				$home_team = $gameTeams['team']['abbreviation'];
				$home_score = (int)$gameTeams['score'];
				if ($home_team == "WSH")
					$home_team = "WAS";
			}
			if ($gameTeams['homeAway'] == "away") {
				$away_team = $gameTeams['team']['abbreviation'];
				$away_score = (int)$gameTeams['score'];
				if ($away_team == "WSH")
					$away_team = "WAS";
			}
		}

		$winner = ($away_score > $home_score) ? $away_team : $home_team;
		$gameID = getGameIDByTeamID($week, $home_team);
		if (is_numeric(strip_tags($home_score)) && is_numeric(strip_tags($away_score))) {
			if ($away_score > 0 || $home_score > 0) {
				$scores[] = array(
					'gameID' => $gameID,
					'awayteam' => $away_team,
					'visitorScore' => $away_score,
					'hometeam' => $home_team,
					'homeScore' => $home_score,
					'overtime' => $overtime,
					'winner' => $winner
				);
			}
		}
	}
}

//see how the scores array looks
//echo '<pre>' . print_r($scores, true) . '</pre>';
echo json_encode($scores);

//game results and winning teams can now be accessed from the scores array
//e.g. $scores[0]['awayteam'] contains the name of the away team (['awayteam'] part) from the first game on the page ([0] part)

Attached: Basic script to insert 2019 schedule

I've made a basic script to take the schedules.json from the NFL website and insert it into the schedule table. Doesn't back anything up, doesn't delete the existing schedule, doesn't download the schedules.json. All it does is read the schedules.json and inserts it into the database.

sched.txt

2014 Schedule

Have a way to import the 2014 schedule into the game.

not ready for game day

I like the phppickem from rothkj1022 but have been modifying the code for a few years now.

Since it doesn't seem to be ready for gameday this year, I forked it to https://github.com/DonThorntonJr/phppickem and merged my cahnges against the rothkj1022/phppickem
baseline.

I fixed a lot of the time, date, and timezone issues and added a few customizations that allow for updates to be made during the game from scripts that can be run from crontab.

Not all emails are working.

I can succesfully send emails using the "last weeks results/reminder" email template, but if I try to send an email using the "Weekly picks Reminder" template, it never sends any emails. This has worked for many seasons, but for some reason doesn't work in the current version.

Allow changes to picks until game starts

Has anyone made the necessary modifications to allow pick changes up until the game starts? I always found it weird that the week locks completely and doesn't allow 4pm and Monday night changes.

I briefly looked into it and it seems like a lot of work to change.

[request / suggestion] Games not locked until actual game time

I would like to see a config option, or default, be to keep games open to change right up to game time. I realize that later in the year, the game times change meaning more work for the admins, but there are a lot of times where I'd like to allow players to change a late Sunday game or the Monday night game. Sometimes it's a matter of desperation in trying to keep a tie from happening, but I think the option should be there for the players. I'm a PHP newbie and haven't looked into how the weeks are currently locked but I don't think this should be too hard to implement. I suggested making if a config so that if admins want to keep the weeks locking when they do, that is fine also.

can't install

I changed the config.php changed to try different settings, nothing seems to work. I get a 500 error misconfiguration. I am sure it is something I am doing wrong but for the life of me can't find out what.

********** ATTN: THE PROJECT HAS NOT MOVED **********

Hi Everyone,

The Project has a NEW Home! It is now Located at:

http://www.phppickem.org/forums
http://forums.phppickem.org
http://www.phppickem.org/support
http://support.phppickem.org

http://www.phppickem.org

If You’re Already A Member here at GitHub or at Sourceforge, You’ll still need to Register at the new site. Please register using Your Current Username so we’ll all know who everyone is. Additionally, after registering a new account, we’ll transfer all of Your Statistical Data & Posts under Your Username.

We now have a custom-designed PHPPick'Em Theme, a Code Repository, a Downloads Area where everyone can download all of the versions of PHPPick'Em, a Bug Tracker, Advance Code Boxes, Custom Graphics, etc., etc. It’s an enhanced version of Sourceforge & GitHub combined, that we feel will be unmatched by others, and should be easier to use and enjoyed by all. This will be an asset to all involved and a benefit to everyone that will take us & the Project into the future. Please be patient as we complete the transition to the new site

Best Regards, and Enjoy The New Site!

Bug fixes

These are the files with modifications necessary to install PHP Pick Em. Four files total. The SQL file didn't have the e-mail templates formatted properly (escaping a character requires double quotes around that part of the query). Miscellaneous errors in other files.

Install/Index.php:
http://pastebin.com/u8cBCujp

Includes/application_top.php:
http://pastebin.com/cBNUtd5V

Includes/header_form.php:

<?php
header('Content-Type:text/html; charset=utf-8');
header('X-UA-Compatible:IE=Edge,chrome=1'); //IE8 respects this but not the meta tag when under Local Intranet
?>
<!DOCTYPE html>
<html xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Installer - PHP Pick 'Em</title>
    <link rel="stylesheet" type="text/css" media="all" href="../css/all.css" />
    <link rel="stylesheet" type="text/css" media="all" href="../css/bootstrap.min.css" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style type="text/css">
    body {
        background-color: #777;
        color: #333;
        font-family: "Titillium Web",sans-serif;
        font-size: 1.8em;
    }
    </style>
</head>

<body>
    <div class="container">
        <header id="header" class="row">
            <div id="top-nav" class="col-sm-12">
                <div class="navbar navbar-default" role="navigation">
                    <img src="logo.gif" align="right" />
                </div>
            </div>
        </header>
    <div id="pageContent">

Install/phppickem2.0.1.sql:
http://pastebin.com/d0BENM2e

Timezone Offset not working

Hello!

I think there is a problem with the SERVER_TIMEZONE_OFFSET variable.
As I am located in Europe my offset to ET is -6 hours. Somehow the define-function does not allow me to use a negative number.
Is there any workaround?

Thank you.

[Request] modify users picks

anybody have the code for allowing an admin to modify a users picks?

Looks like phppickem.org isn't activating new users and there's no other place for me to find the mod.

PHP Fatal error: Call to undefined function dl()

I don't do much php, so I'm sorry if this is an easy fix. I was able to run through the installer without any issues, but I'm getting the following error (in /var/log/apache2/error.log) when visiting login.php.

PHP Fatal error:  Call to undefined function dl() in /home/phppickem/phppickem/includes/classes/crypto.php on line 31

I'm on Ubuntu 14.04 and running PHP Version 5.5.9-1ubuntu4.11. Please let me know what other pertinent info you might need, and any suggestions on getting this running would be appreciated.

localhost refused to connect when on the login screen

Hi, I just got the script installed and I'm running my site through hostgator and I can get to the login screen however when I try to type in admin/admin123 to login for the first time I get the below error. This happens on no matter what I do for login, create an account, and reset my password. Any ideas as I would love to get this up/going?

This site can’t be reached

localhost refused to connect.
Search Google for localhost phppickem application sign up
ERR_CONNECTION_REFUSED

Please advise.

Washington Redskins missing on

Between the 2014 and 2015 code, the abbreviation for the Washington Redskins has changed from WAS to WSH. As a result, any pick involving Redskins will not display in the Entry Form. The fix for this is simple; edit the nflp_teams table by changing the teamID column from WAS to WSH.

svg files not rendering and coming up as Type text/plain

Current server settings...

Linux web01.savagegeek.com 2.6.18-411.el5xen #1 SMP Mon Jul 11 18:35:26 CDT 2016 i686 i686 i386 GNU/Linux

rpm -qa | grep http
httpd-2.2.3-92.el5.centos

cat /etc/redhat-release
CentOS release 5.11 (Final)

I noticed that the required parameters are already in .htaccess

AddType image/svg+xml svg svgz
AddEncoding gzip svgz

But, the logo's that are of extension .svg still do not render

Getting PHP errors relating to the timezone on various pages

Hi, I just installed your app using 2013 data to see how it works and I'm getting a bunch of error messages throughout the app.

On the schedules.php page, I get this:

Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/32/d507359157/htdocs/pickem/schedules.php on line 79

on the results.php page:

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/32/d507359157/htdocs/pickem/results.php on line 11

on scores.php:

Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/32/d507359157/htdocs/pickem/scores.php on line 91

on schedule_edit.php:

Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/32/d507359157/htdocs/pickem/schedule_edit.php on line 217

I'm running PHP 5.4 on my server.

Let me know if you want access to my site to review. I can setup an admin account. Thanks.

php 7 blank index page

Anyone have this working with php 7? Works fine with php 5.6 but when we switch over to php 7 we get blank index page. Since php 5.6 is end of life it would be nice to get it running with php 7.

having issues installing

Not sure what I'm doing wrong, but I can't get install to read my DB's
I set everything correctly but seeing these error codes on install page.

Warning: Use of undefined constant DB_PORT - assumed 'DB_PORT' (this will throw an Error in a future version of PHP) in /home/gqnvwd9slg6m/public_html/NFLpickem23/install/index.php on line 4

Warning: mysqli::__construct() expects parameter 5 to be int, string given in /home/gqnvwd9slg6m/public_html/NFLpickem23/install/index.php on line 4

Warning: mysqli::set_charset(): Couldn't fetch mysqli in /home/gqnvwd9slg6m/public_html/NFLpickem23/install/index.php on line 6

Warning: mysqli::ping(): Couldn't fetch mysqli in /home/gqnvwd9slg6m/public_html/NFLpickem23/install/index.php on line 86

I'm not big on backend stuff, so any help will be much appreciated. thanks!

Games missing..

I don't see the Los Angeles Rams on there anywhere. Not even at the St Louis Rams. I think there's a few other games missing too

I am having troubles with the Password Reset

Has anyone found a solution for the password reset? It is using very old scripting. We are running PHP 7.4.

this error using URL: https://pickem.casterdepot.com/password_reset.php?reset=true I noticed the following entries in the PHP error log:

==> error.log <==
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_generic_deinit() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 85
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_module_close() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 88
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_module_open() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 44
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_enc_get_iv_size() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 51
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_create_iv() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 51
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_enc_get_key_size() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 54
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_generic_init() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 60
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_generic_deinit() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 85
[02-Aug-2023 09:30:58 America/Chicago] PHP Deprecated: Function mcrypt_module_close() is deprecated in /chroot/home/add2533c/5d0e64f97e.nxcli.net/html/includes/classes/crypto.php on line 88
The errors are PHP deprecated warnings that indicate that the functions used in the code are no longer supported in the current version of PHP. The deprecated functions are mcrypt_generic_deinit(), mcrypt_module_close(), mcrypt_module_open(), mcrypt_enc_get_iv_size(), mcrypt_create_iv(), mcrypt_enc_get_key_size(), and mcrypt_generic_init(). These functions were deprecated in PHP 7.1 and removed in PHP 7.2.

Password Reset Not working

There seems to be an issue with password_reset.php. None of the display messages show up, such as success, or error and no emails are sent. Hopefully this can be fixed for the new season. It would be great if the admin page had a way to reset the passwords for users as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.