Hallo
ich möchte gerne bei einen vote script die aktuelle Kalenderwoche anzeigen lassen
wir haben jetz die 42 woche und angezeigt wird die 41 woche
hier die datein würde mich freuen wenn mir einer helfen könnte
datei 1
datei 2
Vielen dank
ich möchte gerne bei einen vote script die aktuelle Kalenderwoche anzeigen lassen
wir haben jetz die 42 woche und angezeigt wird die 41 woche
hier die datein würde mich freuen wenn mir einer helfen könnte
datei 1
PHP:
/* // ~~~ DETECT BROWSER LANGUAGE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~ CONVERT MYSQL DATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
function convert_mysql_date($date)
{
$date = explode("-", $date);
return $date[2].".".$date[1].".".$date[0];
}
/* // ~~~ CONVERT MYSQL DATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~ GET MONTH NAME ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
function get_monthname($month_number, $format)
{
global $UC_lang;
if ($format == 1)
{
switch ($month_number)
{
case '' : $month_string = "";
case '1' : $month_string = $UC_lang['month_jan']; break;
case '2' : $month_string = $UC_lang['month_feb']; break;
case '3' : $month_string = $UC_lang['month_mar']; break;
case '4' : $month_string = $UC_lang['month_apr']; break;
case '5' : $month_string = $UC_lang['month_may']; break;
case '6' : $month_string = $UC_lang['month_jun']; break;
case '7' : $month_string = $UC_lang['month_jul']; break;
case '8' : $month_string = $UC_lang['month_aug']; break;
case '9' : $month_string = $UC_lang['month_sep']; break;
case '10' : $month_string = $UC_lang['month_oct']; break;
case '11' : $month_string = $UC_lang['month_nov']; break;
case '12' : $month_string = $UC_lang['month_dec']; break;
default : $month_string = ""; break;
}
}
else if ($format == 2)
{
switch ($month_number)
{
case '' : $month_string = "";
case '1' : $month_string = $UC_lang['month_short_jan']; break;
case '2' : $month_string = $UC_lang['month_short_feb']; break;
case '3' : $month_string = $UC_lang['month_short_mar']; break;
case '4' : $month_string = $UC_lang['month_short_apr']; break;
case '5' : $month_string = $UC_lang['month_short_may']; break;
case '6' : $month_string = $UC_lang['month_short_jun']; break;
case '7' : $month_string = $UC_lang['month_short_jul']; break;
case '8' : $month_string = $UC_lang['month_short_aug']; break;
case '9' : $month_string = $UC_lang['month_short_sep']; break;
case '10' : $month_string = $UC_lang['month_short_oct']; break;
case '11' : $month_string = $UC_lang['month_short_nov']; break;
case '12' : $month_string = $UC_lang['month_short_dec']; break;
default : $month_string = ""; break;
}
}
return $month_string;
}
/* // ~~~ GET MONTH NAME ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~ GET UNIX TIME STAMP OF STRING ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
function str_to_time($str)
{
// THIS FUNCTION IS NEEDED BECAUSE PHP FUNCTION strtotime() CONTAINS BUGS
$week_sec = 604800;
if ($str == 'last week')
return time() - $week_sec;
else if ($str == 'next week')
return time() + $week_sec;
else
return time();
}
/* // ~~~ GET UNIX TIME STAMP OF STRING ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* // ~~~ GET MONTH NAME ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~ FORMAT TIME ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
function format_time($time, $format = 1)
{
if ($format == 1)
{
return date("j. ", $time).get_monthname(date("n", $time),2)
.date(" Y H:i", $time);
}
}
/* // ~~~ FORMAT TIME ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~ LEADING ZERO FORMAT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function leading_zero($number, $length)
{
while (strlen($number) < $length)
$number = "0".$number;
return $number;
}
datei 2
PHP:
/* ----- time zone ----- */
if (PHP5)
{
/*
* supported time zones can be found here:
* http://www.php.net/manual/de/timezones.php
*/
//if (function_exists('date_default_timezone_set'))
// date_default_timezone_set('Europe/Berlin');
}
/* // ----- time zone ----- */
/* ----- initialize variables ----- */
$UC_global = array();
$breadcrumb_elements = array();
/* Create random number and keep this while session
* ist refreshed. This ensures every user has a different
* suggestions sorting but page navigation makes sense. */
mt_srand((double)microtime()*1000000);
if (!isset($_SESSION['suggestions_rand_number']))
$_SESSION['suggestions_rand_number'] = mt_rand();
$suggestions_rand_number = $_SESSION['suggestions_rand_number'];
define('SUGGESTIONS_RAND_NUMBER', $suggestions_rand_number);
define('IP', $_SERVER['REMOTE_ADDR']);
define('USER_AGENT', $_SERVER['HTTP_USER_AGENT']);
define('MAX_UPLOAD_SIZE', ini_get('upload_max_filesize'));
define('MAX_EXECUTION_TIME', ini_get("max_execution_time"));
$mem_limit = ini_get("memory_limit");
$mem_limit = substr($mem_limit, 0, strlen($mem_limit) - 1);
$mem_limit *= 1024 * 1024;
define('MEMORY_LIMIT', $mem_limit); // memory limit (Bytes)
//get date and time vars
define('CUR_WEEK', date("W"));
if (CUR_WEEK == '01' && date("Y") != date("Y", str_to_time("next week")))
{
define('CUR_MONTH', date("m", str_to_time("next week")));
define('CUR_YEAR', date("Y", str_to_time("next week")));
}
else
{
define('CUR_MONTH', date("m"));
define('CUR_YEAR', date("Y"));
}
define('LAST_WEEK', date("W", str_to_time("last week")));
define('LAST_WEEK_MONTH', date("m", str_to_time("last week")));
define('LAST_WEEK_YEAR', date("Y", str_to_time("last week")));
define('NEXT_WEEK', date("W", str_to_time("next week")));
define('NEXT_WEEK_MONTH', date("m", str_to_time("next week")));
define('NEXT_WEEK_YEAR', date("Y", str_to_time("next week")));
$week_numeric = array('mon' => 0, 'tue' => 1, 'wed' => 2, 'thu' => 3, 'fri' => 4, 'sat' => 5, 'sun' => 6);
$php_weekday = array(0 => 6, 1 => 0, 2 => 1, 3 => 2, 4 => 3, 5 => 4, 6 => 5);
$UC_global['week_numeric'] = $week_numeric;
$UC_global['php_weekday'] = $php_weekday;
$UC_global['time_start'] = $time_start;
//get config vars
$result = mysql_query(
"SELECT config_name, config_value, config_text
FROM " . $UC_sql_tables['config'] . "
") or errorhandler(mysql_error(),__FILE__,__LINE__);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$config_name = "config_".$row['config_name'];
if (!empty($row['config_text']))
define(strtoupper($config_name), $row['config_text']);
else
define(strtoupper($config_name), $row['config_value']);
}
//get other vars
//check if round is finished for this week
$result = mysql_query(
"SELECT id
FROM " . $UC_sql_tables['charts'] . "
WHERE week = '" . CUR_WEEK ."' AND ISNULL(month)
AND year = '" . CUR_YEAR . "'
LIMIT 1") or errorhandler(mysql_error(),__FILE__,__LINE__);
Vielen dank