Unstoppable Domains โ€” Expired Auctions

Get domain type (LLL, NNN, 3 letter .com etc) - Nicely commented

NamecheapNamecheap
Watch

Daniel

Danltn.comVIP Member
Impact
133
Enjoy, I could've done switches where I used the 2 elseif's, but I felt more confident this way.

PHP:
<?php 

   /*                   Danltn               */
   /* Free to use if this message stays here */
   /*             http://danltn.com          */


$domain = $_GET['domain']; // No explaination needed
if(!$domain) { $domain = "lol-101.com"; } // This was just for testing purposes, feel free to remove it
$original = $domain; // Lets keep a copy incase we want it later
$domain = strtolower($domain); // Make all the letters the same, although we will use insensitive functions, it might help
$domain = explode(".",trim($domain)); // Let's get all the parts of the domain
$root = trim($domain[0]); // Let's get the beginning of the domain

$chars = preg_split('//', $root, -1, PREG_SPLIT_NO_EMPTY); // PHP 4 + 5 version
$len = strlen($root); // Get it's length

foreach($chars as $none => $letter) { // We'll start a foreach loop, where we will compare each letter with an ereg string

if (eregi('[a-z]', $letter)) { // a-z insensitive check
$list[] = "l"; // Return L
}
elseif (eregi('[0-9]', $letter)) { // 0-9 check
$list[] = "n"; // If true, return N
}
elseif ($letter == "-") { // See if it's just a dash
$list[] = "-"; // If it is, return a dash
}
else { // We don't know what it is
$list[] = "?"; // Return a question mark
}
}

$root = strtoupper(implode("",$list)); // Put it together again, make it UPPERCASE.
$ext = strtolower(implode(".",$domain)); // I can't remember if it's caps or not, we'll just lower it to be safe
$ext = str_replace($domain[0],"",$ext); // Remove the actual domain, just leave the extension

for($i = 0; $i < strlen($root); $i++) { 
$n .= "N"; // This was the easiest way I think to generate a string x characters long, please PM me if there's a better way
$l .= "L"; // Same for Letters
}

switch ($root) { // Let's play with the $root
case $l: // If it's an LLL...
 $type = "letter"; // It's a letter
 break; // Good, that'll do. Stop.
case $n: // If it's an NNN...
 $type = "number"; // It's a number
 break; // If it's satisified, we'll stop
default: // It's neither a number or a letter, it must be a character
 $type = "character"; // So we'll call it just that
}

echo "<code>$original</code> is a <code>$root$ext</code> ($len $type $ext)"; // Tell them

?>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
Appraise.net
Spaceship
Domain Recover
CatchDoms
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back