1

Don't know if the author is a genius or an idiot. Thoughts ?

Comments
  • 3
    no escaping.. yikes!
  • 1
    This makes me scream on so many levels

    AAAAAAAAAAAAAAAAAAAHHHHH
  • 2
    That's JavaScript, right? That $page variable is a JavaScript variable, and he's filling that policy_err variable from PHP when rendering the output.

    Or maybe he has mixed one with the other thinking (like many starters do) that they can run PHP code just like that from client code?
  • 0
    @ethernetzero $page is valid jQuery, nuff said
  • 1
    @xewl Yeah, that's what adds to the confusion.
  • 1
    You can use var like this in PHP!
  • 1
  • 0
    @linuxxx @PrivateGER

    echo 'var say=' . (!empty($_GET['what']) && is_string($_GET['what']) ? '"'.escape_str($_GET['what']).'"' : 'null' ) . ';';
  • 0
    @xewl Wouldn't you have to echo out script tags first?
  • 1
    @PrivateGER probably.. depends on how/where exactly u'd use it (thinking eg. a dynamically built .js file/endpoint)
  • 2
    That code is actually a great cross-site scripting opportunity. Your coworker is a genius if he/she is planning to steal from your company, or trick your users. But most probably is an idiot. Yes, he's an idiot.
Add Comment