diff --git a/Readme.txt b/Readme.txt
index 0a20d52..52d5004 100644
--- a/Readme.txt
+++ b/Readme.txt
@@ -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
\ No newline at end of file
+- Paypal implementation
diff --git a/admin.php b/admin.php
index 985146b..0cb40e3 100644
--- a/admin.php
+++ b/admin.php
@@ -1,28 +1,32 @@
-
-
-
-
-
-
+?>
+
+
".$record["NAME"]." - ".$record["SQUARE"]."";
}
?>
@@ -102,7 +106,7 @@ if (!isset($_SESSION['VNSB'])) {
- | Home |
+ Home |
Numbers |
Scores |
Logout |
@@ -126,16 +130,16 @@ if (!isset($_SESSION['VNSB'])) {
$square_list = substr_replace($square_list,"",0,2);
//echo $square_list."";
- $query="SELECT * FROM VNSB_squares WHERE $whereclause";
- //echo $query."";
- $result = mysql_query($query);
+ $sql="SELECT * FROM `VNSB_squares` WHERE $whereclause";
+ //echo $sql."";
+ $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."";
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 "Back
";
exit;
}
- //echo $query."";
- $result = mysql_query($query);
+ //echo $sql."";
+ $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'])) {
">
-
diff --git a/adminlogin.php b/adminlogin.php
index 38c5fed..ed28341 100644
--- a/adminlogin.php
+++ b/adminlogin.php
@@ -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 "Invalid login
Admin login
";
- mysql_close($db);
+ mysqli_close($conn);
exit;
}
}
@@ -53,27 +58,27 @@ if ($email && $pass) {
?>
-
Welcome, Admin!
+
Welcome, Admin!
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.
-
-
+
+
Admin login
diff --git a/adminlogout.php b/adminlogout.php
index 72ba85c..5be6a29 100644
--- a/adminlogout.php
+++ b/adminlogout.php
@@ -25,7 +25,7 @@
}
?>
- Home
+ ">Home
Admin
diff --git a/emailall.php b/emailall.php
index cae5ed9..7e20ee7 100644
--- a/emailall.php
+++ b/emailall.php
@@ -14,8 +14,14 @@ if (!$_SESSION['VNSB']) {
-
diff --git a/images/AFC_logo.gif b/images/AFC_logo.gif
new file mode 100644
index 0000000..a105d8e
Binary files /dev/null and b/images/AFC_logo.gif differ
diff --git a/images/NFC_logo.gif b/images/NFC_logo.gif
new file mode 100644
index 0000000..76a3816
Binary files /dev/null and b/images/NFC_logo.gif differ
diff --git a/images/NFL-logo.gif b/images/NFL-logo.gif
new file mode 100644
index 0000000..bd3a7ff
Binary files /dev/null and b/images/NFL-logo.gif differ
diff --git a/images/VNLogo.gif b/images/VNLogo.gif
new file mode 100644
index 0000000..11b9b46
Binary files /dev/null and b/images/VNLogo.gif differ
diff --git a/images/sb_logo.jpg b/images/sb_logo.jpg
new file mode 100644
index 0000000..3a517b8
Binary files /dev/null and b/images/sb_logo.jpg differ
diff --git a/includes/config.inc b/includes/config.inc
new file mode 100644
index 0000000..aefdcec
--- /dev/null
+++ b/includes/config.inc
@@ -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"
+}
\ No newline at end of file
diff --git a/includes/dbTables.inc b/includes/dbTables.inc
new file mode 100644
index 0000000..093b922
--- /dev/null
+++ b/includes/dbTables.inc
@@ -0,0 +1,347 @@
+db_host, $tempJSON->db_user, $tempJSON->db_pass, $tempJSON->db_name);
+
+ if (!$conn) {
+ die("Connection failed!!!
".mysqli_connect_error());
+ } else {
+ return $conn;
+ }
+
+ } else {
+ echo "ERROR: Unable to connect to ".$tempJSON->db_host."
".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`!
".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`!
".mysqli_error($conn);
+ } else {
+ echo "`VNSB_numbers` created successfully.
";
+ }
+}
+
+# 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`!
".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`!
".mysqli_error($conn);
+ } else {
+ echo "`VNSB_scores` created successfully.
";
+ }
+}
+
+# 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`!
".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`!
".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!
".mysqli_error($conn);
+ }
+ }
+ echo "`VNSB_squares` created successfully.
";
+ }
+}
+
+# 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!!!
".mysqli_connect_error());
+ } else {
+
+ $sql = "DROP TABLE IF EXISTS `VNSB_settings`;";
+ if (!mysqli_query($conn, $sql)) {
+ echo "ERROR: Unable to DROP `VNSB_settings`!
".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`!
".mysqli_error($conn);
+ } else {
+ echo "`VNSB_settings` created successfully.
";
+ }
+
+ # 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!
".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 "Minimum PHP version 5.5.9 recommeneded.
";
+ if (version_compare(PHP_VERSION, '5.5.9') >= 0) {
+ echo "Your PHP version: ".PHP_VERSION."
";
+ } else {
+ echo "Your PHP version: ".PHP_VERSION."
DOES NOT MEET MINIMUM RECOMENDATION";
+ }
+
+ echo('
+
+ ');
+}
+
+# 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('
+
+ ');
+}
+
+# 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('
+
+ ');
+}
+
+?>
diff --git a/includes/footer.inc b/includes/footer.inc
new file mode 100644
index 0000000..3890c6f
--- /dev/null
+++ b/includes/footer.inc
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+