![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Put your spam information in a database. It has nothing to do with web design. It might be as simple as importing a .csv file or a complex as writing a program to parse the file and stuff it into the database. It isn't an http transaction, subject to the limitations thereof. Just do it.
Design your web application to query/update/maintain/whatever.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#12 |
|
Programmer
Join Date: Feb 2006
Posts: 40
Rep Power: 0
![]() |
So what do u advise me to use while inserting the data into the database??should I use another programme?? maybe eclipse?? or C++ builder?? or C#?? or what do u advise??
|
|
|
|
|
|
#13 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Maybe you'd like to show a couple lines from the raw file and a proposed DB structure.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#14 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
Ideally, you'd have a program that parses and inserts the spam file into the database, and a PHP script on your webserver that searches the database. If you tell us how your spam file is formatted, and how you want your database to be structured, then we can advise you further. For instance, say you had a spam file that contained large number of blacklisted IP addresses, and there was one IP address per line: 86.34.1.34 103.23.6.100 ... I favour Python and MySQL for most programming tasks like this, so that's what I'll use in this example: import MySQLdb
database = MySQLdb.connect(passwd = "password", db = "spam")
cursor = database.cursor()
file = open("spamfile.txt")
for line in file:
cursor.execute("INSERT INTO spamlist VALUES (%s)", line.strip())
file.close() |
|
|
|
|
|
|
#15 | |
|
Programmer
Join Date: Feb 2006
Posts: 40
Rep Power: 0
![]() |
Quote:
and the db all consists of 11 fields. I am told that [qsheff] part will not be used,but I put a rowcount column instead of it but it is not auto increment.Im incrementing it manually.Whatever,I read the whole text and put each line into an array.And then I parsed according to the commas in the lines.This arrays first element consists of 3 parts.Day,time and [qsheff] which I dont need.So Im parsing them by spaces and dump the unneeded parts of the strings with string functions. I dont know how helpful these are,but what I think about is if there is a problem about getting data from the page.Im getting them via fgets function and I set the length to 4096 bytes.But as far as I am concerned,this is for lines.Would my script run faster if I reduce the size?? here is the code of that part [PHP]$sf = @$_POST["selectedFile"]; $fp = fopen("$sf", "r") or die("Couldn't open file"); $data = ""; while(!feof($fp)) { $data .= fgets($fp, 4096); } fclose($fp); $values = explode("'\r\n", $data); for($i=0;$i<sizeof($values);$i++){ $values2[$i] = explode(",", $values[$i]); $values3[$i] = explode(" ", $values2[$i][0],-1); }[/PHP] |
|
|
|
|
|
|
#16 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
What does your database table look like? Also, is the spam file just going to be entered into the database once, or is it going to be continuously updated, with the updates being added to the database periodically?
|
|
|
|
|
|
#17 | |
|
Programmer
Join Date: Feb 2006
Posts: 40
Rep Power: 0
![]() |
Arevos I have just read ur message.Actually,this is not the only thing I did for parsing.I really pushed the boundaries of my brain while forming the dynamic query.Now everything is fine except one thing.I thought everything has finished.Queries were returning accurate results(of course the part inserted before CGI error) and my javascripts works fine.However,when I was checking the system trying each query one by one,I saw that the lines which has ERR instead of VIRUS or ATTACH must be parsed in a different way.
Now I have to find another algorithm for that. Quote:
I hope we can work this problem out.I wouldnt know this error would keep me away from my work that much ![]() |
|
|
|
|
|
|
#18 | |
|
Programmer
Join Date: Feb 2006
Posts: 40
Rep Power: 0
![]() |
It is just going to be entered at once.I work with only one table.Actually thats how I was ordered.Here is the definition of the table
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|