Skip to content

Commit

Permalink
* replying with no content (only headers are sent; fast for client side)
Browse files Browse the repository at this point in the history
* fixing a possible cookie injection
  • Loading branch information
Oncle Tom committed Sep 17, 2011
1 parent 204d040 commit 5465e61
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ai-cookie.php
@@ -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.