crispweasel Posted September 25, 2008 Share Posted September 25, 2008 i want to be able to have a tab delimited text file with numbers that are blocked. i have this much right now // Parse text file for blocked numbers $handle = fopen("blocked.txt", "r"); if $number = a number in the text file // unsure how to do this $error = "That number is blocked on this system"; fclose($handle); how do i compare finish this off? Link to comment https://forums.phpfreaks.com/topic/125802-parse-text-file-and-compare/ Share on other sites More sharing options...
Push Eject Posted September 25, 2008 Share Posted September 25, 2008 <?php // Parse text file for blocked numbers $handle = fopen("blocked.txt", "r"); $data = fread( $handle, filesize( "blocked.txt" ) ); if( strpos( $data, $number ) !== false ){ $error = "That number is blocked on this system"; } fclose($handle); ?> Link to comment https://forums.phpfreaks.com/topic/125802-parse-text-file-and-compare/#findComment-650503 Share on other sites More sharing options...
crispweasel Posted September 25, 2008 Author Share Posted September 25, 2008 didn't work. no errors and it sent the message to a blocked number Link to comment https://forums.phpfreaks.com/topic/125802-parse-text-file-and-compare/#findComment-650519 Share on other sites More sharing options...
Push Eject Posted September 25, 2008 Share Posted September 25, 2008 didn't work. no errors and it sent the message to a blocked number Hmm. Sorry about that. Can you echo $data and $number and compare their contents? That might give insight into why strpos() didn't find a match. Link to comment https://forums.phpfreaks.com/topic/125802-parse-text-file-and-compare/#findComment-650523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.