include ("mysql.php"); //----------------------------------------------- if (mysql_connect($host,$user,$password)) { } //-------funciones------------------ function fechaformat($fecha){ $Mes=substr($fecha,5,2); $Dia=substr($fecha,8,2); $Any=substr($fecha,0,4); $fecha=sprintf("%s/%s/%s",$Dia,$Mes,$Any); return $fecha; } //---------------------fecha hoy---------------------- $Diay=date("d"); $Mesy=date("m"); $Anyoy=date("Y"); $Avui=sprintf("%s/%s/%s",$Anyoy,$Mesy,$Diay); //-------------------------------------------------- function CortaString ($str,$NCar) { //Devuelve el string con $NCar, sin cortar palabras, y con "..." $i=1; if (strlen($str)>$NCar) { $str_aux=substr($str,0,$NCar); while ($str_aux[strlen($str_aux)-$i]!=' ') { $str_aux[strlen($str_aux)-$i]=' '; $i++; } $str_aux.=" ..."; } else { $str_aux=$str; } return $str_aux; } ?>