Hi im trying to get an if else if statement to return a value dependent on if the whois function comes up with a response.
I need the if else if statment to say unavailable if the domain name is returned and available if there is no return i hope you can help may thanks in advance Faza
whois2.php page
<php>
<html>
<body>
<h1 style="text-align:center;">Multiple whois lookup query</h1></center>
<P style="text-align:center;">This app is used to check for available FQDN's.</P>
<P style="text-align:center;">PLease enter one suggested domain name per field.</P>
<center><form action = "results2.php" method= "post">
<textarea rows=30" cols="30" name="Domainname"/>
</textarea>
</br>
<input type="submit" value="Check availability"/>
</form></center>
</body>
</html>
</php>
results2.php page
<html><h1 style="text-align:center;">Whois lookup Results</h1></center></html>
<br>
<center>
<Table border="1">
<tr>
<td><center><h2><blink>Status =
</blink></h2></center></td>
</td>
</tr>
<tr>
<td>
<center>
<?php
$domain_string = $_POST["Domainname"];
$domain_array = explode("\n", $domain_string);
foreach ($domain_array as $domain) {
$domain = trim($domain);
if ($domain != "") {
$result = shell_exec('whois ' . $domain);
echo "<center><h3>Whois '$domain'</h3>
<br></center>";
echo str_replace("\n", "<br>", $result);
echo "<br><br>";
}
}
?>
</center>
</td>
</tr>
</table>
</center>
if else if statment so far! -
<?php
if (eregi("no match" , $retval))
echo "<h2 style="color:red;">AVAILABLE!</h2>";
else
echo "<h2 style="color:red;">UNAVAILABLE!</h2>";
?>