Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Fog

1
General Code/Script Inquiries / Calendar
June 17, 2015, 10:24:45 pm
Is there a way to create separate calendar's for different boards?

For example.

I have NFL team boards on my site and it would be able to cool to create a calendar for each team board.  The calendar would show the schedule of the respect team and the team board.
2
General Code/Script Inquiries / Is there a way?
January 12, 2015, 02:06:47 am
You can add html to your description when creating a board.

In some cases I use an image in this field.

But I have some members that don't want to view those images.

Is there a way to collapse the html code within a description of a board?

Meaning if we add a description to a board they have a choice whether to view it or not through profile settings.

Such as viewing Avatars and Signatures, where the member has a choice within their settings.
3
General Code/Script Inquiries / Beta Testing NASCAR Game
December 06, 2014, 10:35:17 pm
Looking for testers for a NASCAR game I'm hosting next season.

http://www.ngsforums.com/2015Driverchallenge/index.php

Looking to do some simple input forms and maybe a dropdown form too.
4
General Code/Script Inquiries / Function Tweak
December 06, 2014, 03:37:35 pm
UD, on the Pickems PHP game that I found and use, it uses radio buttons to pick the team you think is going to win.  At the end of the week we enter the scores of the actual game.

Here's the code for the "ENTRY FORM"

Code Select
<?php
require_once('includes/application_top.php');
require(
'includes/classes/team.php');

if (
$_POST['action'] == 'Submit') {
$week $_POST['week'];
$cutoffDateTime getCutoffDateTime($week);

//update summary table
$sql "delete from " $db_prefix "picksummary where weekNum = " $_POST['week'] . " and userID = " $user->userID ";";
mysql_query($sql) or die('Error updating picks summary: ' mysql_error());
$sql "insert into " $db_prefix "picksummary (weekNum, userID, showPicks) values (" $_POST['week'] . ", " $user->userID ", " . (int)$_POST['showPicks'] . ");";
mysql_query($sql) or die('Error updating picks summary: ' mysql_error());

//loop through non-expire weeks and update picks
$sql "select * from " $db_prefix "schedule where weekNum = " $_POST['week'] . " and (DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) < gameTimeEastern and DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) < '" $cutoffDateTime "');";
$query mysql_query($sql);
while ($result mysql_fetch_array($query)) {
$sql "delete from " $db_prefix "picks where userID = " $user->userID " and gameID = " $result['gameID'];
mysql_query($sql) or die('Error deleting picks: ' mysql_error());

if (!empty($_POST['game' $result['gameID']])) {
$sql "insert into " $db_prefix "picks (userID, gameID, pickID) values (" $user->userID ", " $result['gameID'] . ", '" $_POST['game' $result['gameID']] . "')";
mysql_query($sql) or die('Error inserting pick: ' mysql_error());
}
}
header('Location: results.php?week=' $_POST['week']);
} else {
$week = (int)$_GET['week'];
if (empty($week)) {
//get current week
$week = (int)getCurrentWeek();
}
$cutoffDateTime getCutoffDateTime($week);
$firstGameTime getFirstGameTime($week);
}

include(
'includes/header.php');
include(
'includes/column_right.php');

