<?php
$contenido=addslashes($contenido);
//$contenido = htmlentities($contenido); 

$maxlength = 1000000; 
$chunklength = 7000; 
$tag = "&&&&"; 
$original = $contenido; 
 
// Measure String Length to see if it will fit in the DBase 
 
$length = strlen($original); 
 
if ($length > $maxlength) { 
	echo "Aviso!!!   El contenido es demasiado largo para caber en nuestro sistema.<br>"; 
	echo "Favor asegurarse que sea menos de ".$maxlength." bytes o contactar el<br>"; 
	echo "administrador a <a href=\"mailto:amauris@funredes.org\">amauris@funredes.org</a>."; 
	$errorsplitting = "si"; 
} 
 
// Count number of pieces 
 
$numberofpieces = $length / $chunklength; 
 
$decimal = explode(".", $numberofpieces); 
$numberofpieces = $decimal[0]; 
 
if ($decimal[1] > 0) { 
	$numberofpieces++; 
} 
 
// Chunkafy the String 
 
$newstring = chunk_split($original, $chunklength, $tag); 
 
// Explode the string into various parts and spit them out 
 
$chunk = explode($tag, $newstring); 
$chunkcount = count($chunk); 
?>
