Go Down

Topic: storing temperature in a database over ethernet (Read 951 times) previous topic - next topic

jfkreuter

Jun 25, 2010, 10:36 am Last Edit: Jun 25, 2010, 10:41 am by jfkreuter Reason: 1
Hey Folks, I finished the first stage of my project where i want to read temperature data and store it in a database oover ethernet. I documented everything here :http://blog.jfkreuter.com
maybe somebody is doing the same thing and can get some inspiration out of my project.
I´m somewhat proud of the code (started coding just 4 months ago ;), so feel free to give some constructive critics ;)

bld

captain-slow.dk | non contagious!

CowJam

Cool project jfkreuter!

I hadn't heard of pachube, bld.  Looks interesting.

bld

Pachube makes it super easy... just send the data to it, and it will throw charts back at you... And there are a lot of examples out on how to do that too :)
captain-slow.dk | non contagious!

jfkreuter

Hey,

I tried the code with more than one sensor and found out it won´t work this way. So i rewrote a big part of the code, and now i have 5 sensors up and running.
Means: the first code is useless for more than one sensor, but on my page there´s the new code and also the improved PHP-script.
Just wanted to inform everybody here ;)
Have fun! I really would appreciate improvements to the code and especially to the PHP (make it safe against sql-injections etc.)
And please tell me if you used my code for other projects. I really would like to see that i contributed something to the whole open-source thingie ;)

@bld: yeah, heard about pachube. I´ll try it out , but for the moment i´m very happy with my system. I dont want to be bound to an online-service and i really like what i´ve learned about linux and server-technology while building it for myself.

Greetings,

                     Jan

CowJam

The quickest way of protecting yourself from attacks would be to make the PHP check the IP of the incomming connection and ignore it if it isn't your own - presuming yours is a moderately static IP.  
You could have it email you if a bad IP tried using the upload script, that way you'd know when your IP changes.

IP is a $_SERVER variable, mail is easy to do in PHP.

There are various ways to make data 'safe'.  I'm at work and the internet is really slow here so I can't check, but there are commands like htmlentities, I think there may be a striptags, you can also use str_replace to change your field delimiter to something else (so you'd change ' and " for something else (such as their unicode equivalent or you could remove them altogether)).

jfkreuter

Hey,
I updated the code so it will work better now. I think i have to get the Arduino code stable first before i can work on the server side and secure the scripts.
I also have to figure out how to make the database relational...

Here´s the link: http://ud02_87.ud02.udmedia.de/blog/wordpress/?p=80

Have fun tinkering and dont forget to document your proceedings!

Jan

Go Up