コード例 #1
0
ファイル: flood_include.php プロジェクト: knapnet/PHP-Fusion
function flood_control($field, $table, $where, $debug = FALSE)
{
    global $userdata, $settings, $locale, $defender;
    $flood = FALSE;
    if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD) || $debug) {
        $result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where);
        if (dbrows($result)) {
            $time = time();
            $data = dbarray($result);
            if ($time - $data['last_post'] < $settings['flood_interval']) {
                $defender->stop();
                addNotice('warning', sprintf($locale['flood'], countdown($settings['flood_interval'] - ($time - $data['last_post']))));
                $flood = TRUE;
                $result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_ip_type, flood_timestamp) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '" . time() . "')");
                // This should be in settings, "After how many flood offences take action" then a setting for what action to take
                if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) {
                    if (!$debug) {
                        if (iMEMBER && $settings['flood_autoban'] == "1") {
                            require_once INCLUDES . "sendmail_include.php";
                            require_once INCLUDES . "suspend_include.php";
                            $result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'");
                            suspend_log($userdata['user_id'], 4, $locale['global_440'], TRUE);
                            $message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']);
                            $message = str_replace("[USER_IP]", USER_IP, $message);
                            $message = str_replace("[USER_IP]", USER_IP, $message);
                            $message = str_replace("[SITE_EMAIL]", $settings['siteemail'], $message);
                            $message = str_replace("[SITEUSERNAME]", $settings['siteusername'], $message);
                            $subject = str_replace("[SITENAME]", $settings['sitename'], $locale['global_441']);
                            sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
                        } elseif (!iMEMBER) {
                            $result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_ip_type, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '', '" . $locale['global_440'] . "')");
                        }
                    } else {
                        addNotice('info', "DEBUG MESSAGE: Triggered flood control action due to repeated offences. This could've resulted in a ban or suspenstion");
                    }
                }
            }
        }
    }
    return $flood;
}
コード例 #2
0
ファイル: overview.php プロジェクト: sonicmaster/RPG
                            <tr><td align="center" valign="middle"><b>' . $lang['over']['0300'] . '</b></td></tr>
                        </table>';
     }
 } else {
     $parse['build'] = '<table cellspacing="0" style="width:100%;">
                        <tr><td align="center" valign="middle"><b>' . $lang['over']['0300'] . '</b></td></tr>
                    </table>';
 }
 if ($planetrow['b_tech'] != 0) {
     HandleTechnologieBuild($planetrow, $user);
     if ($planetrow['b_tech'] != 0) {
         $BuildQueue = explode(";", $planetrow['b_tech_id']);
         $CurrBuild = explode(",", $BuildQueue[0]);
         $RestTime = $planetrow['b_tech'] - time();
         $PlanetID = $planetrow['id'];
         $Build = countdown('forschung', $RestTime);
         $Build2 = $lang['tech'][$CurrBuild[0]];
         $parse['tech'] = '<table cellspacing="0" cellpadding="0" style="width:100%;">
                             <tr><td class="sb" align="left" style="width:30%;" valign="top" ><img src="' . $dpath . 'gebaeude/' . $CurrBuild[0] . '.gif" style="width:40px; height:40px;" alt=""></td>
                                 <td class="sb" align="center" style="width:70%;" valign="middle" >' . $Build . ' </td></tr>
                             <tr><td class="sb" align="center" style="width:30%;" valign="middle" ><img src="./styl/image/pfeile/rechto.png" alt=""></td>
                                 <td class="sb" align="left" style="width:70%;" valign="middle" >' . $Build2 . ' </td></tr>
                         </table>';
     } else {
         $parse['tech'] = '<table cellspacing="0" style="width:100%;">
                            <tr><td align="center" valign="middle"><b>' . $lang['over']['0300'] . '</b></td></tr>
                        </table>';
     }
 } else {
     $parse['tech'] = '<table cellspacing="0" style="width:100%;">
                       <tr><td align="center" valign="middle"><b>' . $lang['over']['0300'] . '</b></td></tr>
コード例 #3
0
ファイル: karte.php プロジェクト: o-wars/o-wars
					</td>
					<td align="left" >
						&nbsp;25000+ Kampfpunkte
					</td>
				</tr>
				<tr align="center" class="standard">
					<td colspan="4" align="center" >
						<br />(Tr&uuml;mmerfelder k&ouml;nnen erst ab einer<br />gr&ouml;sse von 2500 vom Scanner entdeckt werden.)
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>';
    $file = fopen($path, 'w');
    fputs($file, $karte);
    fclose($file);
    $karte = str_replace('SID', SID, $karte);
    $karte = str_replace('%update%', countdown(4 * 3600), $karte);
    $content .= $karte;
    mysql_query("UPDATE `user` SET `karte` = '" . date('U') . "' WHERE `omni` = '" . $_SESSION['user']['omni'] . "' LIMIT 1 ;");
} else {
    $file = @fopen($path, 'r');
    $size = filesize($path);
    $karte = fread($file, $size);
    $karte = str_replace('SID', SID, $karte);
    $karte = str_replace('%update%', countdown($time['karte'] + 4 * 3600 - date('U')), $karte);
    $content .= $karte;
}
$content = tag2value("onload", 'startCountdown1();', $content);
echo $content . template('footer');
コード例 #4
0
ファイル: projects.php プロジェクト: helinp/MediaGrade
                ?>">
                <div class="panel-body">
                    <b><?= $project->project_name; ?> </b><br /><?= $project->class . ' - ' . $project->term; ?>
                </div>
                <div class="panel-body">
                    <a  data-toggle="modal" data-target="#projectModal"  href="/admin/instructions/<?= $project->project_id ?>"><span class="glyphicon glyphicon-file"></span> Consignes</a><br />
                </div>
                <div class="panel-footer clearfix">
                    <?php if (countdown($project->deadline)): ?>
                        <span class="label label-info">J - <?= countdown($project->deadline); ?></span>
                    <?php endif ?>
                    <span class="label label-info"><?php

                        if($project->is_activated && countdown($project->deadline)) echo _('En cours');
                        elseif ($project->is_activated && !countdown($project->deadline)) echo _('Terminé');
                        elseif (!$project->is_activated) echo _('Désactivé');

                        ?></span>
                        <div class="dropdown pull-right">
                          <a data-toggle="modal" data-target="#projectModal" href="/admin/project_management/<?= $project->project_id; ?>" class="btn btn-default btn-xs" role="button">
                            <?=_('Modifier') ?></a>
                        </div>
                    </div>
                </div>
            </div>



            <?php
