Changeset 14209 for trunk/FACT++/www/smartfact
- Timestamp:
- 06/22/12 10:05:19 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/smartfact/index.php
r14141 r14209 2 2 3 3 require_once("config.php"); 4 5 function escape($msg) 6 { 7 $msg = str_replace("\\", "\\\\", $msg); 8 $msg = str_replace('\"', '\"', $msg); 9 return $msg; 10 } 4 11 5 12 function login() … … 86 93 fwrite($file, 87 94 date("Y-m-d H:i:s\t").$addr. 88 "\t".$dns.89 "\t".$user.90 95 "\t".$info->Platform. 91 96 "\t".$info->Browser. 92 97 "\t".$info->Version. 93 "\t".$info->isMobileDevice."\n"); 98 "\t".($info->isMobileDevice?"mobile":""). 99 "\t".$user. 100 "\t".$dns."\n"); 94 101 fclose($file); 102 103 // http://ip-address-lookup-v4.com/ip/92.205.118.219 95 104 96 105 return; … … 152 161 } 153 162 163 $msg = ""; 164 if (isset($_GET['msg'])) 165 { 166 if ($_GET['msg']>=0) 167 $msg = $_GET['msg']; 168 unset($_GET['msg']); 169 } 170 154 171 // Arguments 155 172 foreach ($_GET as $key => $value) 156 $args .= ' --arg:"'.$key.'='.$value.'"'; 157 158 // $args = "filename":label --arg:"key1=value" --arg:"key2=value" 159 $cmd = $path.'/dimctrl --user "'.$_SERVER['PHP_AUTH_USER'].'" --start '.$args; 160 161 // Execute 162 $str = exec($cmd, $out, $rc); 173 $args .= ' --arg:"'.$key.'='.escape($value).'"'; 174 175 if (!empty($args) && empty($msg)) 176 { 177 // $args = "filename":label --arg:"key1=value" --arg:"key2=value" 178 $cmd = $path.'/dimctrl --user "'.$_SERVER['PHP_AUTH_USER'].'" --start '.$args; 179 180 // Execute 181 $str = exec($cmd, $out, $rc); 182 183 // Logging (mainly for debugging) 184 $d = date("Y/m"); 185 186 $path = "log/".$d; 187 188 if (!file_exists($path)) 189 mkdir($path, 0777, true); 190 191 $file = fopen($path."/exec.log", "a"); 192 fwrite($file, $cmd."\n".$str."\n\n"); 193 fclose($file); 194 } 195 196 if (!empty($msg)) 197 { 198 $msg = escape($msg); 199 200 // $args = "filename":label --arg:"key1=value" --arg:"key2=value" 201 $cmd = $path.'/dimctrl --user "'.$_SERVER['PHP_AUTH_USER'].'" --msg "'.$msg.'"'; 202 203 // Execute 204 $str = exec($cmd, $out, $rc); 205 } 206 207 // ------------------------------------------- 208 163 209 } 164 210
Note:
See TracChangeset
for help on using the changeset viewer.