test code

This commit is contained in:
Filip Rojek 2023-04-16 12:32:07 +02:00
parent 37c281a25d
commit 79331ce222
3 changed files with 14 additions and 2 deletions

View File

@ -8,3 +8,10 @@
## To run using Docker ## To run using Docker
- ToDo - ToDo
## To Do
- [ ] Docker
- [ ] kopirovani PGP na click opravit
- [ ] projekty page css
- [ ] contact page odesilani mailu
- [ ] contact page pridat odkazy na dalsi soc site (github atd)

View File

@ -22,9 +22,9 @@ class Mail {
if (gettype($this->message) == 'string') { if (gettype($this->message) == 'string') {
if(mail($this->to, $this->subject, $this->message, $this->headers)) { if(mail($this->to, $this->subject, $this->message, $this->headers)) {
return 0; return true;
} else { } else {
return 1; return false;
} }
} }
} }

View File

@ -47,8 +47,13 @@ if(isset($_POST['email']) && isset($_POST['message'])) {
$m = new Mail($_POST['email'], 'webmaster@filiprojek.cz', 'Nová zpráva z webu filiprojek.cz', $message); $m = new Mail($_POST['email'], 'webmaster@filiprojek.cz', 'Nová zpráva z webu filiprojek.cz', $message);
if($m->send()) { if($m->send()) {
console_log("zprava odeslana");
console_log("zprava:");
console_log($m);
header('Location: /?sent=true'); header('Location: /?sent=true');
} else { } else {
console_log("zprava neodeslana");
console_log($m);
echo "<p>Něco se nepovedlo, zkuste to znovu... :(</p>"; echo "<p>Něco se nepovedlo, zkuste to znovu... :(</p>";
echo "<a href='/'>Zpět</a>"; echo "<a href='/'>Zpět</a>";
} }