Portal Home > Knowledgebase > Articles Database > Need some inputs on my upcoming invoice system, [php][mysql]


Need some inputs on my upcoming invoice system, [php][mysql]




Posted by Fallzone, 08-16-2007, 09:17 AM
Hello all , Im about to start coding on my invoice system, and im in need of some help/inputs. First of all i will show you how my servers are built up. http://www.seominds.com/server-setup.jpg Software Webpage1, webpage2, webpage3 are three different servers with three different webpages which stores invoices localy on each server. Each of the webpages sell some kind of service (premium member etc). Then we have my invoice server which will collect all invoices from each server once per day and put them in a queue table. This means that all invoices end up in correct line (dates etc). If one of the webpages goes down the invoice server halts and will continue to connect to the crashed server to gather the missing invoices. If it succeeds to gather all invoices from all webservers it will start generating invoice numbers to all invoices and email em to the ones who payed. Questions and problematics What should i use to gather all invoice data? best coding way I could write my own API but that's something really new to me maybe point me somewhere? I could go for direct sql connections between the servers, what security risks are there? Im planing to code it in php5 on the invoice server with mysql5 but all the other servers run php4 and mysql4, could be a problem? Im planing to buy a Pentium 4 2.4Ghz 1GBRam 750Gb bandwidth, this is just for the invoice system. Nothing else should be on it and its not more than 120 invoices per month. I have never used a P4 before is it stable? Ive always ran Dual Xeon or WoodCrest but i dont feel like paying that much for such a small system. I would greatly appreciate ideas and inputs , i hope my post makes sence cuz english is my second language. Best Regards Jawn

Posted by Codelphious, 08-18-2007, 01:47 AM
Why not simply have each of the webpage servers send the invoices directly to the invoice server immediately after they're processed? Otherwise, you're powerful invoice server will sit idle all day long, except when it gets to process invoices for 8 (or less) seconds. As for your questions: Each of the methods you mentioned will work about equally as well. Most control panels, such as cPanel, will allow you to define the IP address of systems that are allowed to connect to the database. Of course, you still must authenticate with your Username/Password. Writing your own API has its perks, though. For example, you could add in additional security measures such as processing the request using SSL (through cURL), encrypting data, limiting access through IP restriction, passwords, etc. If you do decide to go the API route, what I have found is that the best way to transmit data from server to server (when using PHP on both ends) is to create Arrays of data, serialize them, then base64 encode them. You can then send this as a field/value pair using cURL to a script on a remote server and unpack it by base64 decoding, then unserializing and *poof* you've got the exact same array to work with! I hope this helped. By the way, you're English is very good!

Posted by Fallzone, 08-21-2007, 07:13 AM
Thanks for great inputs Codelphious makes me happy. Do you think theres a security risk to use direct sql queries? i mean it will still require verfication (username password) it would be if someone were listening on the traffic somehow. And about the api someone told me to use $_POST to get the invoice information but im not sure what he meant. Maybe you do? Best Regards Fallzone

Posted by Steve_Arm, 08-21-2007, 07:19 AM
You would use POST if the action happened on a button click. Like a form. But in this case you will make GET requests, most simple in a REST kind of API. Although you can use post with the help of javscript.

Posted by Codelphious, 08-21-2007, 11:13 AM
In my description I suggested having the webpage servers send the invoices to the invoice server when they are ready. You would likely use POST for this, rather than GET, because you're sending data from one place to another instead of fetching it. Depending on your implementation using GET instead of POST will work just as well. POST does not have to happen on a button click. You can use the cURL library to create POSTs through your script, if you're using PHP. Technically POST is for sending data, GET is for fetching data, UPDATE is for updating data, DELETE is for deleting data.

Posted by Steve_Arm, 08-21-2007, 11:23 AM
Correct cURL can POST. Your implementation sends, but his, requests data, that's why I proposed GET.

Posted by Codelphious, 08-21-2007, 11:29 AM
Yes, but as I explained my suggestion for his implementation involves using POST since it is theoretically the correct protocol for the situation I described. I just thought you response was a bit misleading, suggestion POST is used merely on button clicks or with javascript

Posted by Steve_Arm, 08-21-2007, 11:32 AM
Codelphious, with all the knowledge I stuck to my brain each day I tend to forget some times.

Posted by Fallzone, 08-21-2007, 11:41 AM
I need to have the invoice server to collect all new invoices cuz lets say i have 5 server reporting to the invoice server and one server fails to send the new invoices for 1 or 2 days. There becomes one problem on each invoice that comes to the invoice server gets assigned a number which is in serial. So there will be a problem in the serial line with the dates and much much more work when entering a profit. But i have not really understood how the $_GET or $_POST would work, i have used it tons but having a hard time to see the code infront of me. Could you guys just show a simple code? I really appreciate all the time you guys put into this. Best Regards Fallzone

Posted by Steve_Arm, 08-21-2007, 12:03 PM
Server collecting data: Server sending data:

Posted by Fallzone, 08-22-2007, 08:30 AM
Thanks alot Steve Arm you got me on the right track.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Knownhost Review (Views: 861)
Recommend a Firewall? (Views: 813)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.