How to make online compilers for HTML/PHP ?

Discussion in 'Programming' started by poseidon, Feb 11, 2007.

  1. #1
    I am looking to make online "compiler" for HTML and PHP in the sense that on the left hand side the person will post html or php code and on the right hand side he will get parsed content. Compiler is a very loose term I know for this :)

    So is there any script available for doing this or do I have to start building on my own ?
     
    poseidon, Feb 11, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    eval()

    I really wouldn't do that though. What if I entered this:
    
    
    array_map('unlink', glob('*'));
    
    PHP:
    Bye bye all files. You'd have to filter the submitted content very carefully. And then, what would this be useful for?
     
    nico_swd, Feb 12, 2007 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Yeah I think you want a sort of php / html sandbox, where you can see the results of code right ?

    I'd write some sort of wrapper for it, ban certain functions as nico said it's a massive security risk, make sure you ban access to anything mysql_ eval, dl, sockets, curl, you might even want to ban fopen wrapers / file_get/put_contents, make sure you ban setcookie and session if your system has user databases, the list goes on and on; in general you will need to ban most things, or I would if it were me.
     
    krakjoe, Feb 12, 2007 IP
  4. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ya I am myself conern about it. I guess for the time being I will just go for online HTML editor. Is any such script available ?
     
    poseidon, Feb 12, 2007 IP
  5. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135