<?php
setlocale(LC_ALL,'en_US.UTF-8');
$dbfile = 'data/data.txt';
$imagefolder = 'uploads/';



##########################################
// validation
function validat($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlentities($data);
  return $data;
}

// permalink


##########################################
// permalink generator
function permalink($data) {
  $data = strtolower($data);
  $data = preg_replace("/[^a-z0-9_\s-]/", "", $data);
  $data = preg_replace("/[\s-]+/", " ", $data);
  $data = preg_replace("/[\s_]/", "-", $data);
  return $data;
}

##########################################
// in line all script
function inlinedata($data) {
  $data = preg_replace("/[\n\r]/","",$data);
  return $data;
}

##########################################
// last ID
function getLines($file)
{
    $f = fopen($file, 'rb');
    $lines = 0;
    while (!feof($f)) {
        $lines += substr_count(fread($f, 8192), "\n");
    }
    fclose($f);
    return $lines;
}
?>
