edlentz Posted September 11, 2016 Share Posted September 11, 2016 I need to create config files for IP based phones. There are several different models from the same manufacturer. The file structure is pretty simple for all models, just some differences in how many buttons, etc. IE: Button6 = BLF Button6value = 103 etc. I want to start out with a template of ALL the different settings an use PHP to change the variables. I also need to inject a username & password into the file for each specific phone with the name of the file being the MAC address of the phone. I know some PHP, but this is beyone my skill set. Can anyone provide a simple example of how I can do this ? What I have to work with is a LAMP system based on Centos6. Thanks in advance for any help Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 11, 2016 Share Posted September 11, 2016 Have no idea what you are doing. Have you ever designed a project before? Answered all the questions that can come up and design alternatives for them? Designed a db? As for the db - think about the data items you want. Organize them. Design a record layout that collects the unique attributes of a "thing" and creates a logical "set" of data for it. Any attribute that can occur multiple times for a single thing should not be in this record, but be part of a related table that will hold multiple records for each "thing" in the primary table. For instance if a phone has multiple buttons that you want to keep info on, the primary record should point ot a 'button' table that will contain at least two fields/columns - one being the name/id of the button and the second being the attribute of that button. You may have multiple attributes but each of these button records will be connected to the primary record by something you define as the 'phone id', with that value stored in the primary record and in each of the secondary recs. This is how you design a db. Coming up with your db design is the first course of action. Once you have that picture of things it can then be easier to see how you want to manipulate and that is where the coding exercise begins. Are you an experienced IT person? Learning proper db design is a good thing - do seme reading on proper normalization of databases. Are you a programmer? If not you definitely need to do some reading up on php and how it works. Will save you an immense amount of time if you start by learning and not by coding. 1 Quote Link to comment Share on other sites More sharing options...
edlentz Posted September 11, 2016 Author Share Posted September 11, 2016 ginerjm, I do have some limited experience in setting up a dB and some PHP writing. I will take your comments to heart and start on the process of designing it and then implementing it. I was looking for some guidance for just manipulating and editing a text file. But clearly that is getting the cart before the horse. Thank you Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 11, 2016 Share Posted September 11, 2016 Manipulating a text file? How is that related to a website? You're going to let them upload their data in a file? Quote Link to comment Share on other sites More sharing options...
edlentz Posted September 12, 2016 Author Share Posted September 12, 2016 I have not explained the ful scope of my project. What I need is to create these config files for the phones on a LAMP based VoIP phone system. the installer needs to be able to "create" the templates and then assign them to the phone files. ALL the programming for the phone system is done from a webserver on the phone system itself. The phones when they boot up look for a TFTP server and query it for the file based on the MAC address of the phone. The phone then downloads the file and is configured by that file. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 12, 2016 Share Posted September 12, 2016 And you expect outside help to assist you? Good luck. Quote Link to comment Share on other sites More sharing options...
ignace Posted September 12, 2016 Share Posted September 12, 2016 I assume the TFTP server is the CentOS6 server on which you will also host the PHP code? You can write files with: file_put_contents You can read the file with: file use explode to separate Button6 and BLF, and Button6value and 103. At this point you have the data from the file in an array and you can generate an interface for the user to change the function of each button. Quote Link to comment Share on other sites More sharing options...
edlentz Posted September 12, 2016 Author Share Posted September 12, 2016 Ginerjm Thank you for all your help in guiding me toward my goal. I do not believe I asked for anyone to do this for me. Ignace Yes the tftp server is on the same server as the PHP code. I will check out those functions. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.