View file inc/funct.php

File size: 737B
<?php
function redirect($page) {
	if ($page) header('Location: '.$page); 
		else
	header('Location: '.URL,root);
}

function mysql_count($table) {
	$res = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM '.$table.''));
	return $res[0];
}

function last_id($table) {
	if (empty($table)) return FALSE;
	$res = mysql_fetch_array(mysql_query('SELECT MAX(ID) FROM '.$table.''));
	return $res[0];
}

function cut_string($string,$n) {
	if (empty($string)) return FALSE;
	if (empty($n)) $n = 10;
	$str = explode(' ',$string);
	if (count($str)<=1) return $string;
		else {
			$i = 0;
			$newstring = '';
			while ($i<$n) {
				if (empty($str[$i])) break;
				$newstring = $newstring.' '.$str[$i];
				$i++;
			}
			return $newstring;
		}
}

?>