File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ an individual blog result based on a given id::
263
263
{
264
264
$link = open_database_connection();
265
265
266
- $id = mysql_real_escape_string ($id);
266
+ $id = intval ($id);
267
267
$query = 'SELECT date, title, body FROM post WHERE id = '.$id;
268
268
$result = mysql_query($query);
269
269
$row = mysql_fetch_assoc($result);
@@ -308,7 +308,7 @@ this page introduces even more lingering problems that a framework can solve
308
308
for you. For example, a missing or invalid ``id `` query parameter will cause
309
309
the page to crash. It would be better if this caused a 404 page to be rendered,
310
310
but this can't really be done easily yet. Worse, had you forgotten to clean
311
- the ``id `` parameter via the ``mysql_real_escape_string () `` function, your
311
+ the ``id `` parameter via the ``intval () `` function, your
312
312
entire database would be at risk for an SQL injection attack.
313
313
314
314
Another major problem is that each individual controller file must include
You can’t perform that action at this time.
0 commit comments