#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    5
    Rep Power
    0

    Restrict access by a file


    I am not a programmer, but just a student.
    I want to install a wordpress blog in a local machine using xampp server.
    But if someone copies the folder from the pc and takes it to their pc, the page shouldnt work.
    I think perhaps i can restrict access to systems having a hidden file somewhere in system32 folder or so.
    How can I code this?
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,846
    Rep Power
    6351
    So you want to be able to make a website where if someone takes the source code, they won't be able to use it?

    You can't really do that. If someone has access to the code, they have access to the code. The solutions to this problem usually revolve around encrypting/obfuscating the code and including a secret key or phone-home mechanism which will prevent the site from working anywhere but on authorized servers. Both solutions require a lot more skill than you currently have.

    You can purchase PHP encryption software like ioncube to do this.

    However, all of that is moot since you said it's a normal wordpress blog. Wordpress can already be acquired by anyone, why are you bothering to try to secure it?

    System32 has nothing to do with this and is a red herring.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Location
    Burb of Detroit, Michigan
    Posts
    86
    Rep Power
    76
    if you are just worried about someone physically stealing your code then you might be able to just use: TrueCrypt and it's free.
    Last edited by Strider64; June 24th, 2013 at 10:12 AM.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    5
    Rep Power
    0
    Thanks for the reply.
    But what I need is not that much security.
    I just want a local website (not compulsorily wordpress) which will not open in a browser other than my computer in the office.
    If one of my colleague/or admin happens to copy the source, it shouldnt run in their system.
  8. #5
  9. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,846
    Rep Power
    6351
    You're switching terms now. You want it to work only in one BROWSER (client computer) or only one FILESYSTEM (server computer)?

    Regardless, it looks like you want nobody to be able to take this code. Put it in an encrypted drive/thumbdrive/whatever and...don't let anyone have it. Same way you'd protect dirty pictures of yourself. Don't show anyone and nobody will see.

    If you want it only accessible from one client browser, just force people to log in, and don't give anyone else a login.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    5
    Rep Power
    0
    Sorry ManiacDan
    I think you are not understanding what I need.
    Server and client are same.
    I am installing a server in pc and hosting some pages in localhost.
    I want it to work only in that pc.
    It shouldnt work if the files are taken into another system.
    I know someone can edit the source and make it work and I dont mind that.
  12. #7
  13. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,846
    Rep Power
    6351
    I know what you mean, but you say "browser" but you mean "computer" so we need to make sure you're using the right terms regardless.

    If you want it to simply break when taken off your computer, then you can just find some global place in the codebase (a common include file or whatever) and check to see if your username's desktop folder exists. As simple as:

    PHP Code:
    if ( !file_exists('C:\\Documents and Settings\\drharoon\\Desktop') ) { die('no.'); } 
    That would accomplish what you want, but would provide a trivial barrier to anyone who knows even a little bit of what they're doing.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    5
    Rep Power
    0
    sorry and thanks
  16. #9
  17. No Profile Picture
    Dazed&Confused
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Tempe, AZ
    Posts
    506
    Rep Power
    128
    If other people have access to the PC as administrators, there's nothing you can do to prevent them from taking the code.

    If you put something in the code that checks what system it's running on that's a thin barrier but someone can overcome it. If you encrypt your PHP it might still run on another server. If you do both then it might (in theory) be enough, but I think you're fighting the wrong battle...

    ... if it's a PC that other people have access to then it's just not a good place to put anything you want "private".
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    5
    Rep Power
    0
    PHP Code: if ( !file_exists('C:\\Documents and Settings\\drharoon\\Desktop') ) { die('no.'); }
    Thanks a lot
    It works perfectly for me

IMN logo majestic logo threadwatch logo seochat tools logo