diff --git a/countries_list/Dockerfile b/countries_list/Dockerfile index 86db698..da20801 100644 --- a/countries_list/Dockerfile +++ b/countries_list/Dockerfile @@ -1,4 +1,11 @@ FROM php:8.3-apache COPY src/ /var/www/html/ -ENV FLAG=CHANGEME \ No newline at end of file +ENV FLAG=CHANGEME + +COPY docker/start.sh /start.sh +COPY docker/add_flag.php /add_flag.php + + +EXPOSE 80 +ENTRYPOINT ["/start.sh"] \ No newline at end of file diff --git a/countries_list/docker/add_flag.php b/countries_list/docker/add_flag.php new file mode 100644 index 0000000..553bb8d --- /dev/null +++ b/countries_list/docker/add_flag.php @@ -0,0 +1,12 @@ +getMessage(); +} + + +$stmt = $db->prepare("INSERT INTO secret (flag) VALUES (?)"); +$stmt->execute(array(getenv("FLAG"))); diff --git a/countries_list/docker/start.sh b/countries_list/docker/start.sh new file mode 100644 index 0000000..6e653e1 --- /dev/null +++ b/countries_list/docker/start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo Add flag to database +php /add_flag.php + +echo Run main server +docker-php-entrypoint apache2-foreground \ No newline at end of file diff --git a/countries_list/src/.htaccess b/countries_list/src/.htaccess new file mode 100644 index 0000000..c5c4f94 --- /dev/null +++ b/countries_list/src/.htaccess @@ -0,0 +1,3 @@ + + Require all denied + \ No newline at end of file