本文整理汇总了PHP中getTimestamp函数的典型用法代码示例。如果您正苦于以下问题:PHP getTimestamp函数的具体用法?PHP getTimestamp怎么用?PHP getTimestamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTimestamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showStatus
public function showStatus()
{
if ($this->_sock !== null) {
return getTimestamp() . " Listening on {$this->_host}:{$this->_port}\n";
} else {
return getTimestamp() . " Not listening yet. Configured for {$this->_host}:{$this->_port}\n";
}
}
示例2: adicionar
public function adicionar($conexao, $acao, $oQue, $quem, $qual)
{
try {
$timestamp = getTimestamp();
$conexao->query()->from("logs")->save(array("acao" => $acao, "oque" => $oQue, "quem" => $quem, "qual" => $qual, "data" => getData($timestamp), "timestampData" => $timestamp));
} catch (Exception $e) {
throw $e;
}
}
示例3: isContractOptionAvailable
function isContractOptionAvailable($playerData, $durationDays)
{
if (!isset($playerData['vertrag'])) {
throw new Exception('Property "vertrag" not set in player data');
} elseif (!isset($playerData['wiealt'])) {
throw new Exception('Property "wiealt" not set in player data');
} elseif (!isset($playerData['moral'])) {
throw new Exception('Property "moral" not set in player data');
} else {
return $playerData['vertrag'] < getTimestamp('+' . $durationDays . ' days') && ($playerData['wiealt'] + GAME_DAYS_TO_REAL_DAYS_RATIO * $durationDays) / 365 < 35 && $playerData['moral'] >= getMinMoraleRequired($durationDays);
}
}
示例4: setUp
public function setUp()
{
parent::setUp();
$this->adapter = $this->getMockForAbstractClass('DynamicTable\\Adapter\\GenericDBAdapter');
$this->adapter->setSelect('*');
$this->adapter->setFrom('users');
$this->adapter->setWhere("");
$this->adapter->setParams([]);
$this->table = new Table();
$this->table->setAdapter($this->adapter);
$this->table->setColumns(['id' => ['title' => 'ID', 'sql_id' => 'id', 'type' => Table::TYPE_INTEGER, 'filters' => [Table::FILTER_EQUAL], 'sortable' => true, 'visible' => false], 'string' => ['title' => 'String', 'sql_id' => 'string', 'type' => Table::TYPE_STRING, 'filters' => [Table::FILTER_LIKE, Table::FILTER_NULL], 'sortable' => true, 'visible' => true], 'integer' => ['title' => 'Integer', 'sql_id' => 'integer', 'type' => Table::TYPE_INTEGER, 'filters' => [Table::FILTER_BETWEEN], 'sortable' => true, 'visible' => true], 'float' => ['title' => 'Float', 'sql_id' => 'float', 'type' => Table::TYPE_FLOAT, 'filters' => [Table::FILTER_NULL], 'sortable' => true, 'visible' => true], 'boolean' => ['title' => 'Boolean', 'sql_id' => 'boolean', 'type' => Table::TYPE_BOOLEAN, 'filters' => [Table::FILTER_EQUAL, Table::FILTER_NULL], 'sortable' => true, 'visible' => true], 'datetime' => ['title' => 'DateTime', 'sql_id' => 'datetime', 'type' => Table::TYPE_DATETIME, 'filters' => [Table::FILTER_NULL], 'sortable' => true, 'visible' => true]]);
$this->table->setMapper(function ($row) {
$result = $row;
if ($row['datetime'] !== null) {
$result['datetime'] = $row['datetime'] . getTimestamp();
}
return $result;
});
}
示例5: mysql_query
mysql_query("INSERT INTO login ( CODLOGIN, DTA, LOGIN, SENHA, PAPEL, OWNER, STATUS) VALUES ( '{$codlogin}', CURRENT_TIMESTAMP, '{$login}', '{$senha}', '{$administrador}{$gerente}{$guest}', '{$_SESSION['CODPESSOA']}', '{$status}' )");
mysql_query("INSERT INTO pessoa ( CODPESSOA, NOME, DTA, OWNER, SEXO, EMAIL) VALUES ( '{$codpessoa}', '{$nome_sobrenome}', CURRENT_TIMESTAMP, '" . $_SESSION['CODPESSOA'] . "', '" . $_POST['ISITEM'] . "', '{$email}' )");
mysql_query("INSERT INTO login_rel_pessoa ( `CODLOGIN`,`CODPESSOA`) VALUES ( '{$codlogin}', '{$codpessoa}')");
echo "<script>alert('* " . getLabel('LABEL_ADD_SUCESSO_LABEL', $_SESSION['LANGUAGE']) . "!)</script>";
echo "<script>window.location = 'index.php?actionType=gerenciar.usuarios';</script>";
}
}
} else {
$erro = getLabel('ERRO_PREENCHER_TODOS_CAMPOS', $_SESSION['LANGUAGE']);
}
$pi = "<form name='formCpf' method='post' action='index.php?actionType=gerenciar.usuarios.add'>";
$pi .= "<div class='ErroMessage'>* {$erro}!</div>";
$pi .= "<br/>";
$pi .= "<div style='margin-bottom: 3px;'></div>";
$pi .= "<div>";
$CODLOGIN = strtoupper(md5(getTimestamp()));
$pi .= "<input type='hidden' name='CODLOGIN' value='{$CODLOGIN}'/>";
$pi .= "</div>";
$pi .= "<div style='margin-bottom: 3px;'></div>";
$pi .= "<div class='EntradaTextForm'>";
if (!empty($_POST)) {
$pi .= "<input class='LiloginText' style='width: 250px' type='text' id='nome' name='nome' value='" . $_POST['nome'] . "' maxlength='70' placeholder='" . getLabel('LABEL_NAME', $_SESSION['LANGUAGE']) . "'/>";
} else {
$pi .= "<input class='LiloginText' style='width: 250px' type='text' id='nome' name='nome' value='' maxlength='70' placeholder='" . getLabel('LABEL_NAME', $_SESSION['LANGUAGE']) . "'/>";
}
$pi .= "</div>";
$pi .= "<div style='margin-bottom: 3px;'></div>";
$pi .= "<div class='EntradaTextForm'>";
if (!empty($_POST)) {
$pi .= "<input class='LiloginText' style='width: 250px' type='text' id='sobrenome' name='sobrenome' value='" . $_POST['sobrenome'] . "' maxlength='70' placeholder='" . getLabel('LABEL_SOBRENOME', $_SESSION['LANGUAGE']) . "'/>";
} else {
示例6: genNewAtomDropDownMenu
if (isset($conceptTableInfo['SESSION'])) {
if (!isset($sessionAtom) || !isAtomInConcept($sessionAtom, 'SESSION')) {
echo '<div class="MenuItem" id="MenuBarLogout"><a href="index.php?Login"><span class=TextContent>Loginx</span></a></div>';
} else {
echo '<div class="MenuItem" id="MenuBarLogout"><a href="javascript:resetSession()"><span class=TextContent>Logout</span></a></div>';
}
}
if ($isDev) {
echo '<div class="MenuItem" id="MenuBarReset"><a href="javascript:resetDatabase()"><span class=TextContent>Reset</span></a></div>';
}
echo '</div>';
// .MenuBar
echo '</div>';
// #TopLevelInterfaces
genNewAtomDropDownMenu();
$timeStamp = getTimestamp($err);
// access database to see if it is there
if ($err) {
echo '<br/>Cannot access database. Make sure the MySQL server is running, or <a href="javascript:resetDatabase()">create a new database</span></a>.';
} else {
if (isset($_REQUEST['Login'])) {
echo '<div id=AmpersandRoot>';
Login();
echo '</dev>';
} else {
if (isset($_REQUEST['CheckLogin'])) {
echo '<div id=AmpersandRoot>';
CheckLogin();
echo '</dev>';
} else {
if (!isset($_REQUEST['interface']) || !isset($_REQUEST['atom'])) {
示例7: mysql_query
if (mysql_affected_rows() > 0) {
$upd1 = "UPDATE " . $prefix . "teams SET scout = " . $temp . " WHERE ids = '" . $cookie_team . "'";
$upd2 = mysql_query($upd1);
$_SESSION['scout'] = $temp;
$cookie_scout = $temp;
// PROTOKOLL ANFANG
$formulierung = __('Du hast einen Scout der Stufe %d eingestellt.', $temp);
$sql7 = "INSERT INTO " . $prefix . "protokoll (team, text, typ, zeit) VALUES ('" . $cookie_team . "', '" . $formulierung . "', 'Assistenten', '" . time() . "')";
$sql8 = mysql_query($sql7);
// PROTOKOLL ENDE
setTaskDone('change_workers');
} else {
$ch1 = "SELECT zeit FROM " . $prefix . "personal_changes WHERE team = '" . $cookie_team . "' AND personal = 'Scout'";
$ch2 = mysql_query($ch1);
$ch3 = mysql_fetch_assoc($ch2);
addInfoBox(__('Du kannst jeden Assistenten nur alle 22 Tage austauschen. Du musst also noch bis %s warten.', date('d.m.Y H:i', getTimestamp('+22 days', $ch3['zeit']))));
}
}
}
$sql1 = "SELECT scout FROM " . $prefix . "teams WHERE ids = '" . $cookie_team . "'";
$sql2 = mysql_query($sql1);
$sql3 = mysql_fetch_assoc($sql2);
?>
<div style="float:left; width:280px;">
<form action="/ver_personal.php" method="post" accept-charset="utf-8">
<p>
<input type="radio" name="scout" value="1" <?php
if ($sql3['scout'] == 1) {
echo 'checked="checked" ';
}
?>
示例8: _
echo '<h1>' . _('Testspiel vereinbaren') . '</h1><p><strong>' . _('Zu spät:') . '</strong> ' . _('In dieser Saison können leider keine Testspiele mehr vereinbart werden.') . '</p>';
} elseif ($getkonto4 < Friendlies::getPrice($cookie_liga, $prefix)) {
echo '<h1>' . _('Testspiel vereinbaren') . '</h1><p><strong>' . _('Zu teuer:') . '</strong> ' . _('Im Moment hast Du leider nicht genügend Geld, um ein Testspiel vereinbaren zu können.') . '</p>';
} else {
$optionsStr = '';
$optionsStr .= '<h1>' . _('Testspiel vereinbaren') . '</h1>';
$optionsStr .= '<p><strong>' . _('Wichtig:') . '</strong> ' . __('Das Testspiel findet immer im Stadion des Anfragenden statt. Beide Teams müssen für ein Testspiel eine Entschädigung an den Verband zahlen, damit das Spiel genehmigt wird. Für Dich sind das %s €.', number_format(Friendlies::getPrice($cookie_liga, $prefix), 0, ',', '.')) . '</p>';
$optionsStr .= '<form action="/testspiel_anfrage.php" method="get" accept-charset="utf-8">';
$heute_tag = date('d', time());
$heute_monat = date('m', time());
$heute_jahr = date('Y', time());
$datum_spiel = mktime(23, 00, 00, $heute_monat, $heute_tag, $heute_jahr);
$nochMoeglicheTage = 0;
$optionsStr .= '<p><select name="datum" size="1" style="width:200px">';
for ($d = 2; $d < $gesp3_noch; $d++) {
$datum_spiel_temp = getTimestamp('+' . $d . ' days', $datum_spiel);
if (!in_array($datum_spiel_temp, $testspiel_tage)) {
$optionsStr .= '<option value="' . $datum_spiel_temp . '">' . date('d.m.Y', $datum_spiel_temp) . '</option>';
$nochMoeglicheTage++;
}
}
$optionsStr .= '</select>';
$optionsStr .= ' <input type="hidden" name="id" value="' . $sql3['team'] . '" /><input type="submit" value="' . _('Anfragen') . '"' . noDemoClick($cookie_id) . ' /></p>';
$optionsStr .= '</form>';
if ($nochMoeglicheTage == 0) {
echo '<h1>' . _('Testspiel vereinbaren') . '</h1><p>' . _('Eure Vereine haben keine freien Termine mehr für ein Testspiel.') . '</p>';
} else {
echo $optionsStr;
}
}
} else {
示例9: json_decode
$json_response = json_decode($json_response, true);
$json_response = $json_response['BookMyShow'];
foreach ($json_response['arrEvent'] as $event) {
if ($event['arrVenues'][0]['RegionCode'] != 'NCR') {
continue;
}
$event_name = trim(str_replace("'", "", $event['EventTitle']));
$event_description = htmlspecialchars(trim($event['EventSynopsis']), ENT_QUOTES);
$category_array = $event['GenreArray'];
$date = (int) $event['arrDates'][0]['ShowDateCode'];
$date_year = (int) ($date / 10000);
$date = $date % 10000;
$date_month = (int) ($date / 100);
$date = $date % 100;
$date = $date_year . "-" . $date_month . "-" . $date;
$date = getTimestamp(strtotime($date));
$lat = (double) $event['arrVenues'][0]['VenueLatitude'];
$lng = (double) $event['arrVenues'][0]['VenueLongitude'];
$venueName = $event['arrVenues'][0]['VenueName'];
$image = $event['BannerURL'];
$link = $event['FShareURL'];
if ($link == '') {
$link = $event['EventWebViewURL'];
}
$query = "INSERT INTO `events` (`name`,`description`,`start_time`,`link`,`venue`,`latitude`,`longitude`,`image_url`) VALUES ('{$event_name}','{$event_description}','{$date}','{$link}','{$venueName}','{$lat}','{$lng}','{$image}')";
if (mysqli_query($connection, $query)) {
$id = mysqli_insert_id($connection);
foreach ($category_array as $cat) {
$cat_id = array_search($cat, $static_categories);
$temp = (int) $cat_id;
$temp++;
示例10: setTaskDone
<?php
if ($loggedin == 1) {
setTaskDone('players_development');
echo '<table>';
echo '<thead>';
echo '<tr>';
echo '<th scope="col">' . _('MT') . '</th>';
echo '<th scope="col">' . _('Spieler') . '</th>';
echo '<th scope="col">' . _('Alter') . '</th>';
echo '<th scope="col">' . _('Datum') . '</th>';
echo '<th scope="col">' . _('Alt') . '</th>';
echo '<th scope="col">' . _('Neu') . '</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$delOld_Timeout = getTimestamp('-28 days');
$delOld1 = "DELETE FROM " . $prefix . "spielerEntwicklung WHERE team = '" . $cookie_team . "' AND zeit < " . $delOld_Timeout;
$delOld2 = mysql_query($delOld1);
$sql1 = "SELECT a.spieler, a.zeit, a.staerkeNeu, a.staerkeAlt, b.vorname, b.nachname, b.position, b.wiealt FROM " . $prefix . "spielerEntwicklung AS a JOIN " . $prefix . "spieler AS b ON a.spieler = b.ids WHERE a.team = '" . $cookie_team . "' ORDER BY a.zeit DESC LIMIT " . $start . ", " . $eintraege_pro_seite;
$sql2 = mysql_query($sql1);
$blaetter3 = anzahl_datensaetze_gesamt($sql1);
while ($sql3 = mysql_fetch_assoc($sql2)) {
echo '<tr>';
echo '<td>' . $sql3['position'] . '</td>';
echo '<td class="link"><a href="/spieler.php?id=' . $sql3['spieler'] . '">' . $sql3['vorname'] . ' ' . $sql3['nachname'] . ' </a></td>';
echo '<td>' . floor($sql3['wiealt'] / 365) . '</td>';
echo '<td>' . date('d.m.Y', $sql3['zeit']) . '</td>';
if ($sql3['staerkeAlt'] == $sql3['staerkeNeu']) {
echo '<td colspan="2">' . _('Höhepunkt') . ' (' . number_format($sql3['staerkeNeu'], 1, ',', '.') . ')</td>';
} else {
echo '<td>' . number_format($sql3['staerkeAlt'], 1, ',', '.') . '</td>';
示例11: acessoDireto
<?php
acessoDireto("ADMINISTRADOR;");
$erro = "";
if (!empty($_POST) && isset($_POST['ACTION'])) {
$codcentralemails = strtoupper(md5(getTimestamp()));
$titulo = trim(htmlentities(tratapost($_POST['titulo'])));
$status = trim(tratapost($_POST['status']));
$status == 'on' ? $status = 1 : ($status = 0);
mysql_query("INSERT INTO `central_emails`( `CODCENTRALEMAILS`, `TITULO`, `STATUS`, `OWNER`) VALUES ( '{$codcentralemails}', '{$titulo}','{$status}','" . $_SESSION['CODPESSOA'] . "')");
echo "<script>alert('* " . getLabel('LABEL_ADD_SUCESSO_LABEL', $_SESSION['LANGUAGE']) . "!')</script>";
echo "<script>window.location = 'index.php?actionType=gerenciar.emails';</script>";
exit;
} else {
$erro = getLabel('ERRO_PREENCHER_TODOS_CAMPOS', $_SESSION['LANGUAGE']);
}
$pi = "<form name='formCpf' method='post' action='index.php?actionType=gerenciar.emails.add'>";
$pi .= "<div class='ErroMessage'>* {$erro}!</div>";
$pi .= "<br/>";
$pi .= "<div style='margin-bottom: 3px;'></div>";
$pi .= "<div class='EntradaTextForm'>";
if (!empty($_POST)) {
$pi .= "<input class='LiloginText' style='width: 250px' type='text' id='titulo' name='titulo' value='" . $_POST['titulo'] . "' maxlength='70' placeholder='" . getLabel('LABEL_TITULO', $_SESSION['LANGUAGE']) . "'/>";
} else {
$pi .= "<input class='LiloginText' style='width: 250px' type='text' id='titulo' name='titulo' value='' maxlength='70' placeholder='" . getLabel('LABEL_TITULO', $_SESSION['LANGUAGE']) . "'/>";
}
$pi .= "</div>";
$pi .= "<div style='margin-bottom: 3px;'></div>";
$pi .= "<div>";
if (!empty($_POST)) {
$_POST['status'] == 'on' ? $pi .= "<input type='checkbox' name='status' checked='true'/> <span class='Userlabel'>" . getLabel('LABEL_ATIVO_TEXT', $_SESSION['LANGUAGE']) . "</span>" : ($pi .= "<input type='checkbox' name='status'/> <span class='Userlabel'>" . getLabel('LABEL_ATIVO_TEXT', $_SESSION['LANGUAGE']) . "</span>");
示例12: acessoDireto
<?php
acessoDireto("ADMINISTRADOR;");
$erro = "";
if (!empty($_POST) && isset($_POST['ACTION'])) {
$codquarto = strtoupper(md5(getTimestamp()));
$codquartotipo = trim(htmlentities(tratapost($_POST['codquartotipo'])));
$nome = trim(htmlentities(tratapost($_POST['nome'])));
$status = trim(tratapost($_POST['status']));
$status == 'on' ? $status = 1 : ($status = 0);
mysql_query("INSERT INTO `quartos`( `CODQUARTO`, `NOME`, `STATUS`, `OWNER` ) VALUES ( '{$codquarto}', '{$nome}','{$status}','" . $_SESSION['CODPESSOA'] . "')");
mysql_query("INSERT INTO `quartos_rel_quartos_tipo`(`CODQUARTO`,`CODQUARTOTIPO`)VALUES('{$codquarto}','{$codquartotipo}')");
echo "<script>alert('* " . getLabel('LABEL_ADD_SUCESSO_LABEL', $_SESSION['LANGUAGE']) . "!')</script>";
echo "<script>window.location = 'index.php?actionType=gerenciar.quartos';</script>";
exit;
} else {
$erro = getLabel('ERRO_PREENCHER_TODOS_CAMPOS', $_SESSION['LANGUAGE']);
}
$pi = "<form name='formCpf' method='post' action='index.php?actionType=gerenciar.quartos.add'>";
$pi .= "<div class='ErroMessage'>* {$erro}!</div>";
$pi .= "<br/>";
$pi .= "<div style='margin-bottom: 3px;'></div>";
$pi .= "<div class='EntradaTextForm'>";
$quartos = mysql_query("SELECT * FROM quartos_tipo WHERE STATUS=1 ORDER BY NOME ASC");
if (mysql_num_rows($quartos) != 0) {
$pi .= "<select class='LiloginText' style='width: 250px' name='codquartotipo' id='codquartotipo' >";
while ($quarto = mysql_fetch_object($quartos)) {
if (!empty($_POST) && isset($_POST['ACTION'])) {
$_POST['codquartotipo'] == $quarto->CODQUARTOTIPO ? $pi .= "<option value='{$quarto->CODQUARTOTIPO}' selected>{$quarto->NOME}</option>" : ($pi .= "<option value='{$quarto->CODQUARTOTIPO}'>{$quarto->NOME}</option>");
} else {
$pi .= "<option value='{$quarto->CODQUARTOTIPO}'>{$quarto->NOME}</option>";
示例13: logLine
logLine(getTimestamp() . "," . memory_get_usage(), $memory_usage_log_file);
$last_memory_log_entry = time();
}
}
// for if the connection to the sql database gives out.
// TODO Find a better way to check the connection. I think on Shared Hosting Servers mysql_ping might be disabled which causes this to always reconnect.
// if (!mysql_ping($sql_connection)) {
// //here is the major trick, you have to close the connection (even though its not currently working) for it to recreate properly.
// mysql_close($sql_connection);
// logLine("__MySQL connection lost, reconnecting__\n");
// $sql_connection = mysql_connect($sugar_config['dbconfig']['db_host_name'], $sugar_config['dbconfig']['db_user_name'], $sugar_config['dbconfig']['db_password']);
// $sql_db = mysql_select_db($sugar_config['dbconfig']['db_name']);
// db_checked_query("SET time_zone='+00:00'");
// }
}
logLine(getTimestamp() . "Event loop terminated, attempting to login again\n");
sleep(1);
}
// TODO i've seen asteriskLogger crash due to a script executing too long error... It was on a pretty budget shared hosting server.
// Hasn't ever happened to me personally... but still something noteworthy.
exit(0);
// ******************
// Helper functions *
// ******************
function createCallId()
{
$query = "SELECT UUID() AS id";
$result = db_checked_query($query);
$row = $GLOBALS['db']->fetchByAssoc($result);
return $row['id'];
}
示例14: VALUES
$teams6 = "INSERT INTO " . $prefix . "spiele (team1, team2, liga, typ, simuliert, datum) VALUES ('keins', 'keins', 'keine', 'Pokal', 1, '" . time() . "')";
$teams7 = mysql_query($teams6);
// 1 leeres Spiel in die DB schreiben, damit Pokal-Auslosung immer abgebrochen wird
}
// TEAMS HOLEN ENDE
// SPIELPAARUNGEN ANFANG
$startzeit = getTimestamp('+' . intval(($naechste_runde - 1) * 4) . ' days', $startzeit);
// 1 abziehen, weil fuer den 1. Spieltag 0x86400 addiert werden muss
shuffle($teamliste);
for ($r1 = 0; $r1 <= round(count($teamliste) / 2 - 1); $r1++) {
// for-Schleife fuer Spielpaarungen: bei 32 Teams gibt es [0..15]
$temporaer_liga = 'Pokal_Runde_' . $naechste_runde;
$temporaer_team1 = $teamliste[$r1];
$temporaer_team2 = $teamliste[count($teamliste) - $r1 - 1];
// 0vs32, 1vs31, ..., 15vs16
$kennung = md5($temporaer_team1 . $temporaer_team2);
$ins1 = "INSERT INTO " . $prefix . "spiele (liga, datum, team1, team2, typ, kennung) VALUES ('" . $temporaer_liga . "', '" . $startzeit . "', '" . $temporaer_team1 . "', '" . $temporaer_team2 . "', 'Pokal', '" . $kennung . "')";
$ins2 = mysql_query($ins1);
if ($naechste_runde < 5) {
$ins1 = "INSERT INTO " . $prefix . "spiele (liga, datum, team1, team2, typ, kennung) VALUES ('" . $temporaer_liga . "', '" . getTimestamp('+1 day', $startzeit) . "', '" . $temporaer_team2 . "', '" . $temporaer_team1 . "', 'Pokal', '" . $kennung . "')";
$ins2 = mysql_query($ins1);
}
}
// SPIELPAARUNGEN ENDE
// POKALERGEBIS SETZEN ANFANG
foreach ($teamliste as $teamliste_pr) {
$yxcvjhsd1 = "UPDATE " . $prefix . "teams SET pokalrunde = " . $naechste_runde . " WHERE name = '" . $teamliste_pr . "'";
$yxcvjhsd2 = mysql_query($yxcvjhsd1);
// aktualisiere die erreichte Pokalrunde
}
// POKALERGEBIS SETZEN ENDE
示例15: array
$spielplan = array();
while ($plan3 = mysql_fetch_assoc($plan2)) {
$spielplan[$plan3['spieltag']][] = array('%' . $plan3['team1'] . '%', '%' . $plan3['team2'] . '%');
}
$platzhalter = array('%1%', '%2%', '%3%', '%4%', '%5%', '%6%', '%7%', '%8%', '%9%', '%10%', '%11%', '%12%', '%13%', '%14%', '%15%', '%16%', '%17%', '%18%', '%19%', '%20%');
$counterStart = mktime(15, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
$sql4 = "SELECT ids, land FROM " . $prefix . "ligen";
$sql5 = mysql_query($sql4);
while ($sql6 = mysql_fetch_assoc($sql5)) {
$counter = getTimestamp('+1 day', $counterStart);
$liga_id = $sql6['ids'];
$liga_land = mysql_real_escape_string($sql6['land']);
$sql7 = "SELECT name FROM " . $prefix . "teams WHERE liga = '" . $liga_id . "'";
$sql8 = mysql_query($sql7);
$mannschaften = array();
while ($sql9 = mysql_fetch_assoc($sql8)) {
$mannschaften[] = $sql9['name'];
}
shuffle($mannschaften);
foreach ($spielplan as $spieltag) {
foreach ($spieltag as $begegnung) {
$team1 = str_replace($platzhalter, $mannschaften, $begegnung[0]);
$team1 = mysql_real_escape_string($team1);
$team2 = str_replace($platzhalter, $mannschaften, $begegnung[1]);
$team2 = mysql_real_escape_string($team2);
$rein1 = "INSERT INTO " . $prefix . "spiele (liga, datum, team1, team2, typ, land) VALUES ('" . $liga_id . "', " . $counter . ", '" . $team1 . "', '" . $team2 . "', 'Liga', '" . $liga_land . "')";
$rein2 = mysql_query($rein1);
}
$counter = getTimestamp('+1 day', $counter);
}
}