Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions dvwa/css/help.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,23 @@ span.spoiler {
background-color: black;
color: black;
}

/* === Dark theme === */
body.dark {
background: #2f2f2f;
color: #f8fafa;
}

body.dark a {
color: #99cc33;
}

body.dark div#code {
background-color: #2f2f2f;
color: #f8fafa;
}

body.dark table {
background-color: #2f2f2f;
border: none !important;
}
37 changes: 37 additions & 0 deletions dvwa/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ div#container {
}

div#header {
position: relative;
padding: 10px;
overflow: hidden;
background: #2f2f2f;
Expand Down Expand Up @@ -296,3 +297,39 @@ span.failure {
color:red;
font-weight: bold;
}

.theme-icon {
position: absolute;
right: 0;
}

.theme-icon img {
height: 32px;
width: 32px;
}


/* === Dark theme === */
body.home.dark {
background: #2f2f2f;
color: #f8fafa;
}

body.home.dark #container,
body.home.dark #main_menu,
body.home.dark #main_body,
body.home.dark #system_info {
background: #2f2f2f;
}

body.home.dark .vulnerable_code_area {
background: #2f2f2f;
}

body.home.dark .message {
background-color: #2f2f2f;
}

body.home.dark div#guestbook_comments {
background-color: #2f2f2f;
}
18 changes: 18 additions & 0 deletions dvwa/css/source.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ div#area {
color: #a50a0a;
}

/* === Dark theme === */
body.dark {
background: #2f2f2f;
color: #f8fafa;
}

body.dark a {
color: #99cc33;
}

body.dark div#code {
background-color: #bdbdbd;
}

body.dark table {
background-color: #2f2f2f;
border: none !important;
}
Binary file added dvwa/images/theme-light-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 14 additions & 4 deletions dvwa/includes/dvwaPage.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@
}


function dvwaThemeGet() {
if (isset($_COOKIE['theme'])) {
return $_COOKIE[ 'theme' ];

Check failure

Code scanning / PHP Security Analysis

Detected tainted HTML: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo. Error

Detected tainted HTML: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo.

Check failure

Code scanning / PHP Security Analysis

Detected tainted text with possible quotes: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo. Error

Detected tainted text with possible quotes: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo.

Check failure

Code scanning / PHP Security Analysis

Detected tainted HTML: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo. Error

Detected tainted HTML: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\ncall to echo.

Check failure

Code scanning / PHP Security Analysis

Detected tainted text with possible quotes: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo. Error

Detected tainted text with possible quotes: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\ncall to echo.

Check failure

Code scanning / PHP Security Analysis

Detected tainted HTML: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo. Error

Detected tainted HTML: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\ncall to echo.

Check failure

Code scanning / PHP Security Analysis

Detected tainted text with possible quotes: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\nconcat\ncall to echo. Error

Detected tainted text with possible quotes: $_COOKIE['theme']\ndvwaThemeGet\nconcat\nconcat\ncall to echo.
}
return 'light';
}


function dvwaSecurityLevelGet() {
global $_DVWA;

Expand Down Expand Up @@ -394,13 +402,15 @@

</head>

<body class=\"home\">
<body class=\"home " . dvwaThemeGet() . "\">
<div id=\"container\">

<div id=\"header\">

<img src=\"" . DVWA_WEB_PAGE_TO_ROOT . "dvwa/images/logo.png\" alt=\"Damn Vulnerable Web Application\" />

<a href=\"#\" onclick=\"javascript:toggleTheme();\" class=\"theme-icon\" title=\"Toggle theme between light and dark.\">
<img src=\"" . DVWA_WEB_PAGE_TO_ROOT . "dvwa/images/theme-light-dark.png\" alt=\"Damn Vulnerable Web Application\" />
</a>
</div>

<div id=\"main_menu\">
Expand Down Expand Up @@ -463,7 +473,7 @@

</head>

<body>
<body class=\"" . dvwaThemeGet() . "\">

<div id=\"container\">

Expand Down Expand Up @@ -499,7 +509,7 @@

</head>

<body>
<body class=\"" . dvwaThemeGet() . "\">

<div id=\"container\">

Expand Down
6 changes: 6 additions & 0 deletions dvwa/js/dvwaPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ with (thisform) {
function confirmClearGuestbook() {
return confirm("Are you sure you want to clear the guestbook?");
}

function toggleTheme() {
document.body.classList.toggle('dark');
const theme = document.body.classList.contains('dark') ? 'dark' : 'light';
document.cookie = "theme=" + theme + "; path=/";
}
Loading