![]() |
Search by date range problem
I have a script the searches by date range, work s great. However, being in the new year I noticed if I do a search from 08 to 09 it doesn't return any result but if I search in just 08 or 09 it returns result correctly. Any ideas?
|
Can you please post the script so we can see the problem?
|
HTML:
Code:
<form action="search_results.php" method="post" name="search_form">Code:
$MM_username = $_SESSION['MM_Username']; |
I really hope your not using that code live as its so insecure.
|
No, how would I secure it? I'm not that familiar with php.
|
You need to secure all of the $_POST and $_GET methods. An example is below (Please note that the mysql function I am using is the minimum you need to do. You should do a lot more and im sure if you search here you will find some tutorials on it. Search for xss protection or something):
PHP Code:
|
Quote:
I think these articles may help you understand: http://www.talkphp.com/general/1062-...s-sprintf.html http://www.talkphp.com/tips-tricks/1...cure-site.html http://www.tizag.com/mysqlTutorial/m...-injection.php Also I advise that you turn error reporting off in a live server environment, don't make the hackers life easy by giving him feedback on his attempts (which in essence is what happens with errors). Anyway to the problem. Is your database stripping of the preceding zero?, I say this because you are sending both 09 and 08 in the between statement as string (wrapped in single quotes), thus the db will be comparing: the string "08" and the integer 8 and so on and so forth. In other words, what's the column's data type? and what does it currently hold |
Quote:
Ye, my bad. I was thinking of xss mainly as i was just trying it out on a script. Sorry. |
Quote:
Its hard to keep up with all these acronyms! |
Quote:
|
use:
PHP Code:
|
What is the columns datatype?
|
| All times are GMT. The time now is 05:19 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0