//display week nav
$sql "select distinct weekNum from " $db_prefix "schedule order by weekNum;";
$query mysql_query($sql);
$weekNav '<div class="navbar3"><b>Go to week:</b> ';
$i 0;
while (
$result mysql_fetch_array($query)) {
if ($i 0$weekNav .= ' | ';
if ($week !== (int)$result['weekNum']) {
$weekNav .= '<a href="entry_form.php?week=' $result['weekNum'] . '">' $result['weekNum'] . '</a>';
} else {
$weekNav .= $result['weekNum'];
}
$i++;
}
$weekNav .= '</div>' "\n";
echo 
$weekNav;
?>

<!--
<table cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="60%">
//-->
<h2>Week <?php echo $week?> - Make Your Picks:</h2>
<p>Make your picks below by clicking on the team helmet or checking the radio buttons to the right.</p>
<script type="text/javascript">
function checkform() {
//make sure all picks have a checked value
var f = document.entryForm;
var allChecked = true;
var allR = document.getElementsByTagName('input');
for (var i=0; i < allR.length; i++) {
if(allR[i].type == 'radio') {
if (!radioIsChecked(allR[i].name)) {
allChecked = false;
}
}     
    }
    if (!allChecked) {
    return confirm('One or more picks are missing for the current week.  Do you wish to submit anyway?');
}
return true;
}
function radioIsChecked(elmName) {
var elements = document.getElementsByName(elmName);
for (var i = 0; i < elements.length; i++) {
if (elements[i].checked) {
return true;
}
}
return false;
}
</script>
<div style="float: right; width: 270px; margin-right: 10px"><?php include('includes/comments.php'); ?></div>
<?php
//get existing picks
$picks getUserPicks($week$user->userID);

//get show picks status
$sql "select * from " $db_prefix "picksummary where weekNum = " $week " and userID = " $user->userID ";";
$query mysql_query($sql);
if (mysql_num_rows($query) > 0) {
$result mysql_fetch_array($query);
$showPicks = (int)$result['showPicks'];
} else {
$showPicks 1;
}

//display schedule for week
$sql "select s.*, (DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) > gameTimeEastern or DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) > '" $cutoffDateTime "')  as expired ";
$sql .= "from " $db_prefix "schedule s ";
$sql .= "inner join " $db_prefix "teams ht on s.homeID = ht.teamID ";
$sql .= "inner join " $db_prefix "teams vt on s.visitorID = vt.teamID ";
$sql .= "where s.weekNum = " $week " ";
$sql .= "order by s.gameTimeEastern, s.gameID";
//echo $sql;
$query mysql_query($sql);
if (mysql_num_rows($query) > 0) {
echo '<form name="entryForm" action="entry_form.php" method="post" onsubmit="return checkform();">' "\n";
echo '<input type="hidden" name="week" value="' $week '" />' "\n";
echo '<table cellpadding="4" cellspacing="0" class="table1">' "\n";
//echo ' <tr><th>Home</th><th>Visitor</th><th align="left">Game</th><th>Time / Result</th><th>Your Pick</th></tr>' . "\n";
$i 0;
while ($result mysql_fetch_array($query)) {
$homeTeam = new team($result['homeID']);
$visitorTeam = new team($result['visitorID']);
$rowclass = (($i == 0) ? ' class="altrow"' '');
//$pickExpired = ((date("U") > strtotime($result['gameTimeEastern'])) ? true : false);
echo ' <tr' $rowclass '>' "\n";
echo ' <td align="center">' "\n";
echo ' <table width="100%" border="0" cellpadding="2" cellspacing="0" class="nostyle">' "\n";
echo ' <tr valign="middle">' "\n";
echo ' <td align="center"><label for="' $result['gameID'] . $visitorTeam->teamID '"><img src="images/helmets_big/' strtolower($visitorTeam->teamID) . '1.gif" onclick="document.entryForm.game' $result['gameID'] . '[0].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' $visitorTeam->city ' ' $visitorTeam->team '</b><br />Record: ' getTeamRecord($visitorTeam->teamID) . '<br />Streak: ' getTeamStreak($visitorTeam->teamID) . '</span></td>' "\n";
echo ' <td align="center">at</td>' "\n";
echo ' <td align="center"><label for="' $result['gameID'] . $homeTeam->teamID '"><img src="images/helmets_big/' strtolower($homeTeam->teamID) . '2.gif" onclick="document.entryForm.game' $result['gameID'] . '[1].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' $homeTeam->city ' ' $homeTeam->team '</b><br />Record: ' getTeamRecord($homeTeam->teamID) . '<br />Streak: ' getTeamStreak($homeTeam->teamID) . '</span></td>' "\n";
echo ' </tr>' "\n";
if (strlen($result['homeScore']) > && strlen($result['visitorScore']) > 0) {
//if score is entered, show score
echo ' <tr><td colspan="3" align="center"><b>Final: ' $result['visitorScore'] . ' - ' $result['homeScore'] . '</b></td></tr>' "\n";
} else {
//else show time of game
echo ' <tr><td colspan="3" align="center">' date('D n/j g:i a'strtotime($result['gameTimeEastern'])) . ' ET</td></tr>' "\n";
}
echo ' </table>' "\n";
echo ' </td>' "\n";
echo ' <td align="left"><b>Your Pick:</b><br />' "\n";
if (!$result['expired']) {
//if game is not expired, show pick
echo ' <input type="radio" name="game' $result['gameID'] . '" value="' $visitorTeam->teamID '" id="' $result['gameID'] . $visitorTeam->teamID '"' . (($picks[$result['gameID']]['pickID'] == $visitorTeam->teamID) ? ' checked="checked"' '') . ' /> <label for="' $result['gameID'] . $visitorTeam->teamID '">' $visitorTeam->teamName '</label><br />' "\n";
echo ' <input type="radio" name="game' $result['gameID'] . '" value="' $homeTeam->teamID '" id="' $result['gameID'] . $homeTeam->teamID '"' . (($picks[$result['gameID']]['pickID'] == $homeTeam->teamID) ? ' checked="checked"' '') . ' /> <label for="' $result['gameID'] . $homeTeam->teamID '">' $homeTeam->teamName '</label><br />' "\n";
} else {
//else show locked pick
$pickID getPickID($result['gameID'], $user->userID);
if (!empty($pickID)) {
$statusImg '';
$pickTeam = new team($pickID);
$pickLabel $pickTeam->teamName;
} else {
$statusImg '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
$pickLabel 'None Selected';
}
if ($scoreEntered) {
//set status of pick (correct, incorrect)
if ($pickID == $result['winnerID']) {
$statusImg '<img src="images/check_16x16.png" width="16" height="16" alt="" />';
} else {
$statusImg '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
}
}
echo ' $statusImg ' ' $pickLabel "\n";
}
echo ' </td>' "\n";
echo ' </tr>' "\n";
$i++;
}

                
LOOKING TO PUT A FORM HERE THAT WOULD BE AN INPUT BOX OR DROPDOWN BOX

echo '</table>' "\n";
echo '<p><input type="checkbox" name="showPicks" id="showPicks" value="1"' . (($showPicks) ? ' checked="checked"' '') . ' /> <label for="showPicks">Allow others to see my picks</label></p>' "\n";
echo '<p><input type="submit" name="action" value="Submit" /></p>' "\n";
echo '</form>' "\n";
}
?>

<!--
</td>
<td width="40%">
<h2>Latest Comments:</h2>
<p>comment</p>
<div>

</div>
</td>
</tr>
</table>
//-->
<?php
include('includes/footer.php'); 
?>


Look for "LOOKING TO PUT A FORM HERE THAT WOULD BE AN INPUT BOX OR DROPDOWN BOX"
5
General Code/Script Inquiries / What do I change?
October 04, 2014, 09:24:57 pm
UD, I was hoping you could help me out.

I believe the following code uses three different tables:

Schedule
Picks
Picksummary

Code Select
<?php
require_once('includes/application_top.php');
require(
'includes/classes/team.php');

if (
$_POST['action'] == 'Submit') {
$week $_POST['week'];
$cutoffDateTime getCutoffDateTime($week);

//update summary table
$sql "delete from " $db_prefix "picksummary where weekNum = " $_POST['week'] . " and userID = " $user->userID ";";
mysql_query($sql) or die('Error updating picks summary: ' mysql_error());
$sql "insert into " $db_prefix "picksummary (weekNum, userID, showPicks) values (" $_POST['week'] . ", " $user->userID ", " . (int)$_POST['showPicks'] . ");";
mysql_query($sql) or die('Error updating picks summary: ' mysql_error());

//loop through non-expire weeks and update picks
$sql "select * from " $db_prefix "schedule where weekNum = " $_POST['week'] . " and (DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) < gameTimeEastern and DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) < '" $cutoffDateTime "');";
$query mysql_query($sql);
while ($result mysql_fetch_array($query)) {
$sql "delete from " $db_prefix "picks where userID = " $user->userID " and gameID = " $result['gameID'];
mysql_query($sql) or die('Error deleting picks: ' mysql_error());

if (!empty($_POST['game' $result['gameID']])) {
$sql "insert into " $db_prefix "picks (userID, gameID, pickID) values (" $user->userID ", " $result['gameID'] . ", '" $_POST['game' $result['gameID']] . "')";
mysql_query($sql) or die('Error inserting pick: ' mysql_error());
}
}
header('Location: results.php?week=' $_POST['week']);
} else {
$week = (int)$_GET['week'];
if (empty($week)) {
//get current week
$week = (int)getCurrentWeek();
}
$cutoffDateTime getCutoffDateTime($week);
$firstGameTime getFirstGameTime($week);
}

include(
'includes/header.php');
include(
'includes/column_right.php');

//display week nav
$sql "select distinct weekNum from " $db_prefix "schedule order by weekNum;";
$query mysql_query($sql);
$weekNav '<div class="navbar3"><b>Go to week:</b> ';
$i 0;
while (
$result mysql_fetch_array($query)) {
if ($i 0$weekNav .= ' | ';
if ($week !== (int)$result['weekNum']) {
$weekNav .= '<a href="entry_form.php?week=' $result['weekNum'] . '">' $result['weekNum'] . '</a>';
} else {
$weekNav .= $result['weekNum'];
}
$i++;
}
$weekNav .= '</div>' "\n";
echo 
$weekNav;
?>

<!--
<table cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="60%">
//-->
<h2>Week <?php echo $week?> - Make Your Picks:</h2>
<p>Make your picks below by clicking on the team helmet or checking the radio buttons to the right.</p>
<script type="text/javascript">
function checkform() {
//make sure all picks have a checked value
var f = document.entryForm;
var allChecked = true;
var allR = document.getElementsByTagName('input');
for (var i=0; i < allR.length; i++) {
if(allR[i].type == 'radio') {
if (!radioIsChecked(allR[i].name)) {
allChecked = false;
}
}     
    }
    if (!allChecked) {
    return confirm('One or more picks are missing for the current week.  Do you wish to submit anyway?');
}
return true;
}
function radioIsChecked(elmName) {
var elements = document.getElementsByName(elmName);
for (var i = 0; i < elements.length; i++) {
if (elements[i].checked) {
return true;
}
}
return false;
}
</script>
<div style="float: right; width: 270px; margin-right: 10px"><?php include('includes/comments.php'); ?></div>
<?php
//get existing picks
$picks getUserPicks($week$user->userID);

//get show picks status
$sql "select * from " $db_prefix "picksummary where weekNum = " $week " and userID = " $user->userID ";";
$query mysql_query($sql);
if (mysql_num_rows($query) > 0) {
$result mysql_fetch_array($query);
$showPicks = (int)$result['showPicks'];
} else {
$showPicks 1;
}

//display schedule for week
$sql "select s.*, (DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) > gameTimeEastern or DATE_ADD(NOW(), INTERVAL " SERVER_TIMEZONE_OFFSET " HOUR) > '" $cutoffDateTime "')  as expired ";
$sql .= "from " $db_prefix "schedule s ";
$sql .= "inner join " $db_prefix "teams ht on s.homeID = ht.teamID ";
$sql .= "inner join " $db_prefix "teams vt on s.visitorID = vt.teamID ";
$sql .= "where s.weekNum = " $week " ";
$sql .= "order by s.gameTimeEastern, s.gameID";
//echo $sql;
$query mysql_query($sql);
if (mysql_num_rows($query) > 0) {
echo '<form name="entryForm" action="entry_form.php" method="post" onsubmit="return checkform();">' "\n";
echo '<input type="hidden" name="week" value="' $week '" />' "\n";
echo '<table cellpadding="4" cellspacing="0" class="table1">' "\n";
//echo ' <tr><th>Home</th><th>Visitor</th><th align="left">Game</th><th>Time / Result</th><th>Your Pick</th></tr>' . "\n";
$i 0;
while ($result mysql_fetch_array($query)) {
$homeTeam = new team($result['homeID']);
$visitorTeam = new team($result['visitorID']);
$rowclass = (($i == 0) ? ' class="altrow"' '');
//$pickExpired = ((date("U") > strtotime($result['gameTimeEastern'])) ? true : false);
echo ' <tr' $rowclass '>' "\n";
echo ' <td align="center">' "\n";
echo ' <table width="100%" border="0" cellpadding="2" cellspacing="0" class="nostyle">' "\n";
echo ' <tr valign="middle">' "\n";
echo ' <td align="center"><label for="' $result['gameID'] . $visitorTeam->teamID '"><img src="images/helmets_big/' strtolower($visitorTeam->teamID) . '1.gif" onclick="document.entryForm.game' $result['gameID'] . '[0].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' $visitorTeam->city ' ' $visitorTeam->team '</b><br />Record: ' getTeamRecord($visitorTeam->teamID) . '<br />Streak: ' getTeamStreak($visitorTeam->teamID) . '</span></td>' "\n";
echo ' <td align="center">at</td>' "\n";
echo ' <td align="center"><label for="' $result['gameID'] . $homeTeam->teamID '"><img src="images/helmets_big/' strtolower($homeTeam->teamID) . '2.gif" onclick="document.entryForm.game' $result['gameID'] . '[1].checked=true;" /></label><br /><span style="font-size: 9px;"><b>' $homeTeam->city ' ' $homeTeam->team '</b><br />Record: ' getTeamRecord($homeTeam->teamID) . '<br />Streak: ' getTeamStreak($homeTeam->teamID) . '</span></td>' "\n";
echo ' </tr>' "\n";
if (strlen($result['homeScore']) > && strlen($result['visitorScore']) > 0) {
//if score is entered, show score
echo ' <tr><td colspan="3" align="center"><b>Final: ' $result['visitorScore'] . ' - ' $result['homeScore'] . '</b></td></tr>' "\n";
} else {
//else show time of game
echo ' <tr><td colspan="3" align="center">' date('D n/j g:i a'strtotime($result['gameTimeEastern'])) . ' ET</td></tr>' "\n";
}
echo ' </table>' "\n";
echo ' </td>' "\n";
echo ' <td align="left"><b>Your Pick:</b><br />' "\n";
if (!$result['expired']) {
//if game is not expired, show pick
echo ' <input type="radio" name="game' $result['gameID'] . '" value="' $visitorTeam->teamID '" id="' $result['gameID'] . $visitorTeam->teamID '"' . (($picks[$result['gameID']]['pickID'] == $visitorTeam->teamID) ? ' checked="checked"' '') . ' /> <label for="' $result['gameID'] . $visitorTeam->teamID '">' $visitorTeam->teamName '</label><br />' "\n";
echo ' <input type="radio" name="game' $result['gameID'] . '" value="' $homeTeam->teamID '" id="' $result['gameID'] . $homeTeam->teamID '"' . (($picks[$result['gameID']]['pickID'] == $homeTeam->teamID) ? ' checked="checked"' '') . ' /> <label for="' $result['gameID'] . $homeTeam->teamID '">' $homeTeam->teamName '</label><br />' "\n";
} else {
//else show locked pick
$pickID getPickID($result['gameID'], $user->userID);
if (!empty($pickID)) {
$statusImg '';
$pickTeam = new team($pickID);
$pickLabel $pickTeam->teamName;
} else {
$statusImg '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
$pickLabel 'None Selected';
}
if ($scoreEntered) {
//set status of pick (correct, incorrect)
if ($pickID == $result['winnerID']) {
$statusImg '<img src="images/check_16x16.png" width="16" height="16" alt="" />';
} else {
$statusImg '<img src="images/cross_16x16.png" width="16" height="16" alt="" />';
}
}
echo ' $statusImg ' ' $pickLabel "\n";
}
echo ' </td>' "\n";
echo ' </tr>' "\n";
$i++;
}
echo '</table>' "\n";
echo '<p><input type="checkbox" name="showPicks" id="showPicks" value="1"' . (($showPicks) ? ' checked="checked"' '') . ' /> <label for="showPicks">Allow others to see my picks</label></p>' "\n";
echo '<p><input type="submit" name="action" value="Submit" /></p>' "\n";
echo '</form>' "\n";
                
}
?>


<!--
</td>
<td width="40%">
<h2>Latest Comments:</h2>
<p>comment</p>
<div>

</div>
</td>
</tr>
</table>
//-->
<?php
include('includes/footer.php'); 
?>
6
Premiumbeat for SMF / Radio Show
July 21, 2014, 10:40:48 pm
UD, I have a couple members that have their own radio show and have been recording them and sending me their shows to post on my site.

Will this be able to play big mp3 files?

Plus they want to stream some stuff too, will this work with that idea?
7
General Code/Script Inquiries / Cover it Live
June 12, 2014, 09:10:34 pm
I have an account with cover it Live and it's a live chat room that I use during sporting events.  Right now I have it setup so that our NASCAR Fans can talk about the race on race day.

What I'm looking to is be able to have our users use their username and password from my SMF site.

But I can't seem to connect the two and the support gal told me, "You will need to create an endpoint available on the Internet which can validate our authorization request."

Then gave me an example:

<?php
$user = $_POST["dilbson_ngs_members_member_name"];
$passwd = $_POST["dilbson_ngs_members_member_passwd"];

// Connect to your database and check to see if $user and $password
// match an account you want to grant access to
// if the user should be allowed to log in:
$valid = 1;
// if they're not valid:
$valid = 0;

// optionally, you can pass through an avatar url
// $avatarURL = urlencode("http://example.com/images/avatar.jpg";);

$result = "&CIL_VALID=$valid&CIL_USERNAME=$user&CIL_AVATAR=$avatarURL";
print $result;



Needless to say I'm still a bit confused on what I need to do.

Any Help would be great.
8
I'm trying to modify this pickems game I found into a NCAA Bracket Game...

With football pickems it's a weekly date stamp or cut off.

Code Select
function getCutoffDateTime($week) {
//get the cutoff date for a given week
global $db_prefix;
$sql = "select gameTimeEastern from " . $db_prefix . "schedule where weekNum = " . $week . " and DATE_FORMAT(gameTimeEastern, '%x') = '2014' order by gameTimeEastern limit 1; ";
$qryCutoff = mysql_query($sql);
if (mysql_num_rows($qryCutoff) > 0) {
$rstCutoff = mysql_fetch_array($qryCutoff);
return $rstCutoff['gameTimeEastern'];
}
die('Error getting cutoff date: ' . mysql_error());


I'm trying to convert weeks into days (rounds)

March Madness has several rounds within one week and I get a small error when I use the week table as a daily table and it shows up as a cutoff time.
9
General Code/Script Inquiries / Quick help please...
December 28, 2013, 08:17:46 pm
I'm get this error:

Warning: Invalid argument supplied for foreach() in /home/eastsid2/public_html/fog/phppickem-master/standings.php on line 20

This is line 20:

foreach($stats[winners] as $winner => $winnerID) {

Here's the whole code

Code Select

<?php
require('includes/application_top.php');

$weekStats = array();
$playerTotals = array();
$possibleScoreTotal 0;
calculateStats();

include(
'includes/header.php');
?>

<h1>Standings</h1>
<h2>Weekly Stats</h2>
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Week</th><th align="left">Winner(s)</th><th>Score</th></tr>
<?php
if (isset($weekStats)) {
$i 0;
foreach($weekStats as $week => $stats) {
$winners '';
foreach($stats[winners] as $winner => $winnerID) {
$tmpUser $login->get_user_by_id($winnerID);
switch ($user_names_display) {
case 1:
$winners .= ((strlen($winners) > 0) ? ', ' '') . trim($tmpUser->firstname ' ' $tmpUser->lastname);
break;
case 2:
$winners .= ((strlen($winners) > 0) ? ', ' '') . $tmpUser->userName;
break;
default: //3
$winners .= ((strlen($winners) > 0) ? ', ' '') . '<abbrev title="' trim($tmpUser->firstname ' ' $tmpUser->lastname) . '">' $tmpUser->userName '</abbrev>';
break;
}
}
$rowclass = (($i == 0) ? ' class="altrow"' '');
echo ' <tr' $rowclass '><td>' $week '</td><td>' $winners '</td><td align="center">' $stats[highestScore] . '/' $stats[possibleScore] . '</td></tr>';
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
<p>&nbsp;</p>

<h2>User Stats</h2>
<table cellpadding="0" cellspacing="0">
<tr valign="top">
<td>
<b>By Name</b><br />
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Player</th><th align="left">Wins</th><th>Pick Ratio</th></tr>
<?php
if (isset($playerTotals)) {
//arsort($playerTotals);
$i 0;
foreach($playerTotals as $playerID => $stats) {
$rowclass = (($i == 0) ? ' class="altrow"' '');
$pickRatio $stats[score] . '/' $possibleScoreTotal;
$pickPercentage number_format((($stats[score] / $possibleScoreTotal) * 100), 2) . '%';
switch ($user_names_display) {
case 1:
echo ' <tr' $rowclass '><td class="tiny">' $stats[name] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
case 2:
echo ' <tr' $rowclass '><td class="tiny">' $stats[userName] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
default: //3
echo ' <tr' $rowclass '><td class="tiny"><abbrev title="' $stats[name] . '">' $stats[userName] . '<abbrev></td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
}
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
</td>
<td>&nbsp;</td>
<td>
<b>By Wins</b><br />
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Player</th><th align="left">Wins</th><th>Pick Ratio</th></tr>
<?php
if (isset($playerTotals)) {
arsort($playerTotals);
$i 0;
foreach($playerTotals as $playerID => $stats) {
$rowclass = (($i == 0) ? ' class="altrow"' '');
$pickRatio $stats[score] . '/' $possibleScoreTotal;
$pickPercentage number_format((($stats[score] / $possibleScoreTotal) * 100), 2) . '%';
switch ($user_names_display) {
case 1:
echo ' <tr' $rowclass '><td class="tiny">' $stats[name] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
case 2:
echo ' <tr' $rowclass '><td class="tiny">' $stats[userName] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
default: //3
echo ' <tr' $rowclass '><td class="tiny"><abbrev title="' $stats[name] . '">' $stats[userName] . '</abbrev></td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
}
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
</td>
<td>&nbsp;</td>
<td>
<b>By Pick Ratio</b><br />
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Player</th><th align="left">Wins</th><th>Pick Ratio</th></tr>
<?php
if (isset($playerTotals)) {
$playerTotals sort2d($playerTotals'score''desc');
$i 0;
foreach($playerTotals as $playerID => $stats) {
$rowclass = (($i == 0) ? ' class="altrow"' '');
$pickRatio $stats[score] . '/' $possibleScoreTotal;
$pickPercentage number_format((($stats[score] / $possibleScoreTotal) * 100), 2) . '%';
switch ($user_names_display) {
case 1:
echo ' <tr' $rowclass '><td class="tiny">' $stats[name] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
case 2:
echo ' <tr' $rowclass '><td class="tiny">' $stats[userName] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
default: //3
echo ' <tr' $rowclass '><td class="tiny"><abbrev title="' $stats[name] . '">' $stats[userName] . '</abbrev></td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
}
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
</td>
</tr>
</table>
<p>&nbsp;</p>
<?php
include('includes/footer.php');
?>

10
General Code/Script Inquiries / Question on Date Cutoff
December 27, 2013, 01:40:36 pm
In a my quest to modify a NFL pickems game to pit NASCAR Drivers vs NASCAR Drivers I've come across a slight issue.

It's the cutoff time.

NASCAR has Races on both Saturday and Sunday...

However NFL has most of it's games played on Sunday.

If there is a Saturday Race I get and error on the cutoff time because nothing is on Sunday.

I don't want to create a Saturday Cutoff for Sunday Races, I would prefer to make it work for both days.

This is the function code

Code Select
function getCutoffDateTime($week) {
//get the cutoff date for a given week
global $db_prefix;
$sql = "select gameTimeEastern from " . $db_prefix . "schedule where weekNum = " . $week . " and DATE_FORMAT(gameTimeEastern, '%W') = 'Sunday' order by gameTimeEastern limit 1;";
$qryCutoff = mysql_query($sql);
if (mysql_num_rows($qryCutoff) > 0) {
$rstCutoff = mysql_fetch_array($qryCutoff);
return $rstCutoff['gameTimeEastern'];
}
die('Error getting cutoff date: ' . mysql_error());
}


I'm guessing it has something to do with the Sunday but is there a "ANYDAY" or "SAMEDAY" Code one can use?

or does that

$week need to be changed up?

Any help would be great.
11
SMF Arcade Block Codes / Arcade info questions
December 10, 2013, 09:32:59 pm
I have SMF Arcade over on my site and I have a user asking if there are new games we can get?  I'm not sure how I would know if I have all the latest games or not.

Help Please

Fog
12
General Code/Script Inquiries / Pickems help
December 07, 2013, 09:32:32 pm
Here's the code for the attachment below:

Code Select
<?php
require('includes/application_top.php');

$weekStats = array();
$playerTotals = array();
$possibleScoreTotal 0;
calculateStats();

include(
'includes/header.php');
?>

<h1>Standings</h1>
<h2>Weekly Stats</h2>
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Week</th><th align="left">Winner(s)</th><th>Score</th></tr>
<?php
if (isset($weekStats)) {
$i 0;
foreach($weekStats as $week => $stats) {
$winners '';
foreach($stats[winners] as $winner => $winnerID) {
$tmpUser $login->get_user_by_id($winnerID);
switch ($user_names_display) {
case 1:
$winners .= ((strlen($winners) > 0) ? ', ' '') . trim($tmpUser->firstname ' ' $tmpUser->lastname);
break;
case 2:
$winners .= ((strlen($winners) > 0) ? ', ' '') . $tmpUser->userName;
break;
default: //3
$winners .= ((strlen($winners) > 0) ? ', ' '') . '<abbrev title="' trim($tmpUser->firstname ' ' $tmpUser->lastname) . '">' $tmpUser->userName '</abbrev>';
break;
}
}
$rowclass = (($i == 0) ? ' class="altrow"' '');
echo ' <tr' $rowclass '><td>' $week '</td><td>' $winners '</td><td align="center">' $stats[highestScore] . '/' $stats[possibleScore] . '</td></tr>';
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
<p>&nbsp;</p>

<h2>User Stats</h2>
<table cellpadding="0" cellspacing="0">
<tr valign="top">
<td>
<b>By Name</b><br />
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Player</th><th align="left">Wins</th><th>Pick Ratio</th></tr>
<?php
if (isset($playerTotals)) {
//arsort($playerTotals);
$i 0;
foreach($playerTotals as $playerID => $stats) {
$rowclass = (($i == 0) ? ' class="altrow"' '');
$pickRatio $stats[score] . '/' $possibleScoreTotal;
$pickPercentage number_format((($stats[score] / $possibleScoreTotal) * 100), 2) . '%';
switch ($user_names_display) {
case 1:
echo ' <tr' $rowclass '><td class="tiny">' $stats[name] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
case 2:
echo ' <tr' $rowclass '><td class="tiny">' $stats[userName] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
default: //3
echo ' <tr' $rowclass '><td class="tiny"><abbrev title="' $stats[name] . '">' $stats[userName] . '<abbrev></td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
}
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
</td>
<td>&nbsp;</td>
<td>
<b>By Wins</b><br />
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Player</th><th align="left">Wins</th><th>Pick Ratio</th></tr>
<?php
if (isset($playerTotals)) {
arsort($playerTotals);
$i 0;
foreach($playerTotals as $playerID => $stats) {
$rowclass = (($i == 0) ? ' class="altrow"' '');
$pickRatio $stats[score] . '/' $possibleScoreTotal;
$pickPercentage number_format((($stats[score] / $possibleScoreTotal) * 100), 2) . '%';
switch ($user_names_display) {
case 1:
echo ' <tr' $rowclass '><td class="tiny">' $stats[name] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
case 2:
echo ' <tr' $rowclass '><td class="tiny">' $stats[userName] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
default: //3
echo ' <tr' $rowclass '><td class="tiny"><abbrev title="' $stats[name] . '">' $stats[userName] . '</abbrev></td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
}
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
</td>
<td>&nbsp;</td>
<td>
<b>By Pick Ratio</b><br />
<table cellpadding="4" cellspacing="0" class="table1">
<tr><th align="left">Player</th><th align="left">Wins</th><th>Pick Ratio</th></tr>
<?php
if (isset($playerTotals)) {
$playerTotals sort2d($playerTotals'score''desc');
$i 0;
foreach($playerTotals as $playerID => $stats) {
$rowclass = (($i == 0) ? ' class="altrow"' '');
$pickRatio $stats[score] . '/' $possibleScoreTotal;
$pickPercentage number_format((($stats[score] / $possibleScoreTotal) * 100), 2) . '%';
switch ($user_names_display) {
case 1:
echo ' <tr' $rowclass '><td class="tiny">' $stats[name] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
case 2:
echo ' <tr' $rowclass '><td class="tiny">' $stats[userName] . '</td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
default: //3
echo ' <tr' $rowclass '><td class="tiny"><abbrev title="' $stats[name] . '">' $stats[userName] . '</abbrev></td><td class="tiny" align="center">' $stats[wins] . '</td><td class="tiny" align="center">' $pickRatio ' (' $pickPercentage ')</td></tr>';
break;
}
$i++;
}
} else {
echo ' <tr><td colspan="3">No weeks have been completed yet.</td></tr>' "\n";
}
?>

</table>
</td>
</tr>
</table>
<p>&nbsp;</p>
<?php
include('includes/footer.php');
?>


What I'd like to display is instead of:

12 DLPackers 7/14  it would look like this 12 DLPackers 7-7

or

13 Fog 13/16  it would look like this 13 Fog 13-3

The 12 and 13 are the weeks and the 7/14 or 13/16 are wins compared to the number of games that week.

the 7-7 or 13-3 would be a win-lose record for that week.  Then what I'd like to try and create is an overall leader board with wins and loses.

Instead of this:

By Pick Ratio
Player Wins Pick Ratio
Fog 1 19/31 (61.29%)
SoCalSaint 0 15/31 (48.39%)
DLPackers 1 14/31 (45.16%)
SloopyDave 0 5/31 (16.13%)
Jeep99tj 0 4/31 (12.90%)

By Overall Record
Player Wins-Loses
Fog 19-12 
SoCalSaint 15-16
DLPackers 14-17
SloopyDave 5-26
Jeep99tj  4-27

---------------------------
Is there a way to add that PHP code in a PHP Block or PHP page with simple portal?
13
General Code/Script Inquiries / Adding a column to DB
November 16, 2013, 10:19:52 pm
What I'm trying to do is have a way to input peoples records in a NFL Pickems Game we have going and have it display on their profile.

I created a new column on my DB but is doesn't want to display the value that I want it too.

I copied the same code that you see for displaying the battle stats you would see when viewing a profile.

At that point I can see where it displays that stat(s) twice when you view a persons profile.

The code feeds off the "atk" and "def" columns on the members table.

So I created a column called "posts1" on the same members table and changed up the profile-view.php code to include that new column and nothing was displayed. Then I changed it to just "posts" and I could see how many post I had.  The code seems to work fine it's the column on the DB that has me wondering if I have it setup right to manually going and add their respective record for this game and just have it displayed on their profile and where they post.

I'm a bit lost on this idea

Thanks
Fog
14
General Code/Script Inquiries / Check Box
September 18, 2013, 11:07:49 pm
UD...I'm thinking this will be real easy but I need something right away...well at least by next week.   :o

Can you come up with a way to display a check box that only a MOD can see?

One of my users has a NFL Pickems game that they have to manually input the data from what a poster will choose during the respective week.  This task has them looking thru pages and pages of choices and double checking to see if they already log/posted their picks or not.

A simple way of putting a check box that the MOD can see and click on so they don't have to double check if this certain poster has made their picks or not?

Have it show up in their profile would work the best I'm thinking...

Thanks any help would be great...

Fog
15
Premiumbeat for SMF / Pop up music window
August 23, 2013, 10:48:07 pm
One of our members asked if I could create a pop music window that could just play one song and quit.

Our idea is when you Click on too our NFL Tailgating 2013 Tread, is you hear a football theme such as the MNF song and various others.
16
General Code/Script Inquiries / Battle Mod
July 10, 2013, 10:14:27 pm
I'm looking for help with the Battle Mod Game that SA and Andrew put together.

I'm not certain if anyone here has ever played the Battle Game so I'm not sure where to begin.

You Battle Monsters with certain attack and def along with health.

As you battle these monsters you gain experience and as you gain experience you can level up.

When you are setting up a monster you can add what level you want it to enter at...

For Example:

You have a weaker monster at level one than you do at level 250.

However you will continue to see those lower level monsters when you get into the upper levels.

And sometime those upper level monsters can still attack you even if you haven't reached their level yet.

So here's what I'm looking to do...

Instead of one input box for the level you want for a monster

Create two input boxes for the lowest level you want the monster to show up and the highest level you want to see the monster.

A Min/Max type of function.


I'll provide screen shot of the admin control panel for editing a monster....

In my case I've converted the monsters into WWII Tanks...



I can provide additional info if requested.

Thanks for any help...I've done lots of PHP code changes with SMF before and had a fix for Simple Portal and their blocks.