473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

database usage

nabanita
in a particular coding, i made a complete directory scan and then the files falling under a particular category are stored in a database. However the variable used for storage contains the real path(e.g. C:\wamp\www\example), but the value stored in the database is different because it removes all the '\' from the variable and store a value like C:wampwwwexample and thus further usage of the path becomes impossible. The code written for the purpose is pasted below please suggest me a way so that the value stored in the database is the real path and not a distorted value!

THE CODE=>

<html>
<head><title>Scan Result</title></head>
<BGSOUND SRC="Windows XP Exclamation.wav">
<b><font face="Verdana, Arial, Helvetica, sans-serif">Current Directory Contain
Following files and Sub Directories...</font></b>
<p>
<?php
include 'opendb.php';
$found = array();$i=0;
$vc=0;
if(isset($_REQUEST['custom']))
{
$C=$_REQUEST['custom'];
if($C=="")
header('location:CustomScan.php?y=You have not enterd appropiate drive name');
else if(!(is_dir($C)))
header('location:CustomScan.php?y=You have not enterd appropiate drive name');
@DirDisply($C);
}
else
header('location:CustomScan.php?y=You have not enterd appropiate drive name');
function DirDisply($p)
{
global $found,$vc,$i;
$TrackDir=opendir($p);
while ($file = readdir($TrackDir))
{
if ($file == "." || $file == "..")
{
continue;
}
else
{
$n=$p."\\".$file;
echo $n."<br>";
$i++;
if (is_dir($n) )
@DirDisply($n);
else
{
if(is_executable($n) )
{
$handle=fopen($n, "rb");
$convert=bin2hex( fread( $handle, filesize($n) ) );
$query="SELECT signature, virus FROM virusdetails";
$result=mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$pattern="/"."{$row['signature']}"."/";
$name="{$row['virus']}";
if(preg_match($pattern,$convert))
{
$vc++;
$query="INSERT INTO found (signature, virus, file) VALUES ('$pattern', '$name' ,'$n')";
mysql_query($query);
}
}
fclose($handle);
pack( "H*", $convert );continue;
}
}
}
}
closedir($TrackDir);
return;
}
echo"<br><br><br><br><b>SCAN RESULT<br><br><br>Total files scanned is $i </b><br><br>";
if($vc==0)
echo"<b>your computer is running free of virus</b><br>";
else
echo"<b><i>your computer has ".($vc)." occurences of virus<br><br>The infected files are => <br></b></i>";

$query="SELECT signature, virus, file FROM found";
$result=mysql_query($query);$k=1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo"$k> <b>Signature:</b><i>{$row['signature']}</i><br><b>Virus:</b><i>{$row['virus']}</i><br><b>Name Of The Infected File:</b><i>{$row['file']}</i><br>";
$k++;echo"<br>";
}
?>
</p>
<table align="center" cellspacing="0" >
<tr><td><center><a href="CustomScan.php">Previous</a></td>
<td><center><a href="index.php">Home</a></td>
</tr>
</table>
</body>
</html>
May 5 '10 #1
1 1143
dlite922
1,584 Expert 1GB
what database?

Have you coded anything? If not, do you know PHP?

Learn PHP from many tutorials on Google or read the manual at php.net.




Dan
May 5 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Rajeev | last post by:
Dear friends I am conducting a survey on Relational Database usage and would like your help. The study is part of my MBA Dissertation. Could you kindly spare 5 minutes to take part in this...
11
by: Jay King | last post by:
Ok I'm very new to the whole database thing, my problem is I'd like to use firebirds embeded database engine so I can just send it as some stand alone dlls to my user with my main program. I have...
3
by: Terry Maguire | last post by:
I am an old VB6 programmer, and we have recently gone to VB.NET. I am struggling to duplicate some of the things I had done in VB5 and VB6 to the new language. What I need to do is to use VB.NET...
1
by: atifahmedsiddiqui | last post by:
Hi all, I had a problem with my database, some one among my team did overwrite/restore the database by mistake, and now I want my old data back. I do have backup that I can restore, but still I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.