We help IT Professionals succeed at work.
Get Started

Error in MySQL syntax for snortreport page

Last Modified: 2012-05-12
I have a system that runs snortreport, which basically just pulls information from a database and displays it on screen.

For one of the pages (https://myserver.local.lab/snortreport/sigdetail.php?signature=SHELLCODE+x86+NOOP&sigid=137&sigsid=648&FQDN=yes&beginTime=1320332359&endTime=1320418759) I am getting the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (event.timestamp > FROM_UNIXTIME(1320332359) AND event.timestamp < FROM_UN' at line 1

I am not a php programmer but I can usually hack my way around things.  I assumed the error was in sigdetail.php since that is the page being loaded.

I was able to find 2 lines of code that looked like they could be the problem:

$DBTimeConstraint = "(event.timestamp > " . $db->timestamp($beginTime) . " AND event.timestamp < " . $db->timestamp($endTime) . ")";

$query = "SELECT event.cid, event.sid, iphdr.ip_src, iphdr.ip_dst, " . $db->timeSinceEpoch("event.timestamp") . " AS timestamp FROM event, iphdr WHERE event.cid = iphdr.cid AND event.sid = iphdr.sid AND event.signature = '".$sigid."' AND $DBTimeConstraint" or die("Error in query");

Since I don't know php well enough I was hoping that someone could help me with this.  The error says on line 1, I can not find anything wrong with line 1 in any file, the all have the basic <?php for line 1.

Watch Question
This problem has been solved!
Unlock 3 Answers and 17 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE