Jump to content


Photo

Can you met this problem?


  • Please log in to reply
1 reply to this topic

#1 shyami

shyami
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 29 August 2006 - 12:32 PM

Hi everyone,

i am trying this one, for one week

i am uploading some files through my php code,
i need to scan the files for virus information,


some sites they referred clamav, so i installed that one
it is working well in command line, in code, i gave like this

<?php

$e= "testphp.php";
echo "<br>";
$g= exec("clamscan \"$e\"");
echo "Res is <br>";
echo $g;
?>

my output is

Res is
Time: 1.732 sec (0 m 1 s)


from this i can't know anything......
How can i get the virus information?


guide me! plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz




with thanks
shyami

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 29 August 2006 - 12:50 PM

take a look at the php manual. exec() only returns the last row of the result from your external program. there are variables you can pass to retrieve the entire value of the output, but you may want to look at running passthru() instead.
<?php
$res = array();
$e = "test.php";
exec("clamscan \"$e\"", $res);
echo "Res is:<br />\n";
echo "<pre>\n";
foreach ($res as $row) echo "$row<br />\n";
echo "</pre>\n";
?>

try that out instead, and you should have the entire result printed out in preformat tags.

good luck
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users