1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Hacking attempt - what is this?

Discussion in 'Programming' started by sterry, Sep 28, 2007.

  1. #1
    Hello, people
    I am not a programmer.
    I am in situation where I need to understand what this code is about:

    die("Hacking attempt");

    can anybody explain in plain words ?

    Thank you
    SEMrush
     
    sterry, Sep 28, 2007 IP
    SEMrush
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    This code exits the current script and shows just the text. You can find more about the die() language construct here.

    www.php.net/die
     
    nico_swd, Sep 28, 2007 IP
  3. sterry

    sterry Peon

    Messages:
    252
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If I could understand anything there I wouldn't ask that question :D
     
    sterry, Sep 29, 2007 IP
  4. TechEvangelist

    TechEvangelist Guest

    Messages:
    919
    Likes Received:
    140
    Best Answers:
    0
    Trophy Points:
    133
    #4
    "die" basically means that the script stops running and the message in the quotes is displayed.
     
    TechEvangelist, Sep 29, 2007 IP
    sterry likes this.
  5. sterry

    sterry Peon

    Messages:
    252
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks!!!
    sounds like human talk :)

    Look. In some of site's PHP files I see this:

    <?php
    if ( !defined('********') )
    {
    die("Hacking attempt");
    }

    (don't pay attention to stars)
    does it mean that the site INVOLVED IN HACKING anyway?..
     
    sterry, Sep 29, 2007 IP
  6. snapcount

    snapcount Peon

    Messages:
    6
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That snippet of the code you posted does not indicate it is. It seems to me the purpose is to tell the person using the script ( or your server logs ) that someone is attempting to hack *your* script.

    That code does not try to hack anything else, as said earlier the command die makes the program stop executing immediately and display the message passed to it.
     
    snapcount, Sep 29, 2007 IP
    sterry likes this.
  7. firmaterra

    firmaterra Peon

    Messages:
    756
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #7
    The script is saying that if something is not defined, display the message "hacking attempt". My guess is it is there to warn you that your site is being hacked, OR that you have forgotten to define a variable etc. in some config file somewhere.
     
    firmaterra, Oct 1, 2007 IP
    sterry likes this.
  8. Lordy

    Lordy Peon

    Messages:
    1,644
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Right, it's just displaying Hacking attempt when the script runs unsuccessfully. Most likely means nothing, and just wanted to be creative.

    the if !defined means if its not defined, then this will happen
     
    Lordy, Oct 1, 2007 IP
    sterry likes this.
  9. sterry

    sterry Peon

    Messages:
    252
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Respect and reputation to all of you, guys and thanks a lot.
    +++
    to clarify why am I asking this question:
    I was trying to hire a programmer for some work, and he refused that work, because "THE SITE IS INVOLVING IN HACKING".

    Now I know that all he told me was wrong. I believe the reason was something else.

    Thanks again!
     
    sterry, Oct 1, 2007 IP
  10. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #10
    LOL. Even if it wasn't another reason, if a 'programmer' tells you that then you don't want to work with him anyway :)
     
    TwistMyArm, Oct 1, 2007 IP
  11. petronel

    petronel Peon

    Messages:
    113
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #11
    :) that was the funniest thing i saw today :)) he must be an expert on PHP and hacking :D

    that part of the script is used on some php scripts (like phpbb2) to not allow direct access to some files (mainly php files that store classes or functions used by the script). So, if someone try to access that files directly, it will get a msg "Hacking attempt" and script will stop :)
     
    petronel, Oct 1, 2007 IP
  12. ndreamer

    ndreamer Guest

    Messages:
    339
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #12
    that bit of code is very common to prevent loading of modules with out going though the loader script.
     
    ndreamer, Oct 1, 2007 IP
  13. sterry

    sterry Peon

    Messages:
    252
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #13
    TwistMyArm
    petronel
    ndreamer


    it sounds funny to me now, when I know what it is.

    But I was scared to... death :D when I got the email from a "programmer":

    This is to inform you that, We are cancelling the contract for rectifying the links due to reason mentioned below,
    Our policy don't permit us to do this work.
    You never mentioned that HACKING is involved in this.
    We are cancelling that contract and we are no where involved in this project.
    We don't prompt hacking at anycost


    BTW, I emailed him the link to this thread so he can learn something about programming :D
    Thank you, guys!

    PS:
    forgot to mention that the guy is a DP member
    :D
     
    sterry, Oct 1, 2007 IP
  14. Lordy

    Lordy Peon

    Messages:
    1,644
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #14
    rofl! I doubt he's a competent programmer at all!

    I've only read into the basics of a PHP book, and I already know what die() does.

    The rest of the syntax is easy to follow from other languages.

    die() is like, page 10 of a php book, on what to do when your script overloads your server.
     
    Lordy, Oct 1, 2007 IP
  15. firmaterra

    firmaterra Peon

    Messages:
    756
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #15
    lol, some 'programmer' obviously never bothered to read the script he was working on :D

    Hey, at least the guy has ethics anyway!! :p
     
    firmaterra, Oct 7, 2007 IP
  16. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #16
    "Ethical"? I disagree... he passes himself as a programmer but doesn't even understand the basics of the language. No doubt he was happy to take the money under the guise of a programmer. I wouldn't call him ethical at all!

    I would change that line to 'at least the guy was covering his arse!'.

    The funny thing is that with what his abilities appear to be, his code could only be called 'hacky' in the first place!
     
    TwistMyArm, Oct 8, 2007 IP
  17. ValDD

    ValDD Banned

    Messages:
    171
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #17
    This statement by itself doesn't tell us much. Maybe there's some code that causes this statement to be executed? Maybe there's some hacking detection code?
     
    ValDD, Oct 10, 2007 IP
  18. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #18
    nico_swd, Oct 10, 2007 IP