コード例 #5
0
ファイル: raketen.php プロジェクト: o-wars/o-wars
 $start = $row[fertigstellung];
 do {
     $i++;
     if ($i < 4) {
         if ($row[type] >= 1 and $row[type] <= 15) {
             $content .= '<tr align="left"><td>' . $einh[$row[type]][name] . '</td><td style="width:55px"><center>' . countdown($row[fertigstellung] - date(U)) . '</center></td></tr>';
             $stop = $row[fertigstellung];
         }
         if ($row[type] >= 1001 and $row[type] <= 1011) {
             $row[type] -= 1000;
             $content .= '<tr align="left"><td>' . $def[$row[type]][name] . '</td><td style="width:55px"><center>' . countdown($row[fertigstellung] - date(U)) . '</center></td></tr>';
             $stop = $row[fertigstellung];
         }
         if ($row[type] >= 2001 and $row[type] <= 2006) {
             $row[type] -= 2000;
             $content .= '<tr align="left"><td>' . $rak[$row[type]][name] . '</td><td style="width:55px"><center>' . countdown($row[fertigstellung] - date(U)) . '</center></td></tr>';
             $stop = $row[fertigstellung];
         }
     } else {
         if ($row[type] >= 1 and $row[type] <= 15) {
             $content .= '<tr align="left"><td>' . $einh[$row[type]][name] . '</td><td style="width:55px"><center>' . time2str($row[fertigstellung] - date(U)) . '</center></td></tr>';
             $stop = $row[fertigstellung];
         }
         if ($row[type] >= 1001 and $row[type] <= 1011) {
             $row[type] -= 1000;
             $content .= '<tr align="left"><td>' . $def[$row[type]][name] . '</td><td style="width:55px"><center>' . time2str($row[fertigstellung] - date(U)) . '</center></td></tr>';
             $stop = $row[fertigstellung];
         }
         if ($row[type] >= 2001 and $row[type] <= 2006) {
             $row[type] -= 2000;
             $content .= '<tr align="left"><td>' . $rak[$row[type]][name] . '</td><td style="width:55px"><center>' . time2str($row[fertigstellung] - date(U)) . '</center></td></tr>';
コード例 #6
0
ファイル: mission.php プロジェクト: o-wars/o-wars
            } elseif ($row['type'] == 3) {
                $mission = '&uuml;berf&uuml;hren';
            } elseif ($row['type'] == 4) {
                $mission = 'sammeln';
            }
            $i = 0;
            do {
                $i++;
                $size += $row['einh' . $i] * $einh[$i]['size'];
            } while ($i < 15);
            if ($size > $ressis['hangar']) {
                $size = '<font color="red">' . $size . '</font>';
            }
            $newpiece = str_replace('%type%', $mission, $piece);
            $newpiece = str_replace('%ziel%', $row['ziel'], $newpiece);
            $newpiece = str_replace('%size%', $size, $newpiece);
            $newpiece = str_replace('%units%', $row['einh1'] + $row['einh2'] + $row['einh3'] + $row['einh4'] + $row['einh5'] + $row['einh6'] + $row['einh7'] + $row['einh8'] + $row['einh9'] + $row['einh10'] + $row['einh11'] + $row['einh12'] + $row['einh13'] + $row['einh14'] + $row['einh15'], $newpiece);
            $newpiece = str_replace('%speed%', $row['speed'], $newpiece);
            $newpiece = str_replace('%ankunft%', date('H:i - d.m', $row['return']), $newpiece);
            $newpiece = str_replace('%countdown%', countdown($row['return'] - date('U')), $newpiece);
            $newpiece = str_replace('%mehr%', '<a href="mission.php?' . SID . '&amp;id=' . $row['id'] . '">mehr</a>', $newpiece);
            $newpiece = str_replace('%link%', 'mission.php?' . SID . '&amp;id=' . $row['id'], $newpiece);
            $missionr .= $newpiece;
            $size = 0;
        }
    } while ($row);
    $content = tag2value('return_missions', $missionr, $content);
}
// generierte seite ausgeben
$content = tag2value("onload", $onload, $content);
echo $content . template('footer');
コード例 #7
0
<?php

function countdown($counter)
{
    while ($counter > 0) {
        print "{$counter}..";
        $counter--;
    }
    print "boom!<br>\n";
}
$counter = 5;
countdown($counter);
print "Now, counter is {$counter}";
コード例 #8
0
ファイル: countdown.php プロジェクト: philhassey/ludumdare
//countdown(2008,8,8,12+10,0); // Start Time //
//countdown(2008,8,10,12+10,0); // Start Time //
//countdown(2008,8,24,12+10,0); // Judge End Time //
// LD 13
//countdown(2008,12,5,12+10,0); // Start Time //
//countdown(2008,12,7,12+10,0); // End Time //
//countdown(2008,12,21,12+10,0); // Judge End Time //
// LD 14
//countdown(2009,4,17,12+10,0); // Start Time //
//countdown(2009,4,19,12+10,0); // End Time //
// countdown(2009,5,6,12+10,0); // Judge End Time //
// LD 15
//countdown(2009,8,28,12+10,0); // Start Time //
// LD16
// countdown(2009,12,11,12+8,0); // start time
countdown(2009, 12, 13, 12 + 8, 0);
// end time
//--------------------------
// author: Louai Munajim
// website: www.elouai.com
//
// Note:
// Unix timestamp limitations
// Date range is from
// the year 1970 to 2038
//--------------------------
function countdown($year, $month, $day, $hour, $minute)
{
    // make a unix timestamp for the given date
    $the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
    // get current unix timestamp
コード例 #9
0
ファイル: beschuss.php プロジェクト: o-wars/o-wars
                $entfernung += $to_position['y'] + $to_position['z'] * 20 - ($own_position['y'] + $own_position['z'] * 20);
            }
            if (!$row) {
                $content .= '<span style="font-size: 12px";><b>Du kannst diese Mission nicht beschiessen!</b></span><br />';
            } else {
                if ($row['ankunft'] < date('U')) {
                    $content .= '<span style="font-size: 12px";><b>Du kannst diese Mission nicht beschiessen da sie bereits auf dem R&uuml;ckweg ist!</b></span><br />';
                } elseif ($row['ankunft'] < date('U') + 300) {
                    $content .= '<span style="font-size: 12px";><b>Du kannst diese Mission nicht beschiessen da sie bereits weniger wie 5 minuten von deiner Basis entfernt ist!</b></span><br />';
                } else {
                    mysql_query("UPDATE `raketen` SET `einh1` = '" . ($raksilo['einh1'] - $_POST['anz1']) . "', `einh2` = '" . ($raksilo['einh2'] - $_POST['anz2']) . "', `einh3` = '" . ($raksilo['einh3'] - $_POST['anz3']) . "', `einh4` = '" . ($raksilo['einh4'] - $_POST['anz4']) . "', `einh5` = '" . ($raksilo['einh5'] - $_POST['anz5']) . "', `einh6` = '" . ($raksilo['einh6'] - $_POST['anz6']) . "' WHERE `omni` = '" . $_SESSION['user']['omni'] . "' LIMIT 1;");
                    $ankunftK = $row['ankunft'] - date('U');
                    //$ankunft  = (date('U')) + ($ankunftK * $row['speed'] / 666);
                    $entfernung = $entfernung / 100 * ($row['ankunft'] - date('U')) / (($row['ankunft'] - $row['started']) / 100);
                    $ankunft = date(U) + felder2time($entfernung * 10 / 666) - 3600;
                    $content .= '<span style="font-size: 12px";><b>Beschuss gestartet, Einschlag in ' . countdown($ankunft - date('U')) . '.</b></span><br />';
                    mysql_query("INSERT INTO `beschuss` ( `id` , `start` , `ziel` , `type` , `einh1` , `einh2` , `einh3` , `einh4` , `einh5` , `einh6` , `ankunft` ) VALUES ('', '" . $_SESSION['user']['omni'] . "', '" . $_POST['ziel'] . "', '" . $type . "', '" . $_POST['anz1'] . "', '" . $_POST['anz2'] . "', '" . $_POST['anz3'] . "', '" . $_POST['anz4'] . "', '" . $_POST['anz5'] . "', '" . $_POST['anz6'] . "', '" . $ankunft . "');");
                    $eid = mysql_insert_id($dbh);
                    $selectResult = mysql_query("INSERT INTO `events` ( `id` , `type` , `eid` , `date` ) VALUES ('', '5', '" . $eid . "', '" . $ankunft . "');");
                    do {
                        $raksilo['einh' . $i] -= $_POST['anz' . $i];
                        $i++;
                    } while ($i <= 6);
                }
            }
        }
    }
}
do {
    $count++;
    $treffer[$count] = $rak[$count]['treffer'] * $gebaeude['raketensilo'];
コード例 #10
0
ファイル: overview.php プロジェクト: helinp/MediaGrade
                                    <span class="label label-success">En cours</span>
                                <?php else: ?>
                                    <span class="label label-info">Clôturé</span>
                                <?php endif?>
                                <?php if($project->graded): ?>
                                    <span class="label label-primary">Évalué</span>
                                <?php endif ?>
                            </p>
                            </div>

                            <div class="btn-group btn-group-justified" role="group" aria-label="...">
                                <div class="btn-group" role="group">
                                    <a data-toggle="modal" data-target="#projectModal" href="/projects/instructions/<?= $project->project_id ?>" type="button" class="btn btn-sm btn-default">Consignes</a>
                                </div>
                                <div class="btn-group" role="group">
                                    <a href="<?= (countdown($project->raw_deadline) ? '/projects/submit/' . $project->project_id . '" data-toggle="modal" data-target="#projectModal" ' : '"#"' ) ?> type="button" class="btn btn-sm btn-default" <?= (countdown($project->raw_deadline) ? '' : 'disabled') ?>>Remise</a>
                                </div>
                                <div class="btn-group" role="group">
                                    <a data-toggle="modal" data-target="#projectModal" href="/projects/results/<?= $project->project_id ?>" type="button" class="btn btn-sm btn-default">Résultats</a>
                                </div>
                            </div>

                        </div>
                    </div>

                    <?php
                    if ($projects[$curr]->term !== @$projects[$curr + 1]->term)
                    {
                        echo '</div>
                        <!-- /. row term-->';
                    }
コード例 #11
0
ファイル: raumstation.php プロジェクト: o-wars/o-wars
    do {
        $row = mysql_fetch_array($result);
        if ($row) {
            $munition .= '<option value="' . $row['id'] . '">' . $row['damage'] . ' Schaden</option>';
        }
    } while ($row);
}
$select = "SELECT * FROM `munition` WHERE `omni` = '" . $_SESSION['user']['omni'] . "' AND `finished` > '" . date('U') . "';";
$result = mysql_query($select);
$row = @mysql_fetch_array($result);
if (!$row) {
    $munbauen = template('munition_bauen');
} else {
    $muninbau = 1;
    $munbauen = template('munition_bauen_countdown');
    $munbauen = tag2value('restdauer', countdown($row['finished'] - date('U')), $munbauen);
    $munbauen = tag2value('schaden', $row['damage'], $munbauen);
}
if ($muninbau != 1 and $rounds >= ($raumstation['plasma'] - 1) * 2) {
    $munbauen = template('munition_bauen_voll');
}
// scanner
if ($_POST['submit'] == "Kosten berechnen") {
    $to_position = position($_POST['scanbase']);
    $own_position = position($_SESSION['user']['omni']);
    $own_pos = $own_position[x] + ($own_position[y] + $own_position[z] * 20);
    $to_pos = $to_position[x] + ($to_position[y] + $to_position[z] * 20);
    if ($own_position[x] > $to_position[x]) {
        $entfernung = $own_position[x] - $to_position[x];
    } else {
        $entfernung = $to_position[x] - $own_position[x];
コード例 #12
0
ファイル: overview.php プロジェクト: sonicmaster/RPG
 $parse['anothers_planets'] = $AllPlanets;
 $parse['max_users'] = $game_config['users_amount'];
 $parse['metal_debris'] = pretty_number($galaxyrow['metal']);
 $parse['crystal_debris'] = pretty_number($galaxyrow['crystal']);
 if (($galaxyrow['metal'] != 0 || $galaxyrow['crystal'] != 0) && $planetrow[$resource[209]] != 0) {
     $parse['get_link'] = " (<a href=\"?action=internalQuickfleet&amp;mode=8&amp;g=" . $galaxyrow['galaxy'] . "&amp;s=" . $galaxyrow['system'] . "&amp;p=" . $galaxyrow['planet'] . "&amp;t=2\">" . $lang['type_mission'][8] . "</a>)";
 } else {
     $parse['get_link'] = '';
 }
 UpdatePlanetBatimentQueueList($planetrow, $user);
 if ($planetrow['b_building'] != 0) {
     $BuildQueue = explode(";", $planetrow['b_building_id']);
     $CurrBuild = explode(",", $BuildQueue[0]);
     $RestTime = $planetrow['b_building'] - time();
     $PlanetID = $planetrow['id'];
     $parse['building'] = "<th>" . countdown('gebaude', $RestTime, 'Kontrollzentrum') . "</th><th>" . $lang['tech'][$CurrBuild[0]] . " (Stufe " . $CurrBuild[1] . ") </th>";
 } else {
     $parse['building'] = "<th>&nbsp;</th><th>&nbsp;</th>";
 }
 if ($planetrow['b_tech'] != 0) {
     HandleTechnologieBuild($planetrow, $user);
     if ($planetrow['b_tech'] != 0) {
         $BuildQueue = explode(";", $planetrow['b_tech_id']);
         $CurrBuild = explode(",", $BuildQueue[0]);
         $RestTime = $planetrow['b_tech'] - time();
         $PlanetID = $planetrow['id'];
         $parse['tech'] = "<th>" . Countdown("forschung", $RestTime, 'Kontrollzentrum') . "</th><th>" . $lang['tech'][$CurrBuild[0]] . "</th>";
     } else {
         $parse['tech'] = "<th>&nbsp;</th><th>&nbsp;</th>";
     }
 } else {
コード例 #13
0
ファイル: uebersicht.php プロジェクト: o-wars/o-wars
$select = "SELECT * FROM `fabrik` WHERE `omni` = " . $_SESSION[user][omni] . " ORDER BY fertigstellung ASC;";
$result = mysql_query($select);
$rows = mysql_numrows($result);
$row = mysql_fetch_array($result);
$i = 0;
if ($row) {
    do {
        $i++;
        if ($row['type'] < 1000) {
            $fabrik .= '<b>' . $einh[$row['type']]['name'] . ' - ' . countdown($row['fertigstellung'] - date('U')) . '</b><br />';
        } elseif ($row['type'] < 2000) {
            $row['type'] -= 1000;
            $fabrik .= '<b>' . $def[$row['type']]['name'] . ' - ' . countdown($row['fertigstellung'] - date('U')) . '</b><br />';
        } elseif ($row['type'] < 3000) {
            $row['type'] -= 2000;
            $fabrik .= '<b>' . $rak[$row['type']]['name'] . ' - ' . countdown($row['fertigstellung'] - date('U')) . '</b><br />';
        }
        $row = mysql_fetch_array($result);
    } while ($row and $i < 3);
} else {
    $fabrik = '<b>-----</b>';
}
$select = "SELECT * FROM `defense` WHERE `omni` = '" . $_SESSION['user']['omni'] . "';";
$result = mysql_query($select);
$defender_def = mysql_fetch_array($result);
$select = "SELECT * FROM `hangar` WHERE `omni` = '" . $_SESSION['user']['omni'] . "';";
$result = mysql_query($select);
$defender = mysql_fetch_array($result);
// forschungen
$select = "SELECT * FROM `forschungen` WHERE `omni` = '" . $_SESSION[user][omni] . "';";
$result = mysql_query($select);
コード例 #14
0
ファイル: countdown.php プロジェクト: vincseize/GDC
    $myfile = fopen($file, "w") or die("Unable to open file!");
    fwrite($myfile, 0);
    fclose($myfile);
    $n_battles_ennemy_used = file_get_contents($file);
}
// n_battles_team_used
$file = "n_battles_team_used.txt";
if (file_exists($file)) {
    $n_battles_team_used = file_get_contents($file);
} else {
    $myfile = fopen($file, "w") or die("Unable to open file!");
    fwrite($myfile, 0);
    fclose($myfile);
    $n_battles_team_used = file_get_contents($file);
}
countdown($CTthisYear, $CTthisMonth, $CTthisDay, $CTthisHour, $CTthisMinute, $tot_battles, $n_team_victory, $n_ennemy_victory, $n_battles_team_used, $n_battles_ennemy_used);
function countdown($year, $month, $day, $hour, $minute, $tot_battles, $n_team_victory, $n_ennemy_victory, $n_battles_team_used, $n_battles_ennemy_used)
{
    // make a unix timestamp for the given date
    $the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
    // get current unix timestamp
    $today = time();
    $difference = $the_countdown_date - $today;
    if ($difference < 0) {
        $difference = 0;
    }
    $days_left = floor($difference / 60 / 60 / 24);
    $hours_left = floor(($difference - $days_left * 60 * 60 * 24) / 60 / 60);
    $minutes_left = floor(($difference - $days_left * 60 * 60 * 24 - $hours_left * 60 * 60) / 60);
    //echo "<br>";
    $color_gdc = "yellow";