Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- home.php
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width initial-scale=1 maximum-scale=1">
- </head>
- <body>
- <?php
- include ("msg.txt");
- ?>
- <div id="msg">
- <form action="send.php" method="post">
- Imię/Nick : <input type="text" id="username" name="username" /><br />
- Wiadomość : <br /> <textarea name="message" rows="10" cols="30"></textarea><br /> <br />
- <input type="submit" value="Wyślij">
- <input type="reset" value="Wyczyść">
- </form>
- </div>
- </body>
- </html>
- send.php
- <?php
- $username=htmlspecialchars($_POST['username']);
- $message=htmlspecialchars($_POST['message']);
- $data= date("d/m/Y H:i:s");
- $msg= "msg.txt";
- if ($username=="") {
- echo "Wpisz swoje imię lub nick";
- } elseif ($message=="") {
- echo "Wpisz wiadomość";
- } else {
- $guestbook = fopen($msg,"a");
- $txt='<div id="msg">Autor wpisu: '.$username.'<br /><br />';
- $txt .='Wpis: '.$message. '<br /><br />';
- $txt .="Wysłano: ".$data.'</div>';
- fwrite($guestbook, $txt);
- fclose($guestbook);
- echo '<a href="home.php">Powrót</a>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement