Jump to content

[SOLVED] backtick operator problems


Motlive

Recommended Posts

Hi All,

 

a newbie for you all to abuse :D

 

I have been trying to get my head around this for a while and it just wont budge.

 

i have a debian machine that runs:

 

	<?php
$output = `/usr/bin/host -t ns $query`;

$find [] = "Host $query not found: 3(NXDOMAIN)";
$find [] = "$query name server";
$replace [] = " Domain Not Found - Please make sure you've spelt it correctly";
$replace [] = "";

$output =  str_replace($find, $replace, strtolower( trim( $output ) ) ); 

if (preg_match("^[a-z0-9\:\.\-]+$^", "$output $query"))
{
	echo "Name Servers:<pre>$output</pre>";
}		
elseif ($domain == ""){
	echo "";
}
else {
	echo "You have entered an invalid domain name, do not enter 'http://' or 'www.'";
}
?>

 

Now i have moved over to a Windows Server running IIS instead of Apache and I dont know how to make the above work in that enviroment :S

 

any guidance would be much appreciated.

Link to comment
Share on other sites

I dont understand where i am meant to point the exec() function towards.

 

I have a page which you enter in a domain and it will give you info on its name servers, MX records A records and the WHOIS. so simple DNS lookups really.

 

 

Link to comment
Share on other sites

<?php
$output = `/usr/bin/host -t ns $query`;

$find [] = "Host $query not found: 3(NXDOMAIN)";
$find [] = "$query name server";
$...... and so on

 

bugger.. sorry i missed out the command on my first post:

Link to comment
Share on other sites

Exec is never a good idea to use, and it's better to be avoided for security reasons.

 

For your issue, you may want to look around PHP.net and see if there are any bugs related to your specific system.  Looking at the code I don't see anything off hand that might be messing it up, it looks fine, maybe there is a type of bug with one of the functions you are using that is only a bug on that specific system, you can check into it over at php.net by going through there list of bug's, or running a few google searches on "php problems on (insert operating system here)"

 

Based on your last post, if you are wanting to do DNS lookups.

http://www.google.com/search?source=ig&hl=en&q=DNS+lookup+API+with+php&btnG=Google+Search

You will find a lot of stuff there, that will help you find out everything you need, on making it work.

Don't use the exec function, I am warning you before it's too late, especially if you are using it with user input, you will end up finding out why I advised you not to if you try and use it.

Link to comment
Share on other sites

This command...

 

/usr/bin/host -t ns $query

 

Is never going to hold up in windows, it is a *nix command. I'm not sure whats available on windows, but you will need to find an equivelent to the host command, I'm just not sure one would exist.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.