Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts

    Viewing php in browser & other puzzles!

    Hello,

    I have been coding php for some time now and have heard of a couple of odd things. Just wondered if anyone knew the answers.

    1) I have heard that there are ways for people to view your php code in a website, even though php is a server side scripting language. I always thought the fact that the php code is hidden from the users of the site was one of the strong points of using php.

    2) I have also heard (from someone at uni) that it is possible to compile php code. I didn't think this was possible. It would be great if it was as it would mean all my mode wouldn't be open to people playing with it if it was sold on!!

    Not sure if these are just complete myths!!

    Thanks guys!

    Nicky

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by nickyfraggle View Post
    Hello,

    I have been coding php for some time now and have heard of a couple of odd things. Just wondered if anyone knew the answers.

    1) I have heard that there are ways for people to view your php code in a website, even though php is a server side scripting language. I always thought the fact that the php code is hidden from the users of the site was one of the strong points of using php.
    true only if the server is bad configured otherwise no.

    2) I have also heard (from someone at uni) that it is possible to compile php code. I didn't think this was possible. It would be great if it was as it would mean all my mode wouldn't be open to people playing with it if it was sold on!!
    kind of compile:

    http://www.php.net/manual/en/ref.bcompiler.php

    Not sure if these are just complete myths!!
    or interpretation,

    best regards
    Last edited by oesxyl; 12-28-2007 at 10:59 PM.

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts
    Hehe! Thanks for your help! It seems a great many things are open to interpretation!!

    Nicky

  • #4
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    "hackers" can see your code if they find a vulnerablility in your code that allows them to.
    Another way is via local file inclusion which is another type of vulnerablility.
    last way is if the server is misconfiguired, or you use a distobution of the lightspeed server. as there has been found an exploit which with 3 characters at the end of the filename, a "hacker" can view the source of that file

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by nickyfraggle View Post
    1) I have heard that there are ways for people to view your php code in a website, even though php is a server side scripting language. I always thought the fact that the php code is hidden from the users of the site was one of the strong points of using php.
    Not directly, no. Someone can't just right-click and hit View Source. But as oesxyl & Jesuspwnt stated, if you're on a shared server and security is lax, it is possible for them to get the source.
    Quote Originally Posted by nickyfraggle View Post
    2) I have also heard (from someone at uni) that it is possible to compile php code. I didn't think this was possible. It would be great if it was as it would mean all my mode wouldn't be open to people playing with it if it was sold on!!
    Your code is compiled into bytecode by PHP encoders(Zend Guard, Ioncube) so people can't see the source, but there have been a couple of hackers who have found ways to get at least part of the code from the encoded file(maybe not with the newer versions?). There is also the PHP GTK that will compile code, but that is for running it in your OS GUI, not on your website.

  • #6
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    php gtk doesn't compile php code.

  • #7
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Sorry, let me be more specific. The PHP GTK can be used to run PHP code that will generate GUI apps, and some programs will compile PHP code that will run as a standalone desktop GUI app on the OS it was compiled for.

  • #8
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    This is a nice little PHP -> EXE (windows) "compiler" that I've used before (ages and ages and ages ago!): http://www.bambalam.se/bamcompile (not a true compiler in that it does not produce native machine code). Might be out of date now.
    Last edited by mlse; 12-29-2007 at 04:21 PM.

  • #9
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    and let's also say that compiling PHP code is going against all that PHP stands for. if PHP wasn't free code from the start websites would still be in stone age

  • #10
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by matak View Post
    and let's also say that compiling PHP code is going against all that PHP stands for. if PHP wasn't free code from the start websites would still be in stone age
    I wouldn't go so far as to say it goes against what PHP stands for.. keep in mind that Zend makes and distributes(not for free I might add) the most widely used encoding software whose main purpose is to prevent people from seeing the source. But, I will agree that PHP wasn't designed to be compiled to begin with, and is certainly not the ideal platform for designing GUI programs.

  • #11
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    On the subject of GUI programs; I know this is a little off-topic, but I have used wxPython quite a bit for writing GUI programs ... it is not the greatest thing since sliced bread, but you can knock up cross-platform demos really really fast!

  • #12
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    i would really like to see how people write programs for php gtk. but i really mean, the whole source from the start. from echoing links to drawing lines with mouse. :coffee:


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •