Super Bowl Squares
Installation

".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!!!
".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!!!
".mysqli_connect_error()); } else { echo "

Database connected sucessful!

"; 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!
"; echo "

".$tempJSON->site_url."

"; # foreach ($tempJSON as $key=>$value) { # echo $key. ": " .$value. "
"; # } echo "

>>>>> MAKE SURE YOU DELETE 'setup.php' BEFORE YOU GO LIVE <<<<<

"; } else { echo "ERROR: Databse configuration file does not exist!"; } } else { echo "ERROR: One or more field(s) is invalid or empty!!!"; } } else { # database dbInquery(); } ?>