Forum Moderators: coopster
Its easy to create subdomains this way, but how can I use this code in a php script to make many subdomains from a txt file with words, without having to write in the [subdomain here] manually?
Big thanks in advance.
Read the txt file and store the subdomain names in an array or just hard code the array
if you do not have too many words.
$subdomains = array('sub1', 'sub2', 'sub3');
then loop trough the array and echo links with the values you need:
echo "<ul>\n";
foreach ($subdomain as $sub) {
echo "<li><a href=\"javascript:window.open('http://[domainhere]:2082/frontend/rvlightolive/subdomain/
doadddomain.html?domain=$sub&rootdomain=[maindomain.com]' , '$sub')\" />Create new subdomain: $sub</a></li>\n";
}
echo '<ul>';
Then you just need to click each one of the links to open a new browser window with the URL you need.
Now pardon my ignorance but how this thing about creating subdomains work?
Does that mean anyone who knows how to build the URL with the porper values can create a subdomain?
Is one of the variables a password? I'm just curious since I've never heard of this before
domains.txt
subdomain1,maindomain1.com
subdomain2,maindomain2.com
subdomain3,maindomain3.com
...etc
links.php
$line = file [us3.php.net]("domains.txt");
$line = array_map [us3.php.net]("rtrim [us3.php.net]",$line);
$count = count [us3.php.net]($line);
for($i = 0; $i < $count; $i++)
{
$domains = explode [us3.php.net](",",$line[$i]);
echo '<a href="http://[domainhere]:2082/frontend/rvlightolive/subdomain/doadddomain.html?domain='.$domains[0].'&rootdomain='.$domains[1].'">Create sub: '.$domains[0].' main: '.$domains[1].'</a><br />';
}
Good luck ;)
I was able to do it in another way, more automatickly. Like this:
<?php
$words = file("subdomains.txt");
foreach ($words as $word) {
$response = file_get_contents(
"http://user:pass@IP:2082/frontend/rvlightolive/subdomain/doadddomain.html?domain=$word&rootdomain=maindomain.info");
//do error checking by seeing if $response contains the HTML output of that URL you expect
}
echo "Done! Added " . count($words) . " subdomains.";
?>
<?php
$words = file("subdomains.txt");
set_time_limit(0);
foreach ($words as $word) {
$response = file_get_contents(
"http://user:pass@IP:2082/frontend/rvlightolive/subdomain/doadddomain.html?domain=$word&rootdomain=maindomain.info");
//do error checking by seeing if $response contains the HTML output of that URL you expect
}
echo "Done! Added " . count($words) . " subdomains.";
?>
If it doesn't, you might have to change the max_execution_time value in the php.ini.
//I think it's either 0 or -1 for unlimited time (or maybe I'm completely wrong...lol)
[url=http://us2.php.net/manual/en/function.ini-set.php]ini_set[/url]("[url=http://us2.php.net/manual/en/ref.info.php#ini.max-execution-time]max_execution_time[/url]","0");
Good luck!
[edit];)[/edit]