Hi all.
I have a problem wich is a little strange. My page contains a html link which refreshes the page and calls a PHP variable. This variable appends a date string to the url string which is fed into a MySQL query, which grabs records matching this date. I think this is causing an injection as it sometimes deletes the user from the database!
I know there may be security issues using the '#' in the hyperlink, but I'd like to know whats going on. Also would this have different effects on different browsers seeing as how it uses javascript. The users being deleted seems to happen only on some peoples computers.
The PHP code calculates a timestamp three days from now and then puts it into a SQL format:
$ts_threeDays = mktime(1,0,0,date('m'), date('d')+3-date('w'), date('y'));
$threeDaysAhead = date('y-m-d', $ts_second_day);
The script then listens for the 'day' variable in the url string passed by the hyperlink on the page:
$date = mysql_real_escape_string($_GET['day']);
The JavaScript and hyperlink is:
<a href='#' onClick="document.location.href='planner.php?day=<?php echo $threeDaysAhead; ?>'"> 3 Days Later</a>
The MySQL query is bigger but the only input it takes from user action is the above date string. Query basically looks like this (uses another select statement to access users table):
SELECT planner.details FROM planner
WHERE planner.date = '$date' AND users.`user_id` = '$id' // Logged in Id superglobal
If anyone can help me out and explain my problem I will be most grateful. Many thanks