Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CGI Searcher

Posted on 2001-07-28
9
Medium Priority
?
206 Views
Last Modified: 2013-12-25
Dear Sir,

What I want is - I wanted a text file and on that file, whenever anyone registered them selves like, Let say domains registration process. when ever user register thier domain like www.anything.com it will search the text file and tell them if the domain is available i dont wanted to involve INTERNIC WHOIS DATABASE, when ever user register thier domain , thru web interface form and let say the user is looking for www.ab.com and that domain is available and then user hit submit button after submitting the form and when he submit the form, the ab.com is got in to the text file on my server, so after if any other user is looking for the ab.com it will tell them that ab.com is already book.. by looking the text file. how I am going to do that. Please let me know. Thanks.
0
Comment
Question by:sohaib69
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 8

Expert Comment

by:bebonham
ID: 6330300
so you don't care if the domain is registerd with internic

right?

this is purely internal?
0
 
LVL 1

Author Comment

by:sohaib69
ID: 6330770
yes this is purly internal...
0
 
LVL 8

Accepted Solution

by:
bebonham earned 400 total points
ID: 6330789
here is a crude example

#!/usr/local/bin/perl

use CGI ':standard';




### vars

$dfile='domain.txt';  ##datafile for storing domain names
####


print header, start_html;


if(!param())
{
if(-e $dfile)
{
open NAMES, $dfile;

@names=<NAMES>;
close NAMES;

print "the names already in use are:<BR>";
foreach(@names)
{
print "$_<BR>";
}
}
print "pick a domainname like books.com<BR>";
print start_form,
textfield(-name=>'domain'), submit();
}

if(param('domain'))
{
my $d=param('domain');
open NAMES, $dfile;

while(<NAMES>)
{
if($_=~/$d/i)
{
print h1('sorry that is taken');
exit;
}
}
close NAMES;

open NAMES, ">>$dfile";
print NAMES param('domain') . "\n";
close NAMES;
print "done, hit back button and reload prev. page";
}
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:sohaib69
ID: 6330800
Is that a script which can tell if the domain is taken or not right, so how is going to be the html file

when ever user submit the form by putting the domain what is going to be the field name of the domain box , so that it can tell if the domain is taken or not.

thanks for ur help
0
 
LVL 1

Author Comment

by:sohaib69
ID: 6330803
$dfile='domain.txt';  ##datafile for storing domain names

and that file is going to be like

$dfile='/home/www/domain.txt';  ##datafile for storing domain names

the location of the text file right..

0
 
LVL 1

Author Comment

by:sohaib69
ID: 6330811
what is the problem with that script is, when ever I look for the domain like abc.com it's just storing the domain. like i do abc.com , and yahoo.com first it says , after putting yahoo.com done, hit back button and reload prev. page.. then after I reload page it show that name yahoo.com on that file..

What I want the user can look for a domain by html form and then this file can tell if the domain is available, and then after this script registered the domain by storing on that domain.txt .. You know what I mean
0
 
LVL 1

Author Comment

by:sohaib69
ID: 6330836
Excellen question thats what I am looking for, and you made my work more easier, but also as I mention on my next ticket please tell me what to do with that .. Thanks
0
 
LVL 1

Author Comment

by:sohaib69
ID: 6331024
the script Accepts anything, like if you enter books.tatat.tete or books.sex or anything .  let say if I wanted to limit the script to search only .net and nothing else except for .net how I am going to do that. so that no one cant search that script to books.com or books.tatat.tete or books.com just only books.net where I wILL modify the script so that it will just search .net let me know please..
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6331941
try this:

#!/usr/local/bin/perl

use CGI ':standard';




### vars

$dfile='domain.txt';  ##datafile for storing domain names
@allowedDomains=qw/.net .com .org/;  ## only accept these domains

####


print header, start_html;


if(!param())            

if(-e $dfile)
{
open NAMES, $dfile;

@names=<NAMES>;
close NAMES;

print "the names already in use are:<BR>";
foreach(@names)
{
print "$_<BR>";
}
}
print "pick a domainname like books.com<BR>if your name is taken ";
print "or if it is not valid we will return an error message\n";
print start_form,
textfield(-name=>'domain'), submit();
}

if(param('domain'))
{
my $d=param('domain');

$d=~/.*(\..*)$/;
$true=0;
foreach(@allowedDomains)
{
if($1 eq $_)
{
$true=1;
}
}
unless($true){
print h1("sorry, we do not allow $1");
exit};

open NAMES, $dfile;

while(<NAMES>)
{
if($_=~/$d/i)
{
print h1('sorry that is taken');
exit;
}
}
close NAMES;        

open NAMES, ">>$dfile";
print NAMES param('domain') . "\n";
close NAMES;
print "done, hit back button and reload prev. page";
}  

                   
Bob
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question