Permalink
Browse files

* replying with no content (only headers are sent; fast for client side)

* fixing a possible cookie injection
  • Loading branch information...
Oncle Tom
Oncle Tom committed Sep 17, 2011
1 parent 204d040 commit 5465e61da9a7accb1254f3c888755e42c0cdc061
Showing with 6 additions and 6 deletions.
  1. +6 −6 ai-cookie.php
View
@@ -1,9 +1,9 @@
<?php
-$maxwidth = $_GET['maxwidth'];
-if($maxwidth == "unknown") { $maxwidth = 3000; } // we need a number, so give it something unfeasable
+$maxwidth = isset($_GET['maxwidth']) ? intval($_GET['maxwidth']) : null;
+
+if(null === $maxwidth || $maxwidth === "unknown") { $maxwidth = 3000; } // we need a number, so give it something unfeasable
setcookie('resolution',$maxwidth,time()+604800,'/'); // set the cookie
-// respond with a (fake) blank image
-header('content-type: image/jpeg');
-exit();
-?>
+// respond with an empty content
+header('HTTP/1.1 204 No Content');
+exit();

0 comments on commit 5465e61

Please sign in to comment.