version 5.0

updated to work with newer AMP
installation is much simpler via install script
This commit is contained in:
Larry Lam
2023-02-09 13:21:22 -08:00
committed by GitHub
parent 57dc85e5a5
commit b9980b2b07
20 changed files with 898 additions and 250 deletions
+29 -25
View File
@@ -1,10 +1,10 @@
###########################################################################
VNSB Squares
Version: 4.2
Released: 1/23/13
Version: 4.3
Released: 1/29/2019
Written: www.VNLISTING.com
Demo: http://vnlisting.homelinux.com/superbowl
Demo: http://www.vnlisting.com/superbowl
Forum: http://forum.vnlisting.com/
Email: admin@vnlisting.com
@@ -24,7 +24,7 @@ For a small donation I can help ::::::::::::::::::::::::::::::::::::::::
1. Setup/install this script on your server.
2. Setup/install this script on our server. You will get a seperate
URL for your group to use without having to by a domain name or
pay for posting else where.
pay for posting else where.
3. Most support can be found on the forum, But if you still need help
let me know.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -39,18 +39,16 @@ Requirements:
- This was tested with PHP 5.1.2, mySQL 5.0.18, Firefox2, and IE7
How to install:
1. Unzip VNSBsquares_v40.zip script to your local computer.
2. Change data in config.inc.php to reflect your mySQL data and rename it to config.php
3. Create a database in your MySQL as in config.php
4. Import superbowl.sql to your newly created MySQL database
5. Make changes to VNSB_settings as needed.
6. Upload all files to your web server.
1. Unzip VNSBsquares_v50.zip and copy all files to your web server.
2. run the 'setup.php' from your web browser.
i.e. http://www.yourdomain.com/superbowl/setup.php
3. delete 'setup.php' before go live.
Usage:
1. On your browser, type "www.yourdomain.com/superbowl" or wherever you uploaded the files
2. Click on any "AVAILABLE" squares to make the selection. Click "Submit" when all squares are selected.
3. Emails will be send to the Admin and the user when selection is made.
3. Emails will be sent to the Admin and the user when selection is made.
Administrator:
@@ -58,7 +56,25 @@ Administrator:
2. Email will be send to user and admin for each confirmation.
3. When all squares are selected, run randomnumber.php to randomly generate numbers.
4. Email to everyone when random numbers have been generated.
5. Enter scores from the admin page
===================== CHANGES FROM 4.1 to 5.0 =================================
1. Add scores, winner indications, email winners
2. php7 compatible
3. easily install and configuration from webpage
===================== CHANGES FROM 4.0 to 4.1 =================================
1. Admin above to confirm all squares from the same users at once.
2. Improve email sending header
3. Improve session header
===================== CHANGES FROM 3.0 to 4.0 =================================
1. Move superbowl logo to the database for easy change each year
2. User will be able to make multiple picks before enter information
3. Removed Admin link from user pages
===================== CHANGES FROM 2.0 to 3.0 =================================
Bugs fixed:
@@ -69,20 +85,8 @@ Bugs fixed:
via the URL. (Don't worry if you don't know what this mean).
4. Admin only required to login once instead of verifying admin email and password each confirmation.
5. Random number selection is now require login.
i
===================== CHANGES FROM 3.0 to 4.0 =================================
1. Move superbowl logo to the database for easy change each year
2. User will be able to make multiple picks before enter information
3. Removed Admin link from user pages
===================== CHANGES FROM 4.0 to 4.1 =================================
1. Admin above to confirm all squares from the same users at once.
2. Improve email sending header
3. Improve session header
===================== CHANGES FROM 4.1 to 4.2 =================================
1. Add scores, winner indications, email winners
TODO:
- Auto install of database and scripts
- Paypal implementation
- Paypal implementation
+35 -31
View File
@@ -1,28 +1,32 @@
<?session_start();
?>
<!--
www.vnlisting.com
Online Super Bowl Squares Script
Please read the "Readme.txt for license agreement, installation and usage instructions
Version: 4.2 1/23/2013
-->
<?php
<?php
session_start();
@ob_start();
#www.vnlisting.com
#Online Super Bowl Squares Script
#Please read the "Readme.txt for license agreement, installation and usage instructions
if (!isset($_SESSION['VNSB'])) {
?>
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
<?
?>
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
<?php
} else {
require_once('config.php');
require "includes/dbTables.inc";
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!". mysqli_connect_error());
}
$superbowlURL = $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "admin.php");
$confirmation = $_POST['Confirmation'];
$SQUARE = $_POST['square'];
$CONFIRM = $_POST['confirm'];
$RELEASE = $_POST['release'];
$NOTES = $_POST['body'];
require "header.inc";
require "includes/header.inc";
//$headers = "From: $ADMIN_EMAIL\r\nBcc: $ADMIN_EMAIL\r\n";
@@ -65,13 +69,13 @@ if (!isset($_SESSION['VNSB'])) {
<select name="square[]" id="square" size="11" multiple>
<!--<option value="">Select One</option>-->
<?php
$query="SELECT * FROM VNSB_squares WHERE NAME!='AVAILABLE' AND NAME!='' AND CONFIRM='0' ORDER BY NAME, SQUARE";
$result = mysql_query($query);
$sql="SELECT * FROM `VNSB_squares` WHERE NAME!='AVAILABLE' AND NAME!='' AND CONFIRM='0' ORDER BY NAME, SQUARE";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
exit;
}
while ($record = mysql_fetch_assoc($result)) {
while ($record = mysqli_fetch_assoc($result)) {
echo "<option value = '".$record['SQUARE']."'>".$record["NAME"]." - ".$record["SQUARE"]."</option>";
}
?>
@@ -102,7 +106,7 @@ if (!isset($_SESSION['VNSB'])) {
<p>
<table width="50%" border="0" cellspacing="0" cellpadding="0" style="font-family: verdana, arial; font-size: 12px">
<tr>
<td width="25%"><a href="<?=$superbowlURL?>" title="Home">Home</a></td>
<td width="25%"><a href="<?php echo $superbowlURL; ?>" title="Home">Home</a></td>
<td width="25%" align="center"><a href="randomnumber.php" title="Random Numbers">Numbers</a></td>
<td width="25%" align="center"><a href="scores.php" title="Enter scores">Scores</a></td>
<td width="25%" align="right"><a href="adminlogout.php" title="Admin logout">Logout</a></td>
@@ -126,16 +130,16 @@ if (!isset($_SESSION['VNSB'])) {
$square_list = substr_replace($square_list,"",0,2);
//echo $square_list."</br>";
$query="SELECT * FROM VNSB_squares WHERE $whereclause";
//echo $query."</br>";
$result = mysql_query($query);
$sql="SELECT * FROM `VNSB_squares` WHERE $whereclause";
//echo $sql."</br>";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
exit;
}
$USER_EMAIL_LIST = '';
while ($record = mysql_fetch_assoc($result)) {
while ($record = mysqli_fetch_assoc($result)) {
$USER_EMAIL = '';
$USER_EMAIL = $record["EMAIL"];
@@ -150,10 +154,10 @@ if (!isset($_SESSION['VNSB'])) {
$bodyMessage = "\r\nNOTIFICATION\r\n";
//echo $bodyMessage."</br>";
if ($CONFIRM==1 AND $RELEASE!=1) {
$query="UPDATE VNSB_squares SET CONFIRM='1' WHERE $whereclause";
$sql="UPDATE `VNSB_squares` SET CONFIRM='1' WHERE $whereclause";
$bodyMessage .= "Your square $square_list is now confirmed.\r\n\n";
} else if ($RELEASE==1 AND $CONFIRM!=1) {
$query="UPDATE VNSB_squares SET NAME='AVAILABLE', EMAIL='', NOTES='', DATE='', CONFIRM='0' WHERE $whereclause";
$sql="UPDATE `VNSB_squares` SET NAME='AVAILABLE', EMAIL='', NOTES='', DATE='', CONFIRM='0' WHERE $whereclause";
$bodyMessage .= "Your square $square_list selection is now released due to no payment.\r\n";
$bodyMessage .= "If this is an error, please contact me or re-select your square.\r\n\n";
} else if (($CONFIRM!=1 AND $RELEASE!=1) OR ($RELEASE==1 AND $CONFIRM==1) ) {
@@ -161,10 +165,10 @@ if (!isset($_SESSION['VNSB'])) {
echo "<p><a href='javascript:onClick=history.go(-1);'>Back</a></p>";
exit;
}
//echo $query."</br>";
$result = mysql_query($query);
//echo $sql."</br>";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
} else {
$bodyMessage .= $NOTES."\r\n\n";
$bodyMessage .= "Good Luck and enjoy the game.\r\n";
@@ -206,6 +210,6 @@ if (!isset($_SESSION['VNSB'])) {
">
</form>
</p>
<?php require "footer.inc";
<?php require "includes/footer.inc";
}
?>
+26 -21
View File
@@ -29,22 +29,27 @@ if ($email && $pass) {
exit;
}
// check input variables against database
include "config.php";
$query = "SELECT Admin_email, Admin_pwd FROM VNSB_settings";
$result = mysql_query($query);
include('includes/dbTables.inc');
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!". mysqli_connect_error());
}
$sql = "SELECT Admin_email, Admin_pwd FROM `VNSB_settings`";
$result = mysqli_query($conn, $sql);
// in case of an error, throw up an error message and exit
if (!$result) {
echo "Sorry, there is a problem with accessing your database!!!";
exit;
} else {
$record = mysql_fetch_assoc($result);
if ($email==$record['Admin_email'] AND $pass==$record['Admin_pwd']) {
$record = mysqli_fetch_assoc($result);
if ($email==$record['Admin_email'] AND md5($pass)==$record['Admin_pwd']) {
$_SESSION['VNSB']=$record['Admin_email'];
mysql_close($db);
mysqli_close($conn);
header ("Location: admin.php");
} else {
echo "<center><h1>Invalid login</h1><p><a href=\"adminlogin.php\">Admin login</a></p></center>";
mysql_close($db);
mysqli_close($conn);
exit;
}
}
@@ -53,27 +58,27 @@ if ($email && $pass) {
?>
<br />
<p>
<p style="width:60%"><strong>Welcome, Admin!</strong><br />
<p style="width:60%"><strong>Welcome, Admin!</strong><br />
If you feel that the work I've done has value to you, I would greatly appreciate a paypal donation (click button below). I have spent many hours working on this project, and I will continue its development as I find the time. Again, I am very grateful for any and all contributions.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="admin@vnlisting.com">
<input type="hidden" name="item_name" value="NFL Super Bowl Squares Scripts">
<input type="hidden" name="item_number" value="3">
<b>Enter Donation amount: $</b><input type="text" name="amount" value="" size=6>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit value="click here to Donate">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----
">
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="admin@vnlisting.com">
<input type="hidden" name="item_name" value="NFL Super Bowl Squares Scripts">
<input type="hidden" name="item_number" value="3">
<b>Enter Donation amount: $</b><input type="text" name="amount" value="" size=6>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit value="click here to Donate">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----
">
</form>
</p>
<br>
<h2>Admin login</h2>
<form method="post" action="adminlogin.php">
<p> Email: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="AdminEmail" type="text" size="30"></p>
<p> Email: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="AdminEmail" type="email" size="30"></p>
<p> Password: <input name="AdminPass" type="password" size="30"></p>
<p> <input type="submit" value="Login"></p>
</form>
+1 -1
View File
@@ -25,7 +25,7 @@
}
?>
<p><a href="index.php">Home</a></p>
<p><a href="<?php echo $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "adminlogout.php");?>">Home</a></p>
<p><a href="admin.php">Admin</a></p>
</center>
+14 -8
View File
@@ -14,8 +14,14 @@ if (!$_SESSION['VNSB']) {
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
<?php
} else {
require_once('config.php');
$superbowlURL = $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "emailall.php");
require_once('includes/dbTables.inc');
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!".mysqli_connect_error());
}
$sendemails = $_POST['sendemails'];
$LINKS = "
@@ -31,7 +37,7 @@ if (!$_SESSION['VNSB']) {
";
require "header.inc";
require "includes/header.inc";
function notify_admin ($mailto, $mailmessage, $mail_headers)
{
@@ -72,13 +78,13 @@ if (!$_SESSION['VNSB']) {
$bodyMessage .= "Good Luck and enjoy the game.\r\n";
$bodyMessage .= "The Commissioner\r\n";
$headers = "From: $ADMIN_EMAIL\r\n";
$query="SELECT * FROM VNSB_squares ORDER BY EMAIL";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_squares ORDER BY EMAIL";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
exit;
}
while ($record = mysql_fetch_assoc($result)) {
while ($record = mysqli_fetch_assoc($result)) {
if ($USER_EMAIL != $record["EMAIL"]) {
$USER_NAME = $record["NAME"];
$USER_EMAIL = $record["EMAIL"];
@@ -92,7 +98,7 @@ if (!$_SESSION['VNSB']) {
$headers = "From: $ADMIN_EMAIL\r\n";
notify_admin($ADMIN_EMAIL,$bodyMessage,$headers);
} ?>
<?php require "footer.inc";
<?php require "includes/footer.inc";
}
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

+21
View File
@@ -0,0 +1,21 @@
{
"db_host": "localhost",
"db_user": "llam",
"db_pass": "vnlisting",
"db_name": "superbowl",
"site_url": "http:\/\/172.23.49.14\/superbowl_v50",
"admin_email": "vnlisting@gmail.com",
"admin_pass": "vnlisting",
"sb_logo": "images\/sb_logo.jpg",
"afc_champ": "AFC",
"afc_champ_logo": "images\/AFC_logo.gif",
"nfc_champ": "NFC",
"nfc_champ_logo": "images\/NFC_logo.gif",
"sb_date": "Sunday, February 03, 2019",
"sb_time": "15:30",
"cost": "5",
"first": "20",
"second": "25",
"third": "20",
"final": "35"
}
+347
View File
@@ -0,0 +1,347 @@
<?php
# Creating all tables needed for this project.
# Any existing tables will be drop and recreate with default values
#=============================================================================
# Connect to database and return handle
function dbConnection() {
if (file_exists("includes/config.inc")) {
$notJSON = file_get_contents("includes/config.inc");
$tempJSON = json_decode($notJSON);
$conn = mysqli_connect($tempJSON->db_host, $tempJSON->db_user, $tempJSON->db_pass, $tempJSON->db_name);
if (!$conn) {
die("Connection failed!!!<br>".mysqli_connect_error());
} else {
return $conn;
}
} else {
echo "ERROR: Unable to connect to ".$tempJSON->db_host."<br>".mysqli_error($conn);
return FALSE;
}
}
# Table structure for table `VNSB_numbers`
function create_VNSB_numbers($conn) {
$sql = "DROP TABLE IF EXISTS `VNSB_numbers`;";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to DROP `VNSB_numbers`! <br>".mysqli_error($conn);
}
$sql = "CREATE TABLE IF NOT EXISTS `VNSB_numbers` (
`NFC` tinyint(2) DEFAULT NULL,
`AFC` tinyint(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Randomly picked numbers';
";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to CREATE `VNSB_numbers`! <br>".mysqli_error($conn);
} else {
echo "<p>`VNSB_numbers` created successfully.</p>";
}
}
# Table structure for table `VNSB_scores`
function create_VNSB_scores($conn) {
$sql = "DROP TABLE IF EXISTS `VNSB_scores`;";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to DROP `VNSB_scores`! <br>".mysqli_error($conn);
}
$sql = "CREATE TABLE IF NOT EXISTS `VNSB_scores` (
`ID` tinyint(2) NOT NULL,
`NFC_FIRST` varchar(2) DEFAULT NULL,
`AFC_FIRST` varchar(2) DEFAULT NULL,
`NFC_HALF` varchar(2) DEFAULT NULL,
`AFC_HALF` varchar(2) DEFAULT NULL,
`NFC_THIRD` varchar(2) DEFAULT NULL,
`AFC_THIRD` varchar(2) DEFAULT NULL,
`NFC_FINAL` varchar(2) DEFAULT NULL,
`AFC_FINAL` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to CREATE `VNSB_scores`! <br>".mysqli_error($conn);
} else {
echo "<p>`VNSB_scores` created successfully.</p>";
}
}
# Table structure for table `VNSB_squares`
function create_VNSB_squares($conn) {
$sql = "DROP TABLE IF EXISTS `VNSB_squares`;";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to DROP `VNSB_squares`! <br>".mysqli_error($conn);
}
$sql = "CREATE TABLE IF NOT EXISTS `VNSB_squares` (
`SQUARE` varchar(15) NOT NULL DEFAULT '',
`NAME` varchar(30) NOT NULL DEFAULT 'AVAILABLE',
`EMAIL` varchar(45) DEFAULT NULL,
`NOTES` text,
`DATE` datetime DEFAULT CURRENT_TIMESTAMP,
`CONFIRM` tinyint(1) NOT NULL DEFAULT '0',
`FIRST` tinyint(1) NOT NULL DEFAULT '0',
`HALF` tinyint(1) NOT NULL DEFAULT '0',
`THIRD` tinyint(1) NOT NULL DEFAULT '0',
`FINAL` tinyint(1) NOT NULL DEFAULT '0',
UNIQUE KEY `SQUARE` (`SQUARE`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Super Bowl Squares';
";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to CREAT `VNSB_squares`! <br>".mysqli_error($conn);
} else {
for ($l=0; $l < 100; $l++) {
$sql = "INSERT INTO `VNSB_squares` VALUES ('".sprintf("%02d", $l)."', 'AVAILABLE', NULL, NULL, NULL, 0, 0, 0, 0, 0);";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to populate squares! <br>".mysqli_error($conn);
}
}
echo "<p>`VNSB_squares` created successfully.</p>";
}
}
# Table structure for table `VNSB_settings`
function create_VNSB_settings() {
$VERSION = "5.0";
if (file_exists("includes/config.inc")) {
$notJSON = file_get_contents("includes/config.inc");
$tempJSON = json_decode($notJSON);
$conn = mysqli_connect($tempJSON->db_host, $tempJSON->db_user, $tempJSON->db_pass, $tempJSON->db_name);
if (!$conn) {
die("Connection failed!!!<br>".mysqli_connect_error());
} else {
$sql = "DROP TABLE IF EXISTS `VNSB_settings`;";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to DROP `VNSB_settings`! <br>".mysqli_error($conn);
}
$sql = "CREATE TABLE IF NOT EXISTS `VNSB_settings` (
`sb_date` varchar(30) NOT NULL DEFAULT 'Sunday, February 7, 2021',
`sb_time` varchar(30) NOT NULL DEFAULT '3:30 PM',
`sb_logo` varchar(30) DEFAULT NULL,
`NFC_team` varchar(30) DEFAULT NULL,
`NFC_logo` varchar(80) DEFAULT NULL,
`AFC_team` varchar(30) DEFAULT NULL,
`AFC_logo` varchar(80) DEFAULT NULL,
`Bet` varchar(5) NOT NULL DEFAULT '5.00',
`Win_first` tinyint(2) NOT NULL DEFAULT '20',
`Win_second` tinyint(2) NOT NULL DEFAULT '25',
`Win_third` tinyint(2) NOT NULL DEFAULT '20',
`Win_final` tinyint(2) NOT NULL DEFAULT '35',
`Version` char(3) NOT NULL DEFAULT '5.0',
`Admin_email` varchar(80) NOT NULL DEFAULT 'admin@email.com',
`Admin_pwd` varchar(80) NOT NULL DEFAULT 'password',
PRIMARY KEY (`sb_date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Setting for VN SuperBowl Squares';
";
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to CREATE `VNSB_settings`! <br>".mysqli_error($conn);
} else {
echo "<p>`VNSB_settings` created successfully.</p>";
}
# populate table
$sql = "INSERT INTO `VNSB_settings` VALUES ('".$tempJSON->sb_date."', '".$tempJSON->sb_time."', '".$tempJSON->sb_logo."', '".$tempJSON->nfc_champ."', '".$tempJSON->nfc_champ_logo."', '".$tempJSON->afc_champ."', '".$tempJSON->afc_champ_logo."', '".$tempJSON->cost."', '".$tempJSON->first."', '".$tempJSON->second."', '".$tempJSON->third."', '".$tempJSON->final."', '".$VERSION."', '".$tempJSON->admin_email."', '".md5($tempJSON->admin_pass)."');";
# echo $sql;
if (!mysqli_query($conn, $sql)) {
echo "ERROR: Unable to populate 'VNSB_settings's! <br>".mysqli_error($conn);
}
}
# $mysqli_close($conn);
} else {
echo "ERROR: Configuration file does not existi or required fields are missing!";
}
}
# databse
function dbInquery() {
if (file_exists("includes/config.inc")) {
# Read back json file
$myJSON = file_get_contents("includes/config.inc");
$notJSON = json_decode($myJSON);
$db_host = $notJSON->db_host;
$db_user = $notJSON->db_user;
$db_pass = $notJSON->db_pass;
$db_name = $notJSON->db_name;
} else {
$db_host = "localhost";
$db_user = "vnsb";
$db_pass = "vnlisting";
$db_name = "superbowl";
}
echo "<p>Minimum PHP version 5.5.9 recommeneded.<br>";
if (version_compare(PHP_VERSION, '5.5.9') >= 0) {
echo "Your PHP version: <b>".PHP_VERSION."</b></p>";
} else {
echo "Your PHP version: <b>".PHP_VERSION."</b><br>DOES NOT MEET MINIMUM RECOMENDATION</p>";
}
echo('
<form method="post" action="">
<fieldset style="width:450px; border: #6699ff 1px solid"><legend style="color:#6699ff">&nbsp; mySQL &nbsp;</legend>
<table cellpadding="0" cellspacing="10" style="width:450px">
<tr><td>Hostname:</td>
<td><input type="text" name="db_host" size="40" maxlength="40" value="'. $db_host. '"></input>
</td></tr>
<tr><td>Username:</td>
<td><input type="text" name="db_user" size="40" maxlength="40" value="'. $db_user. '"></input>
</td></tr>
<tr><td>Password:</td>
<td><input type="password" name="db_pass" size="40" maxlength="40" value"'. $db_pass. '"></input>
</td></tr>
<tr><td>Database:</td>
<td><input type="text" name="db_name" size="40" maxlength="40" value="'. $db_name. '"></input>
</td></tr>
<tr><td colspan="2"><p align="center"><input type="submit" name="DBsubmit" value="Submit"></input></p> </td></tr>
</table>
<p><u>Warning:</u> Any existing databse with the same name will be deleted!</p>
</fieldset>
</form>
');
}
# Admin
function adminInquery() {
if (file_exists("includes/config.inc")) {
# Read back json file
$myJSON = file_get_contents("includes/config.inc");
$notJSON = json_decode($myJSON);
$admin_email = $notJSON->admin_email;
$admin_pass = $notJSON->admin_pass;
$site_url = $notJSON->site_url;
} else {
$admin_email = "admin@email.com";
$admin_pass = "password";
$site_url = $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "setup.php");
}
echo('
<form method="post" action="">
<fieldset style="width:450px; border: #6699ff 1px solid"><legend style="color:#6699ff">&nbsp; Admin &nbsp;</legend>
<table cellpadding="0" cellspacing="10" style="width: 450px">
<tr><td width="30%">Site URL:</td>
<td width="70%"><input type="url" name="site_url" size="30" maxlength="80" value="'. $site_url .'"></input>
</td></tr>
<tr><td>Admin Email:</td>
<td><input type="email" name="admin_email" size="30" maxlength="80" value="'. $admin_email .'"></input>
</td></tr>
<tr><td>Admin Password:</td>
<td><input type="password" name="admin_pass" size="30" maxlength="40" value"'. $admin_pass .'"></input>
</td></tr>
<tr><td colspan="2"><p align="center"><input type="submit" name="ADsubmit" value="Submit"></input></p> </td></tr>
</table>
</fieldset>
</form>
');
}
# configuration
function configInquery() {
if (file_exists("includes/config.inc")) {
# Read back json file
$myJSON = file_get_contents("includes/config.inc");
$notJSON = json_decode($myJSON);
$sb_logo = $notJSON->sb_logo;
$afc_champ = $notJSON->afc_champ;
$afc_champ_logo = $notJSON->afc_champ_logo;
$nfc_champ = $notJSON->nfc_champ;
$nfc_champ_logo = $notJSON->nfc_champ_logo;
$sb_date = $notJSON->sb_date;
$sb_time = $notJSON->sb_time;
$cost = $notJSON->cost;
$first = $notJSON->first;
$second = $notJSON->second;
$third = $notJSON->third;
$final = $notJSON->final;
$cost_total = (float)$cost * 100;
$first_value = ((int)$first * $cost_total) / 100;
$second_value = ((int)$second * $cost_total) / 100;
$third_value = ((int)$third * $cost_total) / 100;
$final_value = ((int)$final * $cost_total) / 100;
} else {
$sb_logo = "images/sb_logo.jpg";
$afc_champ = "AFC";
$afc_champ_logo = "images/AFC_logo.gif";
$nfc_champ = "NFC";
$nfc_champ_logo = "images/NFC_logo.gif";
$sb_date = "Sunday, February 7, 2021";
$sb_time = "3:30PM";
$cost = "5";
$first = "20";
$second = "25";
$third = "20";
$final = "35";
$cost_total = (int)$cost * 100;
$first_value = ((int)$first * $cost_total) / 100;
$second_value = ((int)$second * $cost_total) / 100;
$third_value = ((int)$third * $cost_total) / 100;
$final_value = ((int)$final * $cost_total) / 100;
}
echo('
<form method="post" action="">
<fieldset style="width:450px; border: #6699ff 1px solid"><legend style="color:#6699ff">&nbsp; NFL &nbsp;</legend>
<table cellpadding="0" cellspacing="10" style="width: 450px">
<tr><td>Super Bowl Logo:</td>
<td><input type="text" name="sb_logo" size="30" maxlength="80" value="'. $sb_logo .'"></input>
</td></tr>
<tr><td>AFC Champion:</td>
<td><input type="text" name="afc_champ" size="30" maxlength="30" value="'. $afc_champ .'"></input>
</td></tr>
<tr><td>AFC Logo:</td>
<td><input type="text" name="afc_champ_logo" size="30" maxlength="80" value="'. $afc_champ_logo .'"></input>
</td></tr>
<tr><td>NFC Champion:</td>
<td><input type="text" name="nfc_champ" size="30" maxlength="30" value="'. $nfc_champ .'"></input>
</td></tr>
<tr><td>NFC Logo:</td>
<td><input type="text" name="nfc_champ_logo" size="30" maxlength="80" value="'. $nfc_champ_logo .'"></input>
</td></tr>
<tr><td>Super Bowl Date:</td>
<td><input type="date" name="sb_date" size="30" maxlength="30" value="'. $sb_date .'"></input>
</td></tr>
<tr><td>Super Bowl Time:</td>
<td><input type="time" name="sb_time" size="30" maxlength="30" value="'. $sb_time .'"></input>
</td></tr>
</table>
</fieldset>
<fieldset style="width:450px; border: #6699ff 1px solid"><legend style="color:#6699ff">&nbsp; Payout &nbsp;</legend>
<table cellpadding="0" cellspacing="10" style="width: 450px">
<tr><td>Cost per square:</td>
<td>$ <input type="text" name="cost" size="5" maxlength="5" value="'. $cost .'"></input> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ <input type="text" name="cost_total" size="5" maxlength="5" value="'. $cost_total .'" disabled></input>
</td></tr>
<tr><td>1st quarter:</td>
<td>% <input type="text" name="first" size="5" maxlength"5" value="'. $first .'"></input> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ <input type="text" name="first_value" size="5" maxlength="5" value="'. $first_value .'" disabled></input>
</td></tr>
<tr><td>2nd quarter:</td>
<td>% <input type="text" name="second" size="5" maxlength="5" value="'. $second .'"></input> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ <input type="text" name="second_value" size="5" maxlength="5" value="'. $second_value .'" disabled></input>
</td></tr>
<tr><td>3rd quarter:</td>
<td>% <input type="text" name="third" size="5" maxlength="5" value="'. $third .'"></input> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ <input type="text" name="third_value" size="5" maxlength="5" value="'. $third_value .'" disabled></input>
</td></tr>
<tr><td>Final:</td>
<td>% <input type="text" name="final" size="5" maxlength="5" value="'. $final .'"></input> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ <input type="text" name="final_value" size="5" maxlength="5" value="'. $final_value .'" disabled></input>
</td></tr>
</table>
</fieldset>
<p align="center"><input type="submit" name="VNsubmit" value="Submit"></input></p>
</form>
');
}
?>
+19
View File
@@ -0,0 +1,19 @@
<!--
www.vnlisting.com
Online Super Bowl Squares Script
Please read the "Readme.txt for license agreement, installation and usage instructions
-->
<!-- You may not and shall not make any changes to this file -->
<p>
<table width="95%" style="font-family: verdana, arial; font-size: 9px">
<tr>
<td>Copyright &copy; 2004-<?=date("Y")?> <a href="http://www.vnlisting.com/freescripts.php" title="Vietnamese Business Directory" target="_parent">VNLISTING</a></td>
<td align="right"><a href="http://www.vnlisting.com/freescripts.php" title="Download & Support" target="_parent">VNSB Squares <?=$VERSION?></a></td>
</tr>
</table>
</p>
</center>
<?php mysqli_close($conn); ?>
</body>
</html>
+58
View File
@@ -0,0 +1,58 @@
<!--
www.vnlisting.com
Online Super Bowl Squares Script
Please read the "Readme.txt for license agreement, installation and usage instructions
Version: 5.0 2/7/2019
-->
<?php
$VERSION = "5.0";
$sql="SELECT * FROM VNSB_settings";
$result = mysqli_query($conn, $sql);
if ($record = mysqli_fetch_assoc($result)) {
$SB_DATE = $record['sb_date'];
$SB_TIME = $record['sb_time'];
$SB_LOGO = $record['sb_logo'];
$NFC_TEAM = $record['NFC_team'];
$NFC_LOGO = $record['NFC_logo'];
$AFC_TEAM = $record['AFC_team'];
$AFC_LOGO = $record['AFC_logo'];
# $VERSION = $record['Version'];
$ADMIN_EMAIL = $record['Admin_email'];
$ADMIN_PASSWORD = $record['Admin_pwd'];
$ADMIN_VERIFY = $record['Admin_verify'];
$BET = $record['Bet'];
$WIN_FIRST = $record['Win_first'];
$WIN_SECOND = $record['Win_second'];
$WIN_THIRD = $record['Win_third'];
$WIN_FINAL = $record['Win_final'];
$FIRST = (100 * (int)$BET ) * ((int)$WIN_FIRST/100);
$SECOND = (100 * (int)$BET ) * ((int)$WIN_SECOND/100);
$THIRD = (100 * (int)$BET ) * ((int)$WIN_THIRD/100);
$FINAL = (100 * (int)$BET ) * ((int)$WIN_FINAL/100);
} else {
//echo mysql_error();
echo "<br/>Sorry, Technical problem occurred... Can't read from database.<br><br> Please notify this site admin</a>";
exit;
}
?>
<html>
<head>
<title>VNLISTING :: Online Super Bowl Squares v5.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="VNLISTING, superbowl squares, super bowl, nfl squares online, free softwares, free scripts, superbowl scripts"/>
<meta name="description" content="The one and only fun and free NFL Super Bowl Squares Online."/>
<meta name="robots" content="index,nofollow"/>
</head>
<body bgcolor="" link="#0033CC" vlink="#0033CC" alink="#CC0000" leftmargin="0" topmargin="10" marginwidth="0" marginheight="0">
<!--body bgcolor="#99CCFF" link="#0033CC" vlink="#0033CC" alink="#CC0000" leftmargin="0" topmargin="10" marginwidth="0" marginheight="0"-->
<center>
<p>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="<?php echo $SB_LOGO?>" border="0" title="Super Bowl Squares"></td>
<td align="center"><h2><font color="#009900"><?php echo $SB_DATE?><br><?php echo $SB_TIME?></font></h2></td>
<td align="right"><img src="<?php echo $AFC_LOGO; ?>" border="0" title="<?php echo $AFC_TEAM; ?>">&nbsp;&nbsp; <b><font size="+2">vs</font></b> &nbsp;&nbsp;<img src="<?php echo $NFC_LOGO; ?>" border="0" title="<?php echo $NFC_TEAM; ?>"></td>
</tr>
</table>
<br/>
+25 -37
View File
@@ -2,10 +2,17 @@
www.vnlisting.com
Online Super Bowl Squares Script
Please read the "Readme.txt for license agreement, installation and usage instructions
Version: 4.2 1/24/2013
Version: 5.0 2/7/2019
-->
<?php
require_once('config.php');
require_once('includes/dbTables.inc');
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!".mysqli_connect_error());
}
$NFC = array();
$AFC = array();
$cnt = 0;
@@ -13,27 +20,27 @@ for ($i=1; $i<=10; $i++) {
$NFC[$i]="";
$AFC[$i]="";
}
$query="SELECT * FROM VNSB_numbers";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_numbers";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
exit;
}
while ($record = mysql_fetch_assoc($result)) {
while ($record = mysqli_fetch_assoc($result)) {
$cnt++;
$NFC[$cnt]=$record['NFC'];
$AFC[$cnt]=$record['AFC'];
}
$query="SELECT * FROM VNSB_scores";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_scores ORDER BY ID DESC LIMIT 1";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
exit;
}
$scores = mysql_fetch_assoc($result);
$scores = mysqli_fetch_assoc($result);
$NFC_FIRST=$scores['NFC_FIRST'];
$AFC_FIRST=$scores['AFC_FIRST'];
$NFC_HALF=$scores['NFC_HALF'];
@@ -43,31 +50,12 @@ $AFC_THIRD=$scores['AFC_THIRD'];
$NFC_FINAL=$scores['NFC_FINAL'];
$AFC_FINAL=$scores['AFC_FINAL'];
/* moved to header from 4.2
$query="SELECT * FROM VNSB_settings";
$result = mysql_query($query);
if ($record = mysql_fetch_assoc($result)) {
$BET = $record['Bet'];
$WIN_FIRST = $record['Win_first'];
$WIN_SECOND = $record['Win_second'];
$WIN_THIRD = $record['Win_third'];
$WIN_FINAL = $record['Win_final'];
$FIRST = (100 * (int)$BET ) * ((int)$WIN_FIRST/100);
$SECOND = (100 * (int)$BET ) * ((int)$WIN_SECOND/100);
$THIRD = (100 * (int)$BET ) * ((int)$WIN_THIRD/100);
$FINAL = (100 * (int)$BET ) * ((int)$WIN_FINAL/100);
} else {
echo mysql_error();
exit;
}
*/
?>
<?php require "header.inc"; ?>
<?php require "includes/header.inc"; ?>
<!--<p align="center">This is the live demo. Use real email to see the script at work.</p>-->
<table width="95%" border="1" cellspacing="1" cellpadding="5" style="font-family: Verdana,Ariel; font-size: 10px; color:#0066CC;">
<tr>
<td align="center" style="border-top: none; border-left: none;"><img src="NFL-logo.gif" title="National Football League" border="0" /></td>
<td align="center" style="border-top: none; border-left: none;"><img src="images/NFL-logo.gif" title="National Football League" border="0" /></td>
<?php
for ($i=1; $i<=10; $i++) {
echo "<td align=\"center\" style=\"font-size:12px; color:#232B85; font-weight:bold\">".$NFC_TEAM."<br>".$NFC[$i]."</td>";
@@ -78,16 +66,16 @@ if ($record = mysql_fetch_assoc($result)) {
<form name="sqSelect" method="post" action="signup.php">
<?php
$query="SELECT * FROM VNSB_squares ORDER BY SQUARE";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_squares ORDER BY SQUARE";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
exit;
}
$cnt_row = 0;
$i=0;
$closed=1;
while ($record = mysql_fetch_assoc($result)) {
while ($record = mysqli_fetch_assoc($result)) {
if ($cnt_row==0) {$i++; echo"<td align=\"center\" style=\"font-size:12px; color:#DB2824; font-weight:bold\">".$AFC_TEAM."<br/>".$AFC[$i]."</td>";}
if ($record['NAME'] == "AVAILABLE") {
@@ -154,8 +142,8 @@ Check all your desired squares and click Submit to enter your information<br />
<li><strong>$<?=$BET?></strong> per square</li>
<li>You can buy as many squares as you want</li>
<li>Your square(s) is/are not guaranteed until your payment is verified</li>
<li>Numbers will be randomly draw and assigned after all squares are taken</li>
<li>When confirmed, your square(s) will be changed to <font color="#009900"><strong>GREEN</strong></font></li>
<li>Numbers will be randomly draw and assigned after all squares are taken</li>
</td>
<td align="center" width="27%" valign="top">
<table width="100%" style="font-family: Verdana,Ariel; font-size: 12px; border: #009900 1px solid">
@@ -192,4 +180,4 @@ Check all your desired squares and click Submit to enter your information<br />
</table>
</p>
<?php require "footer.inc"; ?>
<?php require "includes/footer.inc"; ?>
+22 -17
View File
@@ -2,7 +2,6 @@
www.vnlisting.com
Online Super Bowl Squares Script
Please read the "Readme.txt for license agreement, installation and usage instructions
Version: 4.1 1/9/2012
-->
<?php
@ob_start();
@@ -12,8 +11,14 @@ if (!$_SESSION['VNSB']) {
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
<?php
} else {
$superbowlURL = $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "randomnumber.php");
require_once('includes/dbTables.inc');
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!".mysqli_connect_error());
}
require_once('config.php');
$RANDOM = $_REQUEST['randomnumber'];
$LINKS = "
@@ -28,7 +33,7 @@ if (!$_SESSION['VNSB']) {
</p>
";
require "header.inc";
require "includes/header.inc";
echo "
<h1>Numbers Assignment</h1>
@@ -38,9 +43,9 @@ if (!$_SESSION['VNSB']) {
";
// makesure all squares are selected
$query="SELECT * FROM VNSB_squares WHERE `NAME`='AVAILABLE'";
$result = mysql_query($query);
if ($record = mysql_fetch_assoc($result)) {
$sql="SELECT * FROM VNSB_squares WHERE `NAME`='AVAILABLE'";
$result = mysqli_query($conn, $sql);
if ($record = mysqli_fetch_assoc($result)) {
echo "<br><h2 style=\"color: #ff0000\">Squares are still available!!!</h2><br>";
echo $LINKS;
require "footer.inc";
@@ -48,9 +53,9 @@ if (!$_SESSION['VNSB']) {
}
// stop if numbers existed
$query="SELECT * FROM VNSB_numbers";
$result = mysql_query($query);
if ($record = mysql_fetch_assoc($result)) {
$sql="SELECT * FROM VNSB_numbers";
$result = mysqli_query($conn, $sql);
if ($record = mysqli_fetch_assoc($result)) {
echo "<br><h2 style=\"color: #ff0000\">Numbers already exist!!!</h2><br>";
echo $LINKS;
require "footer.inc";
@@ -107,15 +112,15 @@ if (!$_SESSION['VNSB']) {
</tr>
<tr>";
$query="SELECT * FROM VNSB_squares ORDER BY SQUARE";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_squares ORDER BY SQUARE";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
exit;
}
$cnt_row = 0;
$i=0;
while ($record = mysql_fetch_assoc($result)) {
while ($record = mysqli_fetch_assoc($result)) {
if ($cnt_row==0) {$i++; echo"<td align='center'> $AFC_TEAM<br/><font size='3' color=\"red\"><strong>".$AFC[$i]."</strong></font> </td>";}
if ($record['NAME'] == "AVAILABLE") {
echo "<td width='10%' title='only $".$BET."'><a href=\"signup.php?square=".$record['SQUARE']."\">".stripslashes($record['NAME'])."<br/>".$record['SQUARE']."</a></td>";
@@ -145,10 +150,10 @@ if (!$_SESSION['VNSB']) {
// save to database
if (isset($RANDOM)) {
for ($n=1; $n<=10; $n++) {
$query="INSERT INTO VNSB_numbers (NFC, AFC) VALUES ('".$NFC[$n]."','".$AFC[$n]."')";
$result = mysql_query($query);
$sql="INSERT INTO VNSB_numbers (NFC, AFC) VALUES ('".$NFC[$n]."','".$AFC[$n]."')";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
echo "<p>PROBLEM WRITING NUMBERS INTO DATABASE!</p>";
exit;
}
@@ -156,7 +161,7 @@ if (!$_SESSION['VNSB']) {
}
echo $LINKS;
require "footer.inc";
require "ncludes/footer.inc";
}
?>
+94 -94
View File
@@ -12,43 +12,12 @@ if (!$_SESSION['VNSB']) {
www.vnlisting.com
Online Super Bowl Squares Script
Please read the "Readme.txt for license agreement, installation and usage instructions
Version: 4.2 1/24/2013
TODO:
- email winners
- "0" score is not working
Version: 4.3 1/29/2019
-->
<?php
require_once('config.php');
require "header.inc";
$EMAIL = $_REQUEST['m'];
$NFC = array();
$AFC = array();
$NAME = array();
$NFC_1 = $_POST['NFC_1'];
$NFC_2 = $_POST['NFC_2'];
$NFC_3 = $_POST['NFC_3'];
$NFC_4 = $_POST['NFC_4'];
$AFC_1 = $_POST['AFC_1'];
$AFC_2 = $_POST['AFC_2'];
$AFC_3 = $_POST['AFC_3'];
$AFC_4 = $_POST['AFC_4'];
// Update
if (isset($_REQUEST['addscores'])) {
$query="INSERT INTO VNSB_scores (NFC_FIRST, NFC_HALF, NFC_THIRD, NFC_FINAL, AFC_FIRST, AFC_HALF, AFC_THIRD, AFC_FINAL) VALUES ($NFC_1, $NFC_2, $NFC_3, $NFC_4, $AFC_1, $AFC_2, $AFC_3, $AFC_4)";
$result = mysql_query($query);
if (!$result) {
echo mysql_error();
echo "<BR>Sorry, Technical problem occurred... your scores were not added.<br><br> Email this problem to <a href=\"mailto:".$ADMIN_EMAIL."\">".$ADMIN_EMAIL."</a>";
exit;
}
}
$superbowlURL = $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "scores.php");
function email_notify ($mailto)
{
@@ -62,14 +31,45 @@ function email_notify ($mailto)
mail("$mailto", "$mail_subject", "$mailmessage", "$mail_headers");
}
$query="SELECT * FROM `VNSB_scores`";
$result = mysql_query($query);
if (!$result) {
echo mysql_error();
exit;
require_once('includes/dbTables.inc');
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!".mysqli_connect_error());
}
require "includes/header.inc";
$EMAIL = $_REQUEST['m'];
$NFC = array();
$AFC = array();
$NAME = array();
$NFC_1 = $_POST['NFC_1'];
$NFC_2 = $_POST['NFC_2'];
$NFC_3 = $_POST['NFC_3'];
$NFC_4 = $_POST['NFC_4'];
$AFC_1 = $_POST['AFC_1'];
$AFC_2 = $_POST['AFC_2'];
$AFC_3 = $_POST['AFC_3'];
$AFC_4 = $_POST['AFC_4'];
// Update
if (isset($_REQUEST['addscores'])) {
$sql="INSERT INTO `VNSB_scores` VALUES (NULL, '".$NFC_1."', '".$AFC_1."', '".$NFC_2."', '".$AFC_2."', '".$NFC_3."', '".$AFC_3."', '".$NFC_4."', '".$AFC_4."');";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo "<p>Sorry, Technical problem occurred... Scores were not added.</p>". mysqli_error($conn);
}
}
$scores = mysql_fetch_assoc($result);
$sql="SELECT * FROM `VNSB_scores` ORDER BY ID DESC LIMIT 1";
$result = mysqli_query($conn, $sql);
if (!$result) {
die("ERROR: Unable to read record from 'VNSB_scores'!. <br>". mysqli_error($conn));
}
$scores = mysqli_fetch_assoc($result);
$NFC_FIRST=$scores['NFC_FIRST'];
$AFC_FIRST=$scores['AFC_FIRST'];
$NFC_HALF=$scores['NFC_HALF'];
@@ -79,33 +79,32 @@ $AFC_THIRD=$scores['AFC_THIRD'];
$NFC_FINAL=$scores['NFC_FINAL'];
$AFC_FINAL=$scores['AFC_FINAL'];
if (!isset($NFC_FINAL) && !isset($AFC_FINAL) ) { $ADD_SCORES = 1; } else { $ADD_SCORES = 0; };
#if (!isset($NFC_FINAL) && !isset($AFC_FINAL) ) { $ADD_SCORES = 1; } else { $ADD_SCORES = 0; };
if ($NFC_FINAL==NULL || $AFC_FINAL==NULL) { $ADD_SCORES = 1; } else { $ADD_SCORES = 0; };
//Get assigned numbers
$query="SELECT * FROM VNSB_numbers";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_numbers";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
exit;
die("ERROR: Unable to read records from 'VNSB_numbers'!. <br>". mysqli_error($conn));
}
$cnt=0;
while ($record = mysql_fetch_assoc($result)) {
$cnt++;
$NFC[$cnt]=$record['NFC'];
$AFC[$cnt]=$record['AFC'];
while ($record = mysqli_fetch_assoc($result)) {
$cnt++;
$NFC[$cnt]=$record['NFC'];
$AFC[$cnt]=$record['AFC'];
}
// Get name for each squares
$query="SELECT * FROM VNSB_squares";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_squares";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
exit;
die("ERROR: Unable to read records from 'VNSB_squares'!. <br>". mysqli_error($conn));
}
while ($record = mysql_fetch_assoc($result)) {
$NAME[$record['SQUARE']] = $record['NAME'];
$EMAIL[$record['SQUARE']] = $record['EMAIL'];
while ($record = mysqli_fetch_assoc($result)) {
$NAME[$record['SQUARE']] = $record['NAME'];
$EMAIL[$record['SQUARE']] = $record['EMAIL'];
}
@@ -118,10 +117,14 @@ if ($ADD_SCORES) {
<tr>
<tr>
<td align="right" valign="bottom" style="color:#232b85; font-weight:bold"><?php echo $NFC_TEAM ?></td>
<td align="center" style="font-weight:bold;">First<br><input type="text" name="NFC_1" size="5" maxlength="2" value="<?php echo $NFC_FIRST ?>"></input></td>
<td align="center" style="font-weight:bold;">Half<br><input type="text" name="NFC_2" size="5" maxlength="2" value="<?php echo $NFC_HALF ?>"></input></td>
<td align="center" style="font-weight:bold;">Third<br><input type="text" name="NFC_3" size="5" maxlength="2" value="<?php echo $NFC_THIRD ?>"></input></td>
<td align="center" style="font-weight:bold;">Final<br><input type="text" name="NFC_4" size="5" maxlength="2" value="<?php echo $NFC_FINAL ?>"></input></td>
<td align="center" style="font-weight:bold;">First<br>
<input type="text" name="NFC_1" size="5" maxlength="2" value="<?php echo $NFC_FIRST ?>"></input></td>
<td align="center" style="font-weight:bold;">Half<br>
<input type="text" name="NFC_2" size="5" maxlength="2" value="<?php echo $NFC_HALF ?>"></input></td>
<td align="center" style="font-weight:bold;">Third<br>
<input type="text" name="NFC_3" size="5" maxlength="2" value="<?php echo $NFC_THIRD ?>"></input></td>
<td align="center" style="font-weight:bold;">Final<br>
<input type="text" name="NFC_4" size="5" maxlength="2" value="<?php echo $NFC_FINAL ?>"></input></td>
</tr>
<tr>
<td align="right" style="color:#db2824; font-weight:bold"><?php echo $AFC_TEAM ?></td>
@@ -175,39 +178,35 @@ if ($ADD_SCORES) {
<?php
echo "<p>";
// Display only on date of superbowl or later
// sb_date in the VNSB_settings must be in this format (February 3, 2013) for this to work correctly
if ( (strtotime(trim($SB_DATE)) <= strtotime(date("F j, Y"))) && ( $NFC_FIRST && $AFC_FIRST ) ) {
# Notify winners
echo ('<a href="'.$REQUEST_URI.'?m=yes">email winners</a>');
echo ('<a href="'.$REQUEST_URI.'?m=yes">email winners</a>');
$cnt=0;
for ($y=1; $y<=10; $y++) {
for ($x=1; $x<=10; $x++) {
if ($cnt<10) { $square = "0".$cnt; } else { $square = $cnt; }
if ( ($NFC[$x] == substr($NFC_FIRST, -1)) && ($AFC[$y] == substr($AFC_FIRST, -1)) && ( $NFC_FIRST && $AFC_FIRST ) ) {
echo "<p>1st Quarter Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysql_query("UPDATE VNSB_squares SET FIRST='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
if ( ($NFC[$x] == substr($NFC_HALF, -1)) && ($AFC[$y] == substr($AFC_HALF, -1)) && ( $NFC_HALF && $AFC_HALF ) ) {
echo "<p>Halftime Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysql_query("UPDATE VNSB_squares SET HALF='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
if ( ($NFC[$x] == substr($NFC_THIRD, -1)) && ($AFC[$y] == substr($AFC_THIRD, -1)) && ( $NFC_THIRD && $AFC_THIRD ) ) {
echo "<p>3rd Quarter Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysql_query("UPDATE VNSB_squares SET THIRD='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
if ( ($NFC[$x] == substr($NFC_FINAL, -1)) && ($AFC[$y] == substr($AFC_FINAL, -1) && ( $NFC_FINAL && $AFC_FINAL )) ) {
echo "<p>Final Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysql_query("UPDATE VNSB_squares SET FINAL='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
$cnt++;
}
$cnt=0;
for ($y=1; $y<=10; $y++) {
for ($x=1; $x<=10; $x++) {
if ($cnt<10) { $square = "0".$cnt; } else { $square = $cnt; }
if ( ($NFC[$x] == substr($NFC_FIRST, -1)) && ($AFC[$y] == substr($AFC_FIRST, -1)) && ( $NFC_FIRST && $AFC_FIRST ) ) {
echo "<p>1st Quarter Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysqli_query("UPDATE VNSB_squares SET FIRST='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
if ( ($NFC[$x] == substr($NFC_HALF, -1)) && ($AFC[$y] == substr($AFC_HALF, -1)) && ( $NFC_HALF && $AFC_HALF ) ) {
echo "<p>Halftime Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysqli_query("UPDATE VNSB_squares SET HALF='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
if ( ($NFC[$x] == substr($NFC_THIRD, -1)) && ($AFC[$y] == substr($AFC_THIRD, -1)) && ( $NFC_THIRD && $AFC_THIRD ) ) {
echo "<p>3rd Quarter Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysqli_query("UPDATE VNSB_squares SET THIRD='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
if ( ($NFC[$x] == substr($NFC_FINAL, -1)) && ($AFC[$y] == substr($AFC_FINAL, -1) && ( $NFC_FINAL && $AFC_FINAL )) ) {
echo "<p>Final Winner ($NFC[$x],$AFC[$y]) &nbsp;&nbsp;&nbsp; Square #$square (".$NAME[$square].")</p>";
mysqli_query("UPDATE VNSB_squares SET FINAL='1' WHERE SQUARE='$square' LIMIT 1");
if ( $EMAIL=="yes" ) { notify_email($EMAIL[$square]); }
}
$cnt++;
}
}
echo "</p>";
@@ -215,11 +214,12 @@ echo "</p>";
<p><br><br>
<table width="50%" border="0" cellspacing="0" cellpadding="0" style="font-family: verdana, arial; font-size: 12px">
<tr>
<td width="33%"><a href="<?=$superbowlURL?>" title="Administrator">Home</a></td>
<td width="34%" align="center"><a href="./admin.php" title="Administrator">Admin</a></td>
<td width="33%" align="right"><a href="adminlogout.php" title="Admin logout">Logout</a></td>
<td width="25%"><a href="<?=$superbowlURL?>" title="Administrator">Home</a></td>
<td width="25%" align="center"><a href="admin.php" title="Administrator">Admin</a></td>
<td width="25%" align="center"><a href="scores.php" title="Enter scores">Scores</a></td>
<td width="25%" align="right"><a href="adminlogout.php" title="Admin logout">Logout</a></td>
</tr>
</table>
</p>
<?php require "footer.inc"; ?>
<?php require "includes/footer.inc"; ?>
+177
View File
@@ -0,0 +1,177 @@
<?php
# VNSB Super Bowl Squares Installation.
# Create a new database for this project.
# Copy all files to your server/host location.
# Run this file to start the installation and setup.
#========================================================
?>
<HTML>
<head>
<title>VNSB - Super Bowl Quares - Installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<p><a href="http://www.vnlisting.com/freescripts.php"><img src="images/VNLogo.gif"></a></p>
<p style="font-size:24px; font-weight:bold">Super Bowl Squares<br>Installation</p>
<?php
require("includes/dbTables.inc");
if ($_REQUEST['DBsubmit']) {
if ($_POST['db_host'] && $_POST['db_user'] && $_POST['db_pass'] && $_POST['db_name']) {
# Create connection
$dbconn = mysqli_connect($_POST['db_host'], $_POST['db_user'], $_POST['db_pass']);
if (!$dbconn) {
die("ERROR: Unable to connect to host!!!<br>".mysqli_connect_error());
} else {
# Create database
$sql = "CREATE DATABASE IF NOT EXISTS ".$_POST['db_name'];
if (!mysqli_query($dbconn, $sql)) {
die("ERROR: Unable to create new database!!!<br>".mysqli_connect_error());
}
mysqli_close($dbconn);
sleep(2);
# Create connection for tables
$conn = mysqli_connect($_POST['db_host'], $_POST['db_user'], $_POST['db_pass'], $_POST['db_name']);
if (!$conn) {
die("ERROR: Connection failed!!!<br>".mysqli_connect_error());
} else {
echo "<p>Database connected sucessful!</p>";
create_VNSB_squares($conn);
create_VNSB_numbers($conn);
create_VNSB_scores($conn);
# Create json file with all configurations
$dbObj->db_host = $_POST['db_host'];
$dbObj->db_user = $_POST['db_user'];
$dbObj->db_pass = $_POST['db_pass'];
$dbObj->db_name = $_POST['db_name'];
$myJSON = json_encode($dbObj, JSON_PRETTY_PRINT);
if (file_exists("includes/config.inc")) {
$notJSON = file_get_contents("includes/config.inc");
$tempJSON = json_decode($notJSON);
$tempJSON->db_host = $_POST['db_host'];
$tempJSON->db_user = $_POST['db_user'];
$tempJSON->db_pass = $_POST['db_pass'];
$tempJSON->db_name = $_POST['db_name'];
$myJSON = json_encode($tempJSON, JSON_PRETTY_PRINT);
}
$fh = fopen("includes/config.inc", "w") or die ("Error opening file!");
fwrite($fh, $myJSON);
fclose($fh);
# Admin
adminInquery();
}
}
} else {
echo "ERROR: Database information CANNOT be blank!!!";
}
} elseif ($_REQUEST['ADsubmit']) {
if ($_POST['site_url'] && $_POST['admin_email'] && $_POST['admin_pass']) {
# Read back json file
if (file_exists("includes/config.inc")) {
$notJSON = file_get_contents("includes/config.inc");
$tempJSON = json_decode($notJSON);
$tempJSON->site_url = $_POST['site_url'];
$tempJSON->admin_email = $_POST['admin_email'];
$tempJSON->admin_pass = $_POST['admin_pass'];
$myJSON = json_encode($tempJSON, JSON_PRETTY_PRINT);
$fh = fopen("includes/config.inc", "w") or die ("Error opening file!");
fwrite($fh, $myJSON);
fclose($fh);
# Configuration
configInquery();
} else {
echo "ERROR: Databse configuration file does not exist!";
}
} else {
echo "ERROR: One or more field(s) is invalid or empty!!!";
}
} elseif ($_REQUEST['VNsubmit']) {
if ($_POST['afc_champ'] && $_POST['nfc_champ'] && $_POST['sb_date']) {
# Read back json file
if (file_exists("includes/config.inc")) {
$notJSON = file_get_contents("includes/config.inc");
$tempJSON = json_decode($notJSON);
$tempJSON->sb_logo = $_POST['sb_logo'];
$tempJSON->afc_champ = $_POST['afc_champ'];
$tempJSON->afc_champ_logo = $_POST['afc_champ_logo'];
$tempJSON->nfc_champ = $_POST['nfc_champ'];
$tempJSON->nfc_champ_logo = $_POST['nfc_champ_logo'];
# date format
$sbDate = new DateTime($_POST['sb_date']);
$date_of_week = date('l', strtotime($_POST['sb_date']));
$tempJSON->sb_date = $date_of_week.", ".$sbDate->format('F d, Y');
$tempJSON->sb_time = $_POST['sb_time'];
$tempJSON->cost = $_POST['cost'];
$tempJSON->first = $_POST['first'];
$tempJSON->second = $_POST['second'];
$tempJSON->third = $_POST['third'];
$tempJSON->final = $_POST['final'];
$myJSON = json_encode($tempJSON, JSON_PRETTY_PRINT);
$fh = fopen("includes/config.inc", "w") or die ("Error opening file!");
fwrite($fh, $myJSON);
fclose($fh);
# Populate settings
create_VNSB_settings();
# Done
$notJSON = file_get_contents("includes/config.inc");
$tempJSON = json_decode($notJSON);
echo "Congratulation... You are ready to go!<br>";
echo "<p><a href='".$tempJSON->site_url."'title='Super Bowl Squares'>".$tempJSON->site_url."</a></p>";
# foreach ($tempJSON as $key=>$value) {
# echo $key. ": " .$value. "<br>";
# }
echo "<p>>>>>> MAKE SURE YOU DELETE 'setup.php' BEFORE YOU GO LIVE <<<<<</p>";
} else {
echo "ERROR: Databse configuration file does not exist!";
}
} else {
echo "ERROR: One or more field(s) is invalid or empty!!!";
}
} else {
# database
dbInquery();
}
?>
</center>
</body>
</html>
<?php $mysqli_close($conn); ?>
+11 -4
View File
@@ -5,8 +5,15 @@ Please read the "Readme.txt for license agreement, installation and usage instru
-->
<?php
require_once('config.php');
require "header.inc";
$superbowlURL = $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "signup.php");
require_once('includes/dbTables.inc');
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!".mysqli_connect_error());
}
require "includes/header.inc";
?>
<h3>SQUARE SELECTION</h3>
@@ -42,7 +49,7 @@ if ( isset($_REQUEST['sqSelect_Submit']) ) {
<!--<h2><strong>You are signing up for square(s): <font color="#ff0000"><?=$square_select?></font></strong></h2>-->
<!--<form name="signup" action="thankyou.php" method="post">-->
<p><b>Name</b> <br/><input type=text name="realname" size="30" value=""></p>
<p><b>Email</b><br/><input type=text name="email" size="30" maxlength="45" value=""></p>
<p><b>Email</b><br/><input type=email name="email" size="30" maxlength="45" value=""></p>
<p><b>Notes to Admin</b><br/>
<textarea name="body" rows="3" cols="40" wrap="virtual" style="font-family: verdana, arial; font-size: 10px"></textarea>
</p>
@@ -57,4 +64,4 @@ if ( isset($_REQUEST['sqSelect_Submit']) ) {
<p style="font-family: verdana, arial; font-size: 12px">
<a href="<?=$superbowlURL?>" title="Online Superbowl Squares">Home</a>
</p>
<?php require "footer.inc"; ?>
<?php require "includes/footer.inc"; ?>
+19 -12
View File
@@ -6,8 +6,15 @@ Please read the "Readme.txt for license agreement, installation and usage instru
<?php
require_once('config.php');
require "header.inc";
$superbowlURL = $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "thankyou.php");
require_once('includes/dbTables.inc');
$conn = dbConnection();
if (!$conn) {
die("Are you sure your database is setup correctly? I'm giving up!".mysqli_connect_error());
}
require "includes/header.inc";
//$square = $_POST['square'];
$sqTotal = $_POST["sqTotal"];
@@ -23,29 +30,29 @@ $date = date("Y-m-d h:i:s");
$confirm = $_POST['confirmation'];
for ($i=1;$i<=$sqTotal;$i++) {
$query="SELECT * FROM VNSB_squares WHERE SQUARE='".$sqSelect[$i]."'";
$result = mysql_query($query);
$sql="SELECT * FROM VNSB_squares WHERE SQUARE='".$sqSelect[$i]."'";
$result = mysqli_query($conn, $sql);
if (!$result) {
//echo mysql_error();
//echo mysqli_error();
echo "\n\n\t***** Invalid square selected *****\n\n";
echo "<a href='javascript:onClick=history.go(-2);'>Back</a>";
exit;
} else {
$record = mysql_fetch_assoc($result);
$record = mysqli_fetch_assoc($result);
}
}
//continue only if the square is available
if ($record['DATE'] == "0000-00-00 00:00:00") {
if ($record['DATE'] == "0000-00-00 00:00:00" || $record['DATE'] == NULL) {
//check for required fields
for ($i=1;$i<=$sqTotal;$i++) {
if (($sqSelect[$i] >= 00 OR $sqSelect[$i] < 100) AND $name != '' AND $email != '') {
$query="UPDATE VNSB_squares SET NAME='".$name."', EMAIL='".$email."', NOTES='".$notes."', DATE='".$date."', CONFIRM='".$confirm."' WHERE SQUARE='".$sqSelect[$i]."' LIMIT 1";
$result = mysql_query($query);
$sql="UPDATE VNSB_squares SET NAME='".$name."', EMAIL='".$email."', NOTES='".$notes."', DATE='".$date."', CONFIRM='".$confirm."' WHERE SQUARE='".$sqSelect[$i]."' LIMIT 1";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo mysql_error();
echo mysqli_error();
echo "<BR>Sorry, Technical problem occurred... your selection was not added.<br><br> Email this problem to <a href=\"mailto:".$ADMIN_EMAIL."\">".$ADMIN_EMAIL."</a>";
exit;
}
@@ -99,11 +106,11 @@ $bodyMessage .= $notes."\r\n\n";
notify_admin($email,$bodyMessage,$headers);
require "footer.inc"; ?>
require "includes/footer.inc"; ?>
<?php
} else {
echo "<p align='center'><font color='#ff0000', size='3'><b>$square</b> is NOT available! Someone must have just selected that same square.<br/></font><br/>Please go <a href='javascript:onClick=history.go(-2);'>back</a> and select another square.</p>";
exit;
}
?>
?>