$length) {
$words = explode(' ', $str);
$wCnt = count($words);
if($wCnt == 1) {
$str = substr($str, 0, $length) . '.';
}
else {
$str = '';
$cnt = 0;
while($cnt < $wCnt && strlen($str) < $length) {
$str .= trim($words[$cnt++]) . ' ';
}
if($cnt < $wCnt) $str .= '.';
}
}
return $str;
}
// Replace bad words with image
// Arguments: text
//
function replaceWords($str) {
global $badwords;
$repl = '';
$c = '(\_|[^\d\w\r\n])*';
$cl = strlen($c);
for($i = 0; $i < count($badwords); $i++) {
$expr = chunk_split($badwords[$i], 1, $c);
$str = preg_replace('/' . substr($expr, 0, strlen($expr) - $cl) . '/i', $repl, $str);
}
return $str;
}
///////////////////////////////////////////
function randomNumber($length) {
$result = '';
for($i = 0; $i < $length; $i++) {
$result .= mt_rand(0, 9);
}
return $result;
}
//////////////////////////////////////
function alphaNumSpacePeriod($c1)
{
$c1=trim(preg_replace('/(\s)\s+/', ' ', $c1));
return trim(preg_replace('/[^A-Za-z0-9\.]/', ' ',$c1));
// return trim(preg_replace('/[^A-Za-z0-9\s]/', '',$c1));
}
////////////////////////////////////
function alphaNumOnly($c)
{
return trim(preg_replace('/[^A-Za-z0-9]/', '',$c));
}
//////////////////////////////////
function oneSpace($str)
{
return trim(preg_replace('/(\s)\s+/', ' ', $str));
}
/////////////////////////////////////
if(file_exists($dbfile)) {
$files= file($dbfile);
$size = filesize($dbfile);
if($size > 0) {
if($size > $entries){
$output = array_slice($files, 0,$entries);// returns lines set at line 30
file_put_contents($dbfile, $output, LOCK_EX);
}else{
$output=$files;
}
$i=1;
$cnt=count($output);
//echo $cnt;
$u='';
$n='';
$rt='';
foreach ($output as $line) {
$users = explode('#', $line);
$thename =$users[3];
$comment =stripslashes(smile($users[4]));
//uncomment below 3 lines to decode for hyperlinks with link name used
//if($links){
//$comment= html_entity_decode($comment, ENT_COMPAT | ENT_HTML5);
//}
$comment =wordwrap($comment, $wrap, "\n", 1);
if (!empty($_SESSION['admin'])) {
$comment="$comment
Delete";
}
if (in_array($thename, $reserved)) {
$u .= "$thename $users[2]
$comment
Errors with your post.
'; } } ?>CMXads.com Flatfile Free Script |
"; echo "password "; echo ''; } ?> |