#!/usr/bin/perl use DBI; use CGI; $param=new CGI; $tabulka = $param ->param('table'); $radka = $param ->param('radka'); $id = $param ->param('id'); print "Content-type:text/html\n\n"; &init; print ""; if ($tabulka&&$radka&&$id) { $dbh = DBI->connect("$INIT","$LOGIN","$PASS"); $pop = $dbh->prepare("show columns from $tabulka"); $pop->execute; $vysl =$radka/1; if(!$vysl) { $sth=$dbh->prepare("select * from $tabulka where $id like '$radka'") || print $dbh->errstr; }else { $sth=$dbh->prepare("select * from $tabulka where $id=$radka") || print $dbh->errstr; } $sth->execute; @sloupce = @{$sth->{NAME}}; #@aaa = @{$sth->{TYPE}}; print qq(Selected table : $tabulka
\n); print qq(
); print qq(
); @rr=$sth->fetchrow_array; $cnt=0; foreach $ra(@sloupce) { @types=$pop->fetchrow_array; print qq(\n); if (($types[1]=~/text/)||($types[1]=~/blob/)) { print qq(\n); }else { print qq(\n); } $cnt++; } print qq(
Submit :
columns : @sloupce
$ra $types[1]
Submit :
); $sth->finish; $pop->finish; $dbh->disconnect; } # ------------------------------------------------- sub init { open(F,"dat.conf"); @o =; close(F); %COLS=(); foreach $radek (@o) { next if $radek=~/^#/; next unless $radek=~/\S/; if ($radek=~/^init/i) {($INIT)=($radek=~/^init\s*=\s*(\S*)/i);}; if ($radek=~/^login/i) {($LOGIN)=($radek=~/^login\s*=\s*(\S*)/i);}; if ($radek=~/^pass/i) {($PASS)=($radek=~/^pass\s*=\s*(\S*)/i);}; #if ($radek=~/^tables/i) {($tmp)=($radek=~/^tables\s*=\s*(.*)/i);$tmp=~s/\s*//g;@TABL=split(",",$tmp);}; #if ($radek=~/^cols/i) {($tmp1,$tmp2)=($radek=~/^cols\s*(.*?)\s*=\s*(.*)/i);$tmp2=~s/\s*//g;$tmp2=~s/,/,/g;$COLS{"$tmp1"}="$tmp2";}; } if(!$INIT) {&err("100","No init string");exit(0);} } sub err { print "
Error :$_[0] : $_[1]\n"; }