Changeset 17373 for trunk/FACT++/www/smartfact
- Timestamp:
- 11/25/13 19:49:20 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/smartfact/index.php
r17023 r17373 67 67 return "Sorry, your credentials don't match!"; 68 68 } 69 70 function execute($cmd, $out) 71 { 72 // Execute 73 $str = exec($cmd, $out, $rc); 74 75 // Logging (mainly for debugging) 76 $d = date("Y/m"); 77 $path = "log/".$d; 78 79 if (!file_exists($path)) 80 mkdir($path, 0777, true); 81 82 $file = fopen($path."/exec.log", "a"); 83 84 fwrite($file, $cmd); 85 fwrite($file, "\n"); 86 if ($rc>0) 87 fwrite($file, print_r($out,true)."\n"); 88 fwrite($file, "\n"); 89 90 fclose($file); 91 92 return $rc; 93 } 94 69 95 // -------------------------------------------------------------------- 70 96 … … 190 216 191 217 if (isset($_GET['stop'])) 192 $str = exec($path."/dimctrl --user '".$_SERVER['PHP_AUTH_USER']."' --stop", $out, $rc); 218 { 219 unset($_GET['stop']); 220 221 $cmd = $path."/dimctrl --no-log --user '".$_SERVER['PHP_AUTH_USER']."' --stop 2>&1"; 222 223 $rc = execute($cmd, $out); 224 } 193 225 194 226 if (isset($_GET['start'])) … … 232 264 233 265 // $args = "filename":label --arg:"key1=value" --arg:"key2=value" 234 $cmd = $path.'/dimctrl --user "'.$_SERVER['PHP_AUTH_USER'].'" --start '.escapeshellarg($script.$args); 235 236 // Execute 237 $str = exec($cmd, $out, $rc); 238 239 // Logging (mainly for debugging) 240 $d = date("Y/m"); 241 $path = "log/".$d; 242 if (!file_exists($path)) 243 mkdir($path, 0777, true); 244 $file = fopen($path."/exec.log", "a"); 245 fwrite($file, $cmd."\n".$str."\n\n"); 246 fclose($file); 266 $cmd = $path.'/dimctrl --no-log --user "'.$_SERVER['PHP_AUTH_USER'].'" --start '.escapeshellarg($script.$args). " 2>&1"; 267 268 $rc = execute($cmd, $out); 247 269 } 248 270 … … 252 274 253 275 // $args = "filename":label --arg:"key1=value" --arg:"key2=value" 254 $cmd = $path.'/dimctrl --user "'.$_SERVER['PHP_AUTH_USER'].'" --msg '.escapeshellarg($msg); 255 256 // Execute 257 $str = exec($cmd, $out, $rc); 258 259 // Logging (mainly for debugging) 260 $d = date("Y/m"); 261 $path = "log/".$d; 262 if (!file_exists($path)) 263 mkdir($path, 0777, true); 264 $file = fopen($path."/exec.log", "a"); 265 fwrite($file, $cmd."\n".$str."\n\n"); 266 fclose($file); 276 $cmd = $path.'/dimctrl --no-log --user "'.$_SERVER['PHP_AUTH_USER'].'" --msg '.escapeshellarg($msg)." 2>&1"; 277 278 $rc = execute($cmd, $out); 267 279 } 268 280 … … 285 297 $args .= ' "'.$key.'"="'.$value.'"'; 286 298 287 $cmd = $path.'/dimctrl --user "'.$_SERVER['PHP_AUTH_USER'].'" --interrupt '.escapeshellarg($irq.$args); 288 289 // Execute 290 $str = exec($cmd, $out, $rc); 291 292 // Logging (mainly for debugging) 293 $d = date("Y/m"); 294 $path = "log/".$d; 295 if (!file_exists($path)) 296 mkdir($path, 0777, true); 297 $file = fopen($path."/exec.log", "a"); 298 fwrite($file, $cmd."\n".$str."\n\n"); 299 fclose($file); 299 $cmd = $path.'/dimctrl --no-log --user "'.$_SERVER['PHP_AUTH_USER'].'" --interrupt '.escapeshellarg($irq.$args)." 2>&1"; 300 301 $rc = execute($cmd, $out); 300 302 } 301 303
Note:
See TracChangeset
for help on using the changeset viewer.