Some help on PHP code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bri552
Forum Newbie
Posts: 3
Joined: Fri Jun 05, 2009 8:15 am

Some help on PHP code

Post by bri552 »

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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Some help on PHP code

Post by pickle »

Moving to PHP -Code forum.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: Some help on PHP code

Post by mikemike »

What do you mean by 'resolve'? Get the IP address?

The first hurdle will be getting them into an array, which is easy. Use HTML arrays to name your textfields:

Code: Select all

URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
URL: <input type="text" name="url[]" /><br />
...
 
All of these values will then populate the $_POST array:

Code: Select all

echo '<pre>'.print_r($_POST, true).'</pre>';
 
/* Produces something like:
 
Array(
  [0] => google.com
  [1] => yahoo.com
  [2] => overture.com
)
 
bri552
Forum Newbie
Posts: 3
Joined: Fri Jun 05, 2009 8:15 am

Re: Some help on PHP code

Post by bri552 »

i am not sure if i understood the code.
Wht i want is i want to rotate the domains the way they are entered
..
for eg.

yahoo.com ...then google.com etc
should resolved after a specific time.
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: Some help on PHP code

Post by mikemike »

I'm not sure what you mean. You'll have to be a little bit more clear
bri552
Forum Newbie
Posts: 3
Joined: Fri Jun 05, 2009 8:15 am

Re: Some help on PHP code

Post by bri552 »

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

Code: Select all

 
<SCRIPT language="JAVASCRIPT">
var Win;
var page_index=0;
var page = new Array();
page[0] = "http://mail.yahoo.com/";
page[1] = "http://www.daniweb.com/";
page[2] = "http://www.dutchfightclub.nl/";
page[3] = "http://www.dabs.com/";
page[4] = "http://www.lowestonweb.com/";
page[5] = "http://www.vantecusa.com/";
 
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>
Last edited by Benjamin on Mon Jun 08, 2009 10:39 am, edited 1 time in total.
Reason: Added [code=html] tags.
Post Reply