Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sat Mar 25, 2017 12:27 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: two code error under 0.8.8 about device template and userlog
PostPosted: Tue Jun 01, 2010 11:48 pm 
Offline

Joined: Tue Jun 01, 2010 11:38 pm
Posts: 6
Location: China
1. Device Template can not be shown:
2. cacti.log show a ERROR "06/01/2010 08:26:39 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1064', SQL:"INSERT INTO user_log (username,user_id,result,ip,time) VALUES ("admin',1',1',172.17.15.120',NOW())'"

I've resolved at local side, code diff as below:

diff --git a/device_templates.php b/device_templates.php
index bfc688e..b0b53f7 100644
--- a/device_templates.php
+++ b/device_templates.php
@@ -1095,7 +1095,7 @@ function device_template_display_dq($device_template, $header_label) {
print "<form method='post' action='" . basename($_SERVER["PHP_SELF"]) . "' name='device_template_dq_edit'>\n";
html_start_box("<strong>" . __("Associated Data Queries") . " $header_label</strong>", "100", "0", "center", "", true);
print "<tr><td>";
- html_header(array(array("name" => __("Data Query Name")), array("name" => __("Re-Index Method")))), 2);
+ html_header(array(array("name" => __("Data Query Name")), array("name" => __("Re-Index Method"))), 2);

/* list all data queries that are currently associated */
$selected_data_queries = db_fetch_assoc("SELECT " .
diff --git a/lib/api_rrd.php b/lib/api_rrd.php
old mode 100755
new mode 100644
diff --git a/lib/functions.php b/lib/functions.php
index 160bccf..93cdf2c 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -2553,9 +2553,9 @@ function debug_log_return($type) {
function user_log_insert($userid, $username, $result) {
db_execute('INSERT INTO user_log ' .
'(username,user_id,result,ip,time) VALUES (' .
- '"' . $username . "'," .
- $userid . "'," .
- $result . "'," .
+ "'" . $username . "','" .
+ $userid . "','" .
+ $result . "','" .
$_SERVER["REMOTE_ADDR"] . "'," .
"NOW())");
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2010 2:32 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Thanks, both are in.
Please refer to your SVN version when posting more fixes :wink:
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Haha!, (TheWitness) broken again
PostPosted: Sun Jun 27, 2010 10:15 pm 
Offline

Joined: Tue Jun 01, 2010 11:38 pm
Posts: 6
Location: China
5953 gandalf function user_log_insert($userid, $username, $result) {
5953 gandalf db_execute('INSERT INTO user_log ' .
5953 gandalf '(username,user_id,result,ip,time) VALUES (' .
5979 thewitness "'" . $username . "'," .
5968 gandalf $userid . "','" .
5968 gandalf $result . "','" .
5953 gandalf $_SERVER["REMOTE_ADDR"] . "'," .


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2010 11:38 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Fixed
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group