![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2007
Posts: 26
Rep Power: 0
![]() |
Question regarding data input into PHP/Mysql using something other than GET
Hi all,
This is kinda more of a general question than simply a PHP question... I'm fairly decent at PHP and BASIC (I use Freebasic to make simple .exe console apps) I'm struggling at learning C or C++ - basic just works whereas there are different header files with every tutorial / compiler I get so I'm getting a bit lost. I haven't had any formal programming training yet so please bear with my stupidity. Anyway, I have a PHP/MySQL based database system here at work that logs all PC info into the database, in this kind of format to give you an idea: sql Syntax (Toggle Plain Text)
as you may have guessed each machine runs AIDA32 in their logon script, which is the old freeware version of Lavalys Everest and it reports all the hardware info back to CSV files I have on a NAS server... Every now and then I run a Freebasic EXE that converts all the data in the CSV files into a workable .sql file that I import into my server. (I know how bad of a practice this is but we're very busy here and I find it hard to find the time to learn new languages etc.) Also as you can see I split certain fields like 'hdd' into sepearate parts using a seperator like £ and/or ; - if you check the SQL above you'll see what I mean. Then I could explode that info into an array for easier use in my PHP. That works a charm currently. Ok so that's the way it currently works and I have a web-based interface so everybody here in our I.T. department can search for info by pc, or by hostname or by whatever. I have built up many handy SQL queries from the info and even a custom SQL query page so they can do custom queries on the info. We deal with just over 600 PCs in the building so nothing too crazy. I thought that I should change it to make it dynamic so I don't have to run the exe or schedule it to run but instead, every time a PC logs on it reports directly back to the web server using the console version of curl or whatever. My latest work on this involved this sort of code php Syntax (Toggle Plain Text)
and using curl -0 http://mylocalwebserver/newinfo/date...o/hostnameinfo etc etc. etc. But as you remember from the SQL before I would be passing a fair amount of data and also there are some strange characters in the data so I'm wondering if there's a more effective / efficient way to get this data from AIDA .csv form to the server itself? The reason I'm not using ODBC on the clients is because we have a mixed environment with NT/2k/XP machines and I prefer to stick to what I know works, like AIDA for example works on all three platforms as does good old freebasic executables and text files (CSV) etc. So to reiterate my question I'm wondering should I have the text files go to the web server and run some command line PHP that puts the data into the MySql server or maybe even an ODBC link on the server that a Freebasic or simple C++ program that loops and takes each new text file in and puts the info directly into the MySql server and then deletes the text files when it's done. Or should I stick with curl and work out my character problems by using simpler characters? I just get the feeling that passing all the data through the URL is bad practice. I had also considered there may be a way to bypass curl and send the data using some sort of C++ program using POST rather than GET... Also I was wondering how simple would it be to write a C++ or C program to extract the info from the BIOS (the info I'm currently using AIDA32 for) I know it's a lot of questions and I probably have most of this wrong but I'm looking for how a real programmer would do this as I usally fart out some basic+php and meld it all together with sticky tape and hope for the best :-D Thanks for reading all this.... |
|
|
|
|
|
#2 | ||
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Question regarding data input into PHP/Mysql using something other than GET
You might want to have a look at something like this. Some applicable quotes:
Quote:
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
||
|
|
|
|
|
#3 |
|
Newbie
Join Date: Nov 2007
Posts: 26
Rep Power: 0
![]() |
Re: Question regarding data input into PHP/Mysql using something other than GET
Thanks for that... looks very good.. except for the fact that it costs money and we are just one building of many around the country (Ireland) and in order for us to buy software there would be a lot of red tape etc. etc.... also this is a learning exercise for me so I'm just wondering how somebody would do this with only PHP and BASIC or PHP and C/C++ if you had no other choice...
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Question regarding data input into PHP/Mysql using something other than GET
The cost per machine for that is relatively trivial. If I were in your position, I'd investigate it thoroughly. If it wasn't sufficient, or circumstances prevented me using a third party product, or I had no choice, then I'd solve the problem on my own, even though I'd be reinventing the wheel.
I don't believe your problem is getting system information. There are dozens of things that do that, and code snippets all over the web explaining the process. Platform agnosticism complicates the problem, of course. I also don't believe your problem is getting the information into the database. You are, in fact, already doing all that in a roundabout way. So let's investigate your "How would I improve this" question. There is, for instance, a program that gets system information and presents it in a HTML form. You could write one of those. The form goes to the server via POST. Your server-side code (PHP, C++, whatever) picks that up, massages any fields you like to modify (split up, combine, reformat, whatever), and sticks that into the database.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Nov 2007
Posts: 26
Rep Power: 0
![]() |
Re: Question regarding data input into PHP/Mysql using something other than GET
Ok... I think I get you. I'll look into HTML forms more closely as the PHP side of it is no problem to me. and then I can use POST instead of GET... I also wanted that for security reasons. I might include PHP sessions and MD5 or SHA1 encryption too.. (not too sure if the sessions bit is needed but u get the idea). But then only if I'm not too lazy :-D thanks again for your help I'll reply again when I get it done.
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: Nov 2007
Posts: 26
Rep Power: 0
![]() |
Re: Question regarding data input into PHP/Mysql using something other than GET
Ok so I'm getting into this and it seems to be working fine but I'm having problems with the foreach command...
When I get the info from a MySQL database I usually use the following command to assign a variable to each value: php Syntax (Toggle Plain Text)
php Syntax (Toggle Plain Text)
I could do it the long way with like 20 conditions but I want to get more efficient in my programming. |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Nov 2007
Posts: 26
Rep Power: 0
![]() |
Re: Question regarding data input into PHP/Mysql using something other than GET
I've started a new thread for this (sorry I had hoped to remove the above post but I must be out of time) anyhow the new thread is here:
http://www.programmingforums.org/post137196.html |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Data getting question | quantalfred | Coder's Corner Lounge | 8 | Jul 22nd, 2006 2:39 AM |
| how do i automate text data and input into database? | lionel84 | C# | 0 | Jun 26th, 2005 9:35 PM |