Initial commit: Next.js rewrite of Super Bowl Squares app
Full rewrite of the legacy PHP/MySQL app using Next.js 14, PostgreSQL, Prisma, NextAuth, Tailwind CSS, and WebSocket-based live chat/grid updates. Deployed via Docker Compose with a custom Node.js server for WebSocket support. Fix chat display names by passing userId from the NextAuth session over WebSocket instead of attempting to read the HttpOnly session cookie (which is inaccessible to JavaScript). Server now looks up the user's first name from the database using the userId. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
<!--
|
||||
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();
|
||||
session_start();
|
||||
|
||||
if (!$_SESSION['VNSB']) {
|
||||
?>
|
||||
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
|
||||
<?php
|
||||
} else {
|
||||
|
||||
require_once('config.php');
|
||||
$sendemails = $_POST['sendemails'];
|
||||
|
||||
require "header.inc";
|
||||
$sb_URL = $record['sb_URL'];
|
||||
|
||||
$LINKS = "
|
||||
<p>
|
||||
<table width=\"50%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family: verdana, arial; font-size: 12px\">
|
||||
<tr>
|
||||
<td width=\"33%\"><a href=\"$sb_URL\" title=\"Home\">Home</a></td>
|
||||
<td width=\"34%\" align=\"center\"><a href=\"admin.php\" title=\"Administrator\">Admin</a></td>
|
||||
<td width=\"34%\" align=\"center\"><a href=\"./report.php\" title=\"Balance Sheet\">Balance Sheet</a></td>
|
||||
<td width=\"33%\" align=\"right\"><a href=\"adminlogout.php\" title=\"Admin logout\">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
";
|
||||
|
||||
function notify_admin ($mailto, $mailmessage, $mail_headers)
|
||||
{
|
||||
mail("$mailto", "Super Bowl Squares", "$mailmessage", "$mail_headers");
|
||||
}
|
||||
?>
|
||||
|
||||
<h3>Send Email to ALL</h3>
|
||||
<?php
|
||||
if (!isset($sendemails)) { ?>
|
||||
<table width="50%" cellpadding="5" style="font-family: verdana, arial; border: #FFCC99 1px solid">
|
||||
<tr>
|
||||
<td height="28" colspan="3" align="center" style="font-size: 11px">
|
||||
<strong>Click the button below to send an email to everyone and let them know the numbers have been picked and assigned for them to view and print as needed.</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="" align="center" valign="top">
|
||||
<form name="approval" action="emailall.php" method="post">
|
||||
<table width="100%" border="0" style="font-family: verdana, arial; font-size: 11px">
|
||||
<tr>
|
||||
<td> </a></td>
|
||||
<td align="center"><br/><p><input type="submit" value="Send Emails" name="sendemails"></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
echo $LINKS;
|
||||
|
||||
} else {
|
||||
echo "<p>Emails send to:</p>";
|
||||
$bodyMessage = "\r\nNOTIFICATION\r\n";
|
||||
$bodyMessage .= "All squares have been selected and all numbers have been picked and assigned.\r\n";
|
||||
$bodyMessage .= "You can view and print your own sheet at $sb_URL.\r\n\n";
|
||||
$bodyMessage .= "Good Luck and enjoy the game.\r\n\n";
|
||||
$bodyMessage .= "$commissioner\r\n";
|
||||
$headers = "From: $commissioner <$ADMIN_EMAIL>\r\n";
|
||||
$sql="SELECT * FROM VNSB_squares ORDER BY EMAIL";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
exit;
|
||||
}
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
if ($USER_EMAIL != $record["EMAIL"]) {
|
||||
$USER_NAME = $record["NAME"];
|
||||
$USER_EMAIL = $record["EMAIL"];
|
||||
notify_admin($USER_EMAIL,$bodyMessage,$headers);
|
||||
echo "<p><b>".$USER_NAME."</b>: ".$USER_EMAIL."</p>";
|
||||
}
|
||||
}
|
||||
|
||||
echo $LINKS;
|
||||
unset($sendemails);
|
||||
$headers = "From: $commissioner <$ADMIN_EMAIL>\r\n";
|
||||
notify_admin($ADMIN_EMAIL,$bodyMessage,$headers);
|
||||
} ?>
|
||||
<?php require "footer.inc";
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user