$value) { $GLOBALS[$key]=$_FILES[$key]['tmp_name']; foreach($value as $ext => $value2) { $key2 = $key."_".$ext; $GLOBALS[$key2]=$value2; } } } ?> MySQL_dbindex=MySQL_PConnect($host,$dbuser,$dbpassword); if ($this->MySQL_dbindex) { $this->connected = true; } else { $this->connected = false; $this->print_error("
    Error while connecting to the database!
  1. Please, try again later.
"); } mysql_query("SET CHARACTER SET utf-8"); mysql_set_charset('utf8', $this->MySQL_dbindex); } function close_connection() { @MySQL_Close(); } function select_db($db) { if ($this->connected) { if ( !@mysql_select_db($db,$this->MySQL_dbindex)) { $this->print_error("
    Error selecting database $db!
  1. Are you sure it exists?
  2. Are you sure there is a valid database connection?
"); } } } function print_error($str = "") { global $SQL_ERROR; if ( !$str ) $str = mysql_error(); $SQL_ERROR[] = array ( "query" => $this->last_query, "error_str" => $str ); if ( $this->show_errors ) { print "
"; print "SQL/DB Error -- "; print "[$str]
"; print "[SQL: {$this->last_query}]"; print "
"; } else { return false; } } function show_errors() { $this->show_errors = true; } function hide_errors() { $this->show_errors = false; } function make_query($sql) { $result=mysql_query($sql,$this->MySQL_dbindex); $this->last_query = $sql; $this->Query_result = $result; return $result; } function num_of_rows($result) { if(!$num=MySQL_Num_Rows($result))$num=0; return $num; } function get_row($result) { return @mysql_fetch_array($result); } function is_valid_email($email) { if (!ereg("[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*\.([a-zA-Z]{2,3})$",$email)) return false; else return true; } function htmlHeader($title) { global $menu_id; //echo ''; echo "\n"; echo "\n"; echo " ".$title."\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo ""; echo "\n"; echo "\n"; //echo " "; } function htmlFooter() { echo "\n"; echo "\n"; } function pass_encode($pass) { $password = md5($pass); return $password; } function datediff($interval, $datefrom, $dateto, $using_timestamps = false) { /* $interval can be: yyyy - Number of full years q - Number of full quarters m - Number of full months y - Difference between day numbers (eg 1st Jan 2004 is "1", the first day. 2nd Feb 2003 is "33". The datediff is "-32".) d - Number of full days w - Number of full weekdays ww - Number of full weeks h - Number of full hours n - Number of full minutes s - Number of full seconds (default) */ if (!$using_timestamps) { $datefrom = strtotime($datefrom, 0); $dateto = strtotime($dateto, 0); } $difference = $dateto - $datefrom; // Difference in seconds switch($interval) { case 'yyyy': // Number of full years $years_difference = floor($difference / 31536000); if (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom), date("j", $datefrom), date("Y", $datefrom)+$years_difference) > $dateto) { $years_difference--; } if (mktime(date("H", $dateto), date("i", $dateto), date("s", $dateto), date("n", $dateto), date("j", $dateto), date("Y", $dateto)-($years_difference+1)) > $datefrom) { $years_difference++; } $datediff = $years_difference; break; case "q": // Number of full quarters $quarters_difference = floor($difference / 8035200); while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom)+($quarters_difference*3), date("j", $dateto), date("Y", $datefrom)) < $dateto) { $months_difference++; } $quarters_difference--; $datediff = $quarters_difference; break; case "m": // Number of full months $months_difference = floor($difference / 2678400); while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom)+($months_difference), date("j", $dateto), date("Y", $datefrom)) < $dateto) { $months_difference++; } $months_difference--; $datediff = $months_difference; break; case 'y': // Difference between day numbers $datediff = date("z", $dateto) - date("z", $datefrom); break; case "d": // Number of full days $datediff = floor($difference / 86400); break; case "w": // Number of full weekdays $days_difference = floor($difference / 86400); $weeks_difference = floor($days_difference / 7); // Complete weeks $first_day = date("w", $datefrom); $days_remainder = floor($days_difference % 7); $odd_days = $first_day + $days_remainder; // Do we have a Saturday or Sunday in the remainder? if ($odd_days > 7) { // Sunday $days_remainder--; } if ($odd_days > 6) { // Saturday $days_remainder--; } $datediff = ($weeks_difference * 5) + $days_remainder; break; case "ww": // Number of full weeks $datediff = floor($difference / 604800); break; case "h": // Number of full hours $datediff = floor($difference / 3600); break; case "n": // Number of full minutes $datediff = floor($difference / 60); break; default: // Number of full seconds (default) $datediff = $difference; break; } return $datediff; } function make_caption($caption) { $caption = str_replace('á','a',$caption); $caption = str_replace('Á','A',$caption); $caption = str_replace('ä','a',$caption); $caption = str_replace('č','c',$caption); $caption = str_replace('Č','C',$caption); $caption = str_replace('ď','d',$caption); $caption = str_replace('Ď','D',$caption); $caption = str_replace('é','e',$caption); $caption = str_replace('É','E',$caption); $caption = str_replace('ě','e',$caption); $caption = str_replace('í','i',$caption); $caption = str_replace('Í','I',$caption); $caption = str_replace('ľ','l',$caption); $caption = str_replace('Ľ','L',$caption); $caption = str_replace('ĺ','l',$caption); $caption = str_replace('Ĺ','L',$caption); $caption = str_replace('ň','n',$caption); $caption = str_replace('Ň','N',$caption); $caption = str_replace('ó','o',$caption); $caption = str_replace('Ó','O',$caption); $caption = str_replace('ô','o',$caption); $caption = str_replace('ŕ','r',$caption); $caption = str_replace('Ŕ','R',$caption); $caption = str_replace('ř','r',$caption); $caption = str_replace('Ř','R',$caption); $caption = str_replace('š','s',$caption); $caption = str_replace('Š','S',$caption); $caption = str_replace('ť','t',$caption); $caption = str_replace('Ť','T',$caption); $caption = str_replace('ú','u',$caption); $caption = str_replace('Ú','U',$caption); $caption = str_replace('ü','u',$caption); $caption = str_replace('ý','y',$caption); $caption = str_replace('Ý','Y',$caption); $caption = str_replace('ž','z',$caption); $caption = str_replace('Ź','Z',$caption); return $caption; } } ?>