MySQL integration
mcotton
Posts: 38
I am working on remote logging using php and mysql. I am interested in re-inventing the wheel because we have multiple clients to monitor and this also allows for easy remote monitoring. Custom reports could be generated by customer ID, range of dates, sub-system, or any combination.
I would like to open this up to the community and get feedback.
This URL is subject to change so please PM if it isn't working.
I don't have a master in front of my to test with but it should be trivial to use IP_CLIENT_OPEN
To add a record into the database use this URL:
http://mcottondesign.com/Fuller/AMX_insert.php?f1=Testing&f2=Security&f3=howdy
replace value associated with f1 with the customer ID
replace value associated with f2 with the sub-system generating the event
replace value associated with f3 with the event
If you are adding spaces you'll need to have make it a valid URL by using %20
You can see the current database at:
http://mcottondesign.com/Fuller/AMX_syslog.php
For more information google sql injection.
I would like to open this up to the community and get feedback.
This URL is subject to change so please PM if it isn't working.
I don't have a master in front of my to test with but it should be trivial to use IP_CLIENT_OPEN
To add a record into the database use this URL:
http://mcottondesign.com/Fuller/AMX_insert.php?f1=Testing&f2=Security&f3=howdy
replace value associated with f1 with the customer ID
replace value associated with f2 with the sub-system generating the event
replace value associated with f3 with the event
If you are adding spaces you'll need to have make it a valid URL by using %20
You can see the current database at:
http://mcottondesign.com/Fuller/AMX_syslog.php
For more information google sql injection.
0
Comments
http://xampp.en.softonic.com/
I have modified it so that on a successful insert into the database the script with respond with 'OK' before jumping to the database view. This is very simple but I hope to help those not familiar with HTTP.
I am still making changes to it and will post the php code and mysql schema in this thread.
Here is a code example:
Then call this function with the information you want logged:
And the PHP looks similar to this:
I'm very surprised I haven't had more people playing with this. I must be on a totally different wavelength than everyone else.
For reservations, bookings fault monitoring, LON and BACKnet Conterol via OPC server, Integration with AWaya and cisco iptelephoney etc.
but these kindof projects will take a month or more to complete
DEFINE_FUNCTION CHAR[1000] USER_DATA_UPDATE () //(CHAR USERNAME[25], CHAR USERPHONE[15],CHAR USERMOBILE[15],CHAR USEREMAIL[40],CHAR USERPOBOX[10],CHAR SMSALART[3],CHAR EMAILALEART[3],CHAR FAULTREPORTING[3], CHAR DAILYBULLETIN[3],CHAR MESSAGING [3])
{
LOCAL_VAR CHAR UPDATESTR [1000]
UPDATESTR = "'http://amenities/users.asp?sql= update users set user_name=',''',
USER_INFO.USER_NAME,'%27',',%20','USER_PHONE=','%27',USER_INFO.USER_PHONE,'%27',
',%20','USER_MOBILE=','%27',USER_INFO.USER_MOBILE,'%27',',%20','USER_EMAIL=','%27',
USER_INFO.USER_EMAIL,'%27',',%20','USER_PO_BOX=','%27',USER_INFO.USER_POBOX,'%27',
',%20','USER_SMS_ALERTS=','%27',USER_INFO.USER_SMS_ALART,'%27',',%20','USER_EMAIL_ALERTS=','%27',
USER_INFO.USER_EMAIL_ALART,'%27',',%20','USER_FAULT_REPORTS=','%27',
USER_INFO.USER_FAULT_REPORT,'%27',',%20','USER_DAILY_BULLETING=','%27',
USER_INFO.USER_DAILY_BULLITIN,'%27',',%20','USER_MESSAGING=','%27',USER_INFO.USER_MASSAGING,
'%27','%20','where%20Apartment_Number=%271102%27'"
UPDATESTR = STRING_REPLACE(UPDATESTR,' ','%20')
UPDATESTR = "'GET ',UPDATESTR,' HTTP/1.0', 13, 10, 'Connection: Close', 13, 10, 13, 10"
RETURN UPDATESTR
SEND_STRING 0,UPDATESTR
}
DATA_EVENT[AMENITIES_SERVER]
{
ONERROR:
{
CLEAR_BUFFER AMENITIES_BUFFER
SEND_STRING 0, DB_GET_IP_ERROR(DATA.NUMBER)
//IP_CLIENT_CLOSE(AMENITIES_SERVER.PORT)
}
ONLINE:
{
AMENITIES_BUFFER = ''
SWITCH(PKY)
{
CASE 1:
{
IF(AME_TRACK = 6)
{
SEND_STRING AMENITIES_SERVER, CREATE_MENU_STR ()
SEND_STRING 0, "CREATE_MENU_STR (), 'this is your str'"
CALL 'CLEAR_ALL_ARRAYAS'
}
ELSE
{
SEND_STRING AMENITIES_SERVER, "URL_SENT(URL_LIST[AME_TRACK])"
}
}
CASE 2:
{
SEND_STRING AMENITIES_SERVER, ERROR_REPORTING('0',MY_IP_ADDRESS.IPADDRESS,ERROR_CODE)
SEND_STRING 0, "URL_SENT(URL_LIST[AME_TRACK])"
}
CASE 3:
{
SEND_STRING AMENITIES_SERVER, EVENT_BOOKING(THIS_ROOM_NUMBER,ORDER_FINAL[PANEL_ID].TITLE,ORDER_FINAL[PANEL_ID].EVENTDTIME,ORDER_FINAL[PANEL_ID].PRICE,ORDER_FINAL[PANEL_ID].NO_OF_TICKETS,DATE_PROCESS())
SEND_STRING 0, ERROR_REPORTING('0',MY_IP_ADDRESS.IPADDRESS,ERROR_CODE)
}
CASE 4:
{
SEND_STRING AMENITIES_SERVER, USER_DATA_UPDATE () //to update user information to database
send_string 0,USER_DATA_UPDATE ()
}
CASE 5:
{
SEND_STRING AMENITIES_SERVER,CONCIERGE_BOOKING ()
}
CASE 6:
{
SEND_STRING AMENITIES_SERVER,rESTAURANTbOOKING ()
SEND_STRING 0,rESTAURANTbOOKING ()
}
CASE 7:
{
SEND_STRING AMENITIES_SERVER,CREATE_MENU_STR()
SEND_STRING 0,CREATE_MENU_STR ()
}
}
}
OFFLINE:
{
IF(PKY <= 1 && !PROCESS)
{
PROCESS = 1
AMENITIEY_OFFLINE_PROCESS ()
WAIT 5
{
PROCESS = 0
}
}
}
}
There are lots of people playing with this, there is also a product out there that does this. (really!) It's called RMS
RMS is a fine product but didn't look like the right solution for what I was trying to do. I'm already paying for hosting with comes with Apache, PHP and MySQL so there is no incremental cost. The code was easy to write (I've made it free to the public) so that is also free.
I would prefer not to do port forwarding through a customers router to retrieve log/diagnostic information. So this could fix that.
I'm still fairly new to AMX so please let me know if I'm being naive
NetLinx masters connect outbound to the RMS server, so no port forwarding is necessary unless you want to run a WebControl or something. If you set up your RMS actions correctly, though, then you shouldn't need touchpanel to operate the room remotely.
Feel free to try it out -- you can download and install RMS without a license and experiment with up to 5 rooms. You do need a Server 2003 box to install it on, but it's happy in a virtual environment if you have one set up in Virtual PC or VMWare.
you're not being naive. RMS is a nice product, with rich functionality, but, since you are developing this for your self (right?) RMS would be over the top. Except if you can charge your customer for the cost of RMS.