Jump to content

php code help

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1
bri552

bri552

    Newbie

  • Members
  • Pip
  • 6 posts
Hi,

I am trying to create a page where:
a user can enter domains which he want to resolve.
for an instance say:
user1 enters
yahoo.com
google.com
msn.com
nbsc.com

The script should accept this domains may be in array and then resolve one by one may be in a frame.

Can any one help me how to start with this.

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
You can use a textarea to accept input via a form. When the user submits you can split by linebreak to create an array of domains. Alternatively, you could use multiple <input type="text"> boxes and have the name an array (txtDomain[]). When the user wants to add more, use JavaScript to create a new text box.

Once you receive the data, you can loop through the domain name array and use gethostbyname() to retrieve the IP.

#3
bri552

bri552

    Newbie

  • Members
  • Pip
  • 6 posts
can u help me with an example

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
index.php
<form name="domainsubmit" method="POST" action="domain.php">
<input type="text" name="domain">
<input type="submit" value="Resolve">
</form>

domain.php
<?php
$domain = $_POST['domain'];

// Resolve it and echo it
echo gethostbyname($domains);

The code above does no error checking on the post data nor does it format that output. This is just an example as you request. This was also untested so it may or may not work.

#5
bri552

bri552

    Newbie

  • Members
  • Pip
  • 6 posts
take a look at the below code:
The url enter are explicitly used.
I want to know is it possible to let user choose the domain he want to resolve.

The below code is javascript.
So do you know if the above objective can be achieved in PHP

Thankyou for the help
<SCRIPT language="JAVASCRIPT">
var Win;
var page_index=0;
var page = new Array();
page[0] = "url";
page[1] = "url";
page[2] = "url";
page[3] = "url";
page[4] = "url";
page[5] = "url";

function next_page()
{
page_index++;
if (page_index == 6)
page_index = 0;
Win.location.replace(page[page_index]);
}

</SCRIPT>
</head>

<body>
<h1>Auto Start Page Rotator</h1>

<SCRIPT language="JAVASCRIPT">

Win=window.open(page[0], 'Win','resize=yes,toolbar=yes,status=yes,scrollbars=yes,screenX=0,screenY=0,width=1000,height=666')
setInterval("next_page();",8000);
</SCRIPT>
<input type="text" name="url[]" /><br />

</body>

Edited by WingedPanther, 08 June 2009 - 07:35 AM.
add code tags (the PHP sheet)


#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I'm not clear what you're trying to accomplish.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
Guest_Jordan_*

Guest_Jordan_*
  • Guests
What am I looking for?

#8
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
seems like he wants to create a page, which opens another window, and in that window, loops the urls from a list with a delay
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#9
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
This sounds like a full freelance job :P
Checkout my new forum! http://adminreference.com/

#10
bri552

bri552

    Newbie

  • Members
  • Pip
  • 6 posts
yes that's right .any suggestion on how to accept url from users.

#11
bri552

bri552

    Newbie

  • Members
  • Pip
  • 6 posts
Guys, ne help on the above topic