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('
  mySQL  
Hostname:
Username:
Password:
Database:

Warning: Any existing databse with the same name will be deleted!

'); } # 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('
  Admin  
Site URL:
Admin Email:
Admin Password:

'); } # 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('
  NFL  
Super Bowl Logo:
AFC Champion:
AFC Logo:
NFC Champion:
NFC Logo:
Super Bowl Date:
Super Bowl Time:
  Payout  
Cost per square: $      $
1st quarter: %      $
2nd quarter: %      $
3rd quarter: %      $
Final: %      $

'); } ?>