I m developing a CMS based website in which there is "Import Contact" functionality by clicking it user can select the .txt file which contains Contact Numbers. User can import unlimited .txt file but I want to add limit of importing contact numbers. for ex. 1.txt contains 100 contact numbers. & 2.txt contains 50 contact numbers.
& I had assigned 100 limit to the user, so whenever user imports the another .txt file it shoul throw error i.e "You have crossed your limit".
I had tried
<?php
$file = "somefile.txt";
$lines = count(file($file));
echo "There are $lines lines in $file";
?>
& this also;
$file="largefile.txt";
$linecount = 0;
$handle = fopen($file, "r");
while(!feof($handle)){
$line = fgets($handle, 4096);
$linecount = $linecount + substr_count($line, PHP_EOL);
}
fclose($handle);
echo $linecount;
this function i'm able to find out the contact numbers in .txt file.
But no able to compare two txt file & throw error..!!