Page 1 of 1
Only Once...
Posted: Sat Sep 07, 2002 9:33 pm
by ACE55555
I am wondering how I can check to see if someone's name is already in the file, and if so, not re-enter their name. If it isn't, I want it to enter the name. Currently it enters the name repeatedly upon reloading. Surely there is a way to search the text file and do this...
Posted: Sun Sep 08, 2002 1:01 am
by Takuma
Usernames.txt
Code
Code: Select all
<?php
$fh = fopen("usernames.txt","r");
$content = fread($fh,filesize($fh));
$content = explode(",",$content);
for($i = 0; $i <= count($content); $i++) {
if($contentї$i] == $_POSTї"username"]) {
//Username already exists
} else {
//Username do not exist in the file
}
}
fclose($fh);
?>