forked from tylda-public/main
		
	Merge pull request 'register form draft' (#1) from feature/register-form into main
Reviewed-on: tylda-public/main#1 Reviewed-by: v0id1st <v0id1st@tylda.org>
This commit is contained in:
		
						commit
						e6b84035e1
					
				
							
								
								
									
										42
									
								
								register.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								register.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,42 @@
 | 
			
		||||
<?php
 | 
			
		||||
include 'header.php';
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
Poniższy formularz trafi do naszych administratorów, którzy go ocenią. Potraktuj go częściowo jako antyspam. Chcemy sensownych odpowiedzi na poniższe pytania. Posiadanie własnej strony też jest na duży plus.
 | 
			
		||||
<form action="register_post.php" method="POST">
 | 
			
		||||
<div class="form-row">
 | 
			
		||||
    <label>Email*</label>
 | 
			
		||||
    <input name="email" type="email" required>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-row">
 | 
			
		||||
    <label>Nick*</label>
 | 
			
		||||
    <input name="nick" type="string" min=3 max=20 pattern="[a-zA-Z0-9]+" required>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-row">
 | 
			
		||||
    <label>Strona WWW</label>
 | 
			
		||||
    <input name="url" type="url">
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-row">
 | 
			
		||||
    <label>Jak do nas trafiłeś?</label>
 | 
			
		||||
    <select name="how" required>
 | 
			
		||||
	<option selected></option>
 | 
			
		||||
	<option>komunikator (np. matrix, irc, xmpp)</option>
 | 
			
		||||
	<option>wyszukiwarka</option>
 | 
			
		||||
	<option>tildeeverse.org</option>
 | 
			
		||||
	<option>promocja w internecie</option>
 | 
			
		||||
	<option>polecenie</option>
 | 
			
		||||
	<option>inne</option>
 | 
			
		||||
    </select>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-row">
 | 
			
		||||
    <label>Zainteresowania</label>
 | 
			
		||||
    <textarea name="interests" maxlength=1000></textarea>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-row">
 | 
			
		||||
    <label>Opowiedz coś na swój temat</label>
 | 
			
		||||
    <textarea name="who" rows=8 maxlength=1000"></textarea>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-row">
 | 
			
		||||
<button type="submit">Submit</button>
 | 
			
		||||
</div>
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										38
									
								
								register_post.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								register_post.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
<?php
 | 
			
		||||
include 'header.php';
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<article>
 | 
			
		||||
Hej 
 | 
			
		||||
<strong>
 | 
			
		||||
<?= htmlspecialchars($_POST['nick']); ?>
 | 
			
		||||
</strong>!
 | 
			
		||||
<br><br>
 | 
			
		||||
Otrzymaliśmy twój formularz rejestracji. Oczekuj na dalsze informacje na swojej skrzynce mailowej. :) Odpowiedź może potrwać kilka dni, w zależności od oczekującej liczby użytkowników.
 | 
			
		||||
</article>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
    $nick=htmlspecialchars($_POST["nick"]);
 | 
			
		||||
    $email=htmlspecialchars($_POST["email"]);
 | 
			
		||||
    $url=htmlspecialchars($_POST["url"]);
 | 
			
		||||
    $who=htmlspecialchars($_POST["who"]);
 | 
			
		||||
    $how=htmlspecialchars($_POST["how"]);
 | 
			
		||||
    $interests=htmlspecialchars($_POST["interests"]);
 | 
			
		||||
 | 
			
		||||
    $to      = 'smoorg@tylda.org';
 | 
			
		||||
    $subject = 'Rejestracja usera' . "$nick";
 | 
			
		||||
    $message = "Nick: $nick\n" . 
 | 
			
		||||
	"Email: $email\n" .
 | 
			
		||||
	"Url: $url\n" .
 | 
			
		||||
	"Opowiedz coś na swój temat: $who\n" .
 | 
			
		||||
	"Jak do nas trafiłeś?: $how\n" .
 | 
			
		||||
	"Zainteresowania: $interests\n"
 | 
			
		||||
	;
 | 
			
		||||
    $headers = array(
 | 
			
		||||
        'From' => 'noreply@tylda.org',
 | 
			
		||||
        'Reply-To' => 'noreply@tylda.org',
 | 
			
		||||
        'X-Mailer' => 'PHP/' . phpversion()
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    mail($to, $subject, $message, $headers);
 | 
			
		||||
?>
 | 
			
		||||
@ -113,3 +113,30 @@ pre.ascii {
 | 
			
		||||
  font-family: monospace;
 | 
			
		||||
  white-space: pre;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form-row {
 | 
			
		||||
  display: flex;
 | 
			
		||||
  justify-content: flex-end;
 | 
			
		||||
  padding: .5em;
 | 
			
		||||
}
 | 
			
		||||
.form-row > label {
 | 
			
		||||
  padding: .5em 1em .5em 0;
 | 
			
		||||
  flex: 1;
 | 
			
		||||
}
 | 
			
		||||
.form-row > input,
 | 
			
		||||
.form-row > select,
 | 
			
		||||
.form-row > textarea {
 | 
			
		||||
  flex: 2;
 | 
			
		||||
  padding: .5em
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form-row > button:hover {
 | 
			
		||||
  background: var(--main);
 | 
			
		||||
 }
 | 
			
		||||
.form-row > button {
 | 
			
		||||
  padding: .5em;
 | 
			
		||||
  background: var(--link);
 | 
			
		||||
  color: white;
 | 
			
		||||
  border: 0;
 | 
			
		||||
  padding: 1rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user