PDA

View Full Version : Wap


wappo
12-28-2003, 03:39 PM
Hi,
I have this script below which, allows people to search WAP through a file called db.txt, i am totaly new to perl/cgi and i normally use php. My problem is that i can't host perl/cgi on my server, can anyone host the script below for me or tell me a free host for php/cgi,
Wappo!

#!/usr/local/bin/perl
#Write here the path of your text-based database
$dblocation="/usr/db.txt";

#Read the content of the form
&parse_form;
#Open database
&apri;
#Search
&trova;
#Print output
&html;
&html1;



#######################################################################
##Project by Dario Lillo
##Released under GNU license
#######################################################################
sub parse_form {
$valore=$ARGV[0];
}

sub apri {
open(FILE,"$dblocation");
@LINES = <FILE>;
close(FILE);
}

sub trova {
$contarighe=0;
$contarisultati=0;
@datrovare = split(/\s+/, $valore);
foreach $riga (@LINES) {
foreach $chiave (@datrovare) {
if (!($riga=~ /$chiave/i)) {
$trovato='no';
last;
} else {
$trovato='yes';
}
}
if ($trovato eq 'yes') {
$risultati[$contarisultati]=$contarighe;
$contarisultati++;
}
$contarighe++;
}
}
sub html {

print <<"dario";
Content-type: text/vnd.wap.wml

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="card1" title="Results">
<p>

dario
}
sub html1 {
if ($contarisultati>0){
foreach $risultato (@risultati) {
@ris=split (/<x>/, $LINES[$risultato]);
print "<a href='$ris[2]'>$ris[0]</a><br/>$ris[3]\n";
}
}else {print "No results";}
print "</p></card></wml>";

}

dandan556
12-29-2003, 12:46 PM
use netfirms, i had the same prob m8

:thumbsup: :thumbsup: :thumbsup: