****************fichiers ou je compte le nombre de clients***********
<? if (isset($_SESSION['clik']) &&
$_SESSION['clik']="Run") include('nombre_online.php');
} ?>
<html>
<head>
<title></title>
<SCRIPT SRC="./javascripts.js"></SCRIPT>
</head>
<body>
<table width=100%> <tr>
<td align=left> search motifs <h3></h3> </td>
</tr></table>
</body>
</html>
*********fichier de traitement si je clique sur le bouton Run********
session_start();
if (!isset($_SESSION['clik']))
{
$_SESSION['clik']="run";
}
#!/usr/bin/perl5.8.0 -w
use strict;
use Module;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
#-----------------------------------------------------------------------------
# VARIABLES
#-----------------------------------------------------------------------------
#cgi objects
my $query = new CGI;
my $params = $query->Vars;
#files
my $resultFile; #result file
#strings
my @results;
my %stats;
#paths
my $htmldir = "/program/";
my $tempdir = "/tmp/";
my $trsetdir = "../html/program.v/";
my $privatedir = "../html/program.f/";
my $stylepath = "$htmldir"."style.css";
my $javascriptpath = "$htmldir"."javascripts.js";
#database conection
my $db = 'DBI:mysql:program';
my $user = 'user';
my $password = 'password';
#generic file stream
my $stream;
#-----------------------------------------------------------------------------
# ERPIN RESULTS
#-----------------------------------------------------------------------------
cleanOldFiles($tempdir, 'program');
$resultFile = $params->{'file'};
if(not $resultFile or $resultFile eq "none")
{
# Running
$resultFile = programRun($db, $user, $password, $query, $trsetdir, $privatedir, $tempdir);
if($resultFile =~ /error/){ exitOnError($query, $resultFile); }
$params->{'file'} = $resultFile;
}
#Results reading
#---------------
%stats = statistics($resultFile);
$params->{'hits'} = $stats{'hits'};
my $firstIndex = $params->{'hitsOnPage'} * $params->{'page'};
if($firstIndex < $params->{'hits'}) {
@results = candidates($resultFile, $firstIndex, $params->{'hitsOnPage'});}
#Temp files erasing
#------------------
#system("rm -f $resultFile");
#-----------------------------------------------------------------------------
# HEADER
#-----------------------------------------------------------------------------
print $query->header;
print (
"<head>
<title>results</title>
<link href=\"$stylepath\" rel=\"stylesheet\" type=\"text/css\">
<SCRIPT SRC=\"$javascriptpath\"></SCRIPT>
</head>
");
#-----------------------------------------------------------------------------
# BODY
#-----------------------------------------------------------------------------
print $query->h3("results");
#print $query->br();
#Form
#-----------------------------------------------------------------------------
if ($params->{'sequence2'} ne "")
{
print $query->h4("Looking for $params->{'trainingset'} into $params->{'sequence2'}");
}
else
{
print $query->h4("Looking for $params->{'trainingset'}");
}
print $query->hr({-width=>"40%", -align=>"left"});
my $lastIndex = $params->{'hits'}-1;
#my $index2 = $firstIndex + $params->{'hitsOnPage'} - 1;
my $index2 = $firstIndex + $params->{'hitsOnPage'};
$firstIndex++;
if ($index2 > $params->{'hits'}){$index2 = $lastIndex+1;}
print $query->p("Page $params->{'page'} (sequences containing hits : $firstIndex-$index2 / $params->{'hits'})");
print $query->startform(-action=>'/program/results.pl');
my $maxPage = int ($params->{'hits'} / $params->{'hitsOnPage'}); #/
print('<table width="80%" border="0"><tr><td>');
for(my $i=0; $i<=$maxPage; $i++)
{
if($params->{'page'}==$i){
print $query->submit(-name=>'page', -value=>"$i", -class=>'selected');}
else {
print $query->submit(-name=>'page', -value=>"$i");}
if( ($i>0)&&( ($i % 20) == 0) ){print '<br>';}
}
print $query->endform;
#Erpin results
#-----------------------------------------------------------------------------
my @array;
my $name = "no name";
for(my $i=0; $i<@results; $i++)
{
if ($results[$i] =~ />/)
{
$name = $results[$i];
#$name =~ s/[\n\t\r\f\e\a]//gi;
#$name =~ s/[\W]/_/gi;
push(@array, $query->th({-align=>'left'}, [$name]) );
}
elsif ( ($results[$i] =~ /FW/)or($results[$i] =~ /RC/) )
{
my $infoTable = infoTable($results[$i]);
push(@array, $query->td({},[$infoTable]) );
}
else
{
my $seq = $results[$i];
my $form = createDrawingForm($query->{'trainingset'}, $name, $seq, $query);
my $form2 = createSaveDrawingForm($query->{'trainingset'}, $name, $seq, $query);
my $info = '<table width=100%><tr>' .
"<td align=left>$form</td>" .
"<td align=left>$form2</td>" .
"<td class=sequences><pre>$seq</pre></td>" .
'</tr></table>';
push(@array, $query->td({},[$info]) );
}
}
print('<table border="0"><tr><td class="bodyline">');
print $query->table( {}, $query->Tr({-class=>'list2'},\@array) );
print('</td></tr></table><br>');
#Erpin statistics
#-----------------------------------------------------------------------------
print $query->h4("Statistics:");
printSortedHash($query, \%stats);
#Legend
#-----------------------------------------------------------------------------
printLegend($query);
#The Naview copyright notice
#-----------------------------------------------------------------------------
print $query->h4("Naview Copyright notice :");
print $query->p( 'The draw button shows pictures created by NAVIEW - ' . );
print $query->p( '');
#-----------------------------------------------------------------------------
# END
#-----------------------------------------------------------------------------
print $query->end_html;