Hey,
I am trying to figure out as to why my IF statement within the while wont work. I have a sub-domains option on my site to signup for one. I am trying to get the below code to read from the file and if the subdomain when submitted already exists it will exit and tell them. If it doesn't then it continues to process the sub domain. If someone could help me i'd be forever greatful.
$size=filesize("subdomains.txt");
if (!$size =="0") {
$fp = fopen("subdomains.txt","r");
$line = 0;
while (!feof ($fp) ) {
$domain = fgets($fp,filesize("subdomains.txt"));
if ($sub == $domain) {
echo "Oops someone already took that sub-domain. Click back and try again";
fclose($fp);
exit;
}
echo "In text file: $domain<br>";
$line = $line + 1;
}
fclose($fp);
}
Dont mind the way it is typed out. Its pretty much setup for debugging right now.
Thanks,
Patrick