Menu Exit Menu

"); mysqli_select_db($db, "bits_domains"); $cError = ""; $sid = session_id(); //echo "

session_id: ".$sid."

"; $nDontPost = 0; // If deleted, remove from database: if (isSet($_GET["d"])) { $domain = mysqli_real_escape_string($db, strtolower(substr(trim(strip_tags($_GET["d"])),0,100))); $cQuery = "UPDATE results SET show_domain='N' WHERE session_id='".$sid."' AND name='".$domain."';"; //echo "

",$cQuery,"

"; if (!mysqli_query($db, $cQuery)) $cError = "Unknown domain name.
"; $nDontPost = 1; } // Include stuff for lookup: include "cwhois.php"; // If check value passed in: if (isSet($_GET["c"]) && isSet($_GET["t"])) { $domain = mysqli_real_escape_string($db, strtolower(substr(trim(strip_tags($_GET["c"])),0,100))); $tld = mysqli_real_escape_string($db, strtolower(substr(trim(strip_tags($_GET["t"])),0,10))); if (!($tld=="com" || $tld=="net" || $tld=="org" || $tld=="biz" || $tld=="info" || $tld=="us" || $tld=="ws" || $tld=="tv")) { $cError = "Invalid TLD Parameter.
"; } else { // Make sure domain name is in the list already (been validated): $cQuery = "SELECT id FROM results WHERE session_id='".$sid."' AND name='".$domain."';"; //echo "

",$cQuery,"

"; $rResult = mysqli_query($db, $cQuery); $nResult = mysqli_num_rows($rResult); if ($nResult==0) $cError .= "Unknown domain name.
"; else { // Check: //echo "doing check"; $cVal = mycWhois($domain,".".$tld); // Update: $cQuery = "UPDATE results SET show_domain='Y',"; $cQuery .= $tld."='".$cVal."'"; $cQuery .= " WHERE session_id='".$sid."' AND name='".$domain."';"; //echo "

",$cQuery,"

"; if (!mysqli_query($db, $cQuery)) $cError = "Unknown domain name.
"; } } $nDontPost = 1; } // Check if the form was submitted: if (@$_POST['form_submitted'] && $nDontPost==0) { //echo "

in post

"; // Create and clean form values: extract($_POST, EXTR_OVERWRITE); // Clean entries: $names = substr(trim(strip_tags($names)),0,1000); //echo "

",$names,"

"; if (!$names) $cError = "Nothing was entered to search on.
"; //echo "

1st com is ".$com."

"; $com = $com=="on" ? "1" : "0"; //echo "

then com is ".$com."

"; $net = isSet($net) ? "1" : "0"; $org = isSet($org) ? "1" : "0"; $biz = isSet($biz) ? "1" : "0"; $info = isSet($info) ? "1" : "0"; $us = isSet($us) ? "1" : "0"; $ws = isSet($ws) ? "1" : "0"; $tv = isSet($tv) ? "1" : "0"; // Loop through each domain name: $nDomains = 0; $aNames = explode("\n",$names); foreach($aNames as $domain){ if (!$domain) continue; // Only do 10 names at a time: $nDomains++; if ($nDomains>10) break; // Only allow domains of 100 characters or less: $domain = strtolower(trim(substr($domain,0,100))); // Get rid of any http:// or www. entered by user to keep things neat: if (strcmp("http://www.",substr($domain,0,11))==0) $domain = substr($domain,11,strlen($domain)-11); if (strcmp("www.",substr($domain,0,4))==0) $domain = substr($domain,4,strlen($domain)-4); if (strcmp("http://",substr($domain,0,7))==0) $domain = substr($domain,7,strlen($domain)-7); // Get rid of any extensions: if (!(strpos($domain,".")===false)) $domain = substr($domain,0,strpos($domain,".")); // Make sure domain name is acceptable: // if (!preg_match('/^([a-z0-9][a-z0-9\-]*[a-z0-9]){2,}$/', $domain) && !preg_match('/^[a-z0-9]$/',$domain)) { if (!preg_match('/^[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}$/', $domain) && !preg_match('/^[a-z0-9]$/',$domain)) { $cError .= $domain." is invalid.
"; continue; } // Set domain flags: $cCom = "U"; $cNet = "U"; $cOrg = "U"; $cBiz = "U"; $cInfo = "U"; $cUS = "U"; $cWS = "U"; $cTV = "U"; // Check each selected TLD: if ($com=="1") $cCom = mycWhois($domain,".com"); if ($net=="1") $cNet = mycWhois($domain,".net"); if ($org=="1") $cOrg = mycWhois($domain,".org"); if ($biz=="1") $cBiz = mycWhois($domain,".biz"); if ($info=="1") $cInfo = mycWhois($domain,".info"); if ($us=="1") $cUS = mycWhois($domain,".us"); if ($ws=="1") $cWS = mycWhois($domain,".ws"); if ($tv=="1") $cTV = mycWhois($domain,".tv"); // Check for the domain name in the database for this SID, update if found, otherwise add: $cQuery = "SELECT id FROM results WHERE session_id='".$sid."' AND name='".$domain."';"; $rResult = mysqli_query($db, $cQuery); $nResult = mysqli_num_rows($rResult); if ($nResult==0) { // New: $cQuery = "INSERT INTO results (session_id, name, com, net, org, biz, info, us, ws, tv, show_domain) VALUES ("; $cQuery .= "'".$sid."'"; $cQuery .= ",'".$domain."'"; $cQuery .= ",'".$cCom."'"; $cQuery .= ",'".$cNet."'"; $cQuery .= ",'".$cOrg."'"; $cQuery .= ",'".$cBiz."'"; $cQuery .= ",'".$cInfo."'"; $cQuery .= ",'".$cUS."'"; $cQuery .= ",'".$cWS."'"; $cQuery .= ",'".$cTV."'"; $cQuery .= ",'Y'"; $cQuery .= ");"; //echo "

",$cQuery,"

"; $rResult = mysqli_query($db, $cQuery); } else { // Update: $aRow = mysqli_fetch_array($db, $rResult); $cQuery = "UPDATE results SET show_domain='Y'"; if ($cCom=="Y" || $cCom=="N") $cQuery .= ",com='".$cCom."'"; if ($cNet=="Y" || $cNet=="N") $cQuery .= ",net='".$cNet."'"; if ($cOrg=="Y" || $cOrg=="N") $cQuery .= ",org='".$cOrg."'"; if ($cBiz=="Y" || $cBiz=="N") $cQuery .= ",biz='".$cBiz."'"; if ($cInfo=="Y" || $cInfo=="N") $cQuery .= ",info='".$cInfo."'"; if ($cUS=="Y" || $cUS=="N") $cQuery .= ",us='".$cUS."'"; if ($cWS=="Y" || $cWS=="N") $cQuery .= ",ws='".$cWS."'"; if ($cTV=="Y" || $cTV=="N") $cQuery .= ",tv='".$cTV."'"; $cQuery .= " WHERE id=".$aRow["id"].";"; //echo "

",$cQuery,"

"; $rResult = mysqli_query($db, $cQuery); } } } else { $com = "1"; $net = "1"; $org = "1"; $biz = "0"; $info = "0"; $us = "0"; $ws = "0"; $tv = "0"; } // Get any domains already searched for: $cQuery = "SELECT * FROM results WHERE session_id='".$sid."' AND show_domain='Y' ORDER BY update_time DESC;"; //echo "

",$cQuery,"

"; $rResult = mysqli_query($db, $cQuery); $nResult = mysqli_num_rows($rResult); //echo "

returned: ".$nResult." rows

"; function mycWhois($domain, $tld) { $reg="*"; // Putting a * in $Reg flags to cWhois not too bother getting full whois data just availablity. // With some registry databases this can speed up the request. (optional) $i = cWhois($domain,$tld,$reg); if ($i==5 || $i==2 || ($i==3)) return "?"; if (($i==0) || ($i==6)) return "Y"; if ($i==1) return "N"; } ?>

Domain Name Brainstorming and Registration

".$cError."
\n"; ?>
"> TLDs to search for:  /> .com    /> .net    /> .org    /> .biz    /> .info    /> .us    /> .ws /> .tv   

Enter up to 10 domain names without the TLD (.com, .net, etc.).
Enter each domain name on a separate line:




Results

      Registered          Available          Not Checked   
"; else { $output = ""; for ($nLoop=0;$nLoop<$nResult;$nLoop++) { $aRow = mysqli_fetch_array($rResult); $output .= "\n"; $output .= buildTable("com"); $output .= buildTable("net"); $output .= buildTable("org"); $output .= buildTable("biz"); $output .= buildTable("info"); $output .= buildTable("us"); $output .= buildTable("ws"); $output .= buildTable("tv"); $output .= "\n"; } echo $output; } function buildTable($tld) { global $aRow; $build = ""; switch ($aRow[$tld]) { case "Y": $build .= "\n"; break; case "N": $build .= "\n"; break; case "U": $build .= "\n"; break; case "?": $build .= "\n"; break; } return $build; } ?>
 Domain Name .com .net .org .biz .info .us .ws .tv Delete
 (use the box above to enter domain names to search for)
 ".$aRow["name"]."Delete
BuyWhoIs
Goto
Check?