Hi Paul,
Thanks for your answer. Your codes are much leaner, I have a definite tendency to complicate things. No offence taken, I'm here to learn.
After regular visits from spamers adding about 100 links a week I felt I needed a new system. As I started learning php/mysql a couple of months ago I thought this could be a good test.
So the front page will have categories each opening one list, people will therefore be able to add their link from within the proper category (often a mistake they did). A start session at the top of the add link module should prevent multiple posting. A reciprocal exchange procedure with a live verification should also minimise abuses while giving me back what seems fair: a link. And finally generating a html page just for the purpose of search engine access. (reading lots of tutorials and looking at other code allowed me to make it work, it certainly isn't good coding but up to this point those stages works).
But this didn't insure that the linkback was still there once the visitor submitted his and as on my links'page I had 488 links, I had to go through all of them manually and now 308 are left, those don't have linkbacks (hence the adminok). This was very long and I didn't see myself doing it every week.
So I though to reuse the code used during the link posting in a loop. As listing every row worked well, I belived I could add this code to 'validate' each row while letting me know if the external site was reached or not ($linkback), if my link was among the text of the page ($linktext), and if not delete the row from my database.
I used the preg_replace, preg match to make sure the code would be a real link and allow wildcards so people could add style conditions etc... (I thought * allowed wildcards for the replacement string).
Yes you are right the linktext doesn't need to be in the loop.
Yes getting all the file at once and searching for the match on a long string works, I used the buffer section because I didn't now the length of the file I was going to read and I've read that sometimes a loss of a packet might terminate the connection therefore I wouldn't get all the file.
Yes, not changing the preg_match didn't work as bad or good links were deleted while the couldn't access remained. But now it works. Would you know if it is possible to distinguish the reason the file wasn't accessed (either if it didn't exist or if the server couldn't be accessed)?
Thanks again for your help and advises.
eric1