Skip to content

Commit 84da38a

Browse files
committed
Only check if PHPIDS file can be written if it is enabled
1 parent c347084 commit 84da38a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

security.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,17 @@
6262
}
6363

6464
$phpIdsHtml = 'PHPIDS is currently: ';
65+
66+
// Able to write to the PHPIDS log file?
67+
$WarningHtml = '';
68+
6569
if( dvwaPhpIdsIsEnabled() ) {
6670
$phpIdsHtml .= '<em>enabled</em>. [<a href="?phpids=off">Disable PHPIDS</a>]';
71+
72+
# Only check if PHPIDS is enabled
73+
if( !is_writable( $PHPIDSPath ) ) {
74+
$WarningHtml .= "<div class=\"warning\"><em>Cannot write to the PHPIDS log file</em>: ${PHPIDSPath}</div>";
75+
}
6776
}
6877
else {
6978
$phpIdsHtml .= '<em>disabled</em>. [<a href="?phpids=on">Enable PHPIDS</a>]';
@@ -72,13 +81,6 @@
7281
// Anti-CSRF
7382
generateSessionToken();
7483

75-
// Able to write to the PHPIDS log file?
76-
$WarningHtml = '';
77-
if( !is_writable( $PHPIDSPath ) ) {
78-
$WarningHtml .= "<div class=\"warning\"><em>Cannot write to the PHPIDS log file</em>: ${PHPIDSPath}</div>";
79-
}
80-
81-
8284
$page[ 'body' ] .= "
8385
<div class=\"body_padded\">
8486
<h1>DVWA Security <img src=\"" . DVWA_WEB_PAGE_TO_ROOT . "dvwa/images/lock.png\" /></h1>

0 commit comments

Comments
 (0)