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 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Make a simple scripting language in PHP

    I'm working on a web project with PHP and jQuery, and need to make my own tiny scripting language within PHP.. My own scripting language should be able to call some PHP functions that I define, and of course have a simple way of defining variables and maybe even be able to use loops..

    I found this site: "http://www.tuxradar.com/practicalphp/21/5/13" that explains some of it, but I don't think that is enough.
    So i would like to hear you guys if you know a simple scripting language made in PHP, that I could take a look at? Or just more articles about the subject?

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Would it not just be better to use php directly and run it through the eval() function?
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #3
    New Coder
    Join Date
    Jan 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but isn't that pretty insecure, when I want my users to be able to make their own scripts?

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Potentially yes.

    You could however theoretically use ini_set() and then declare your disabled functions such as mail(), mysql_connect() etc.

    Also if you were to do that, be sure to disconnect from mysql before the eval() call and reconnect again after so that users can't run their own queries against your database.

    Again it's only theoretical, you'd need to do some testing but its an idea I came up with as I have a requirement similar to yours for a project of mine thats still on the back burner.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!


  •  

    Tags for this Thread

    Posting Permissions

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