Page 1 of 1
All Combinations and Log?
Posted: Mon Apr 11, 2011 6:20 pm
by blksith0
How would one put all combinations of an alphanumeric code into a URL bar and then log that? For example,
www.google.com/sites/aaaaaa.html,
www.google.com/sites/aaaaab.html,
www.google.com/sites/aaaaac.html and so on and so on.
Re: All Combinations and Log?
Posted: Mon Apr 11, 2011 6:32 pm
by Weirdan
Log?
Re: All Combinations and Log?
Posted: Mon Apr 11, 2011 6:41 pm
by fugix
im not really sure how to automate the alpanumeric characters...but if you set all of them into an array and use a foreach() loop. you could echo every possibility into a url
Re: All Combinations and Log?
Posted: Mon Apr 11, 2011 8:47 pm
by Jonah Bron
Strings can be incremented in the manner you describe very easily. Here's some examples:
Code: Select all
$string = 'aaaaaa';
$string++;
echo $string; // outputs "aaaaab"
$string = 'aaaaaz';
$string++;
echo $string; // outputs "aaaaba"
$string = 'zzzzzz';
$string++;
echo $string; // outputs "aaaaaaa"; notice, now seven instead of six
And so on. So, to loop through all combinations would be very easy.
Code: Select all
for ($i = 'aaaaaa'; $i != 'aaaaaaa'; $i++) {
// do something with $i
}
Re: All Combinations and Log?
Posted: Wed Apr 13, 2011 7:30 pm
by blksith0
Thanks guys!