Browse Source

Fix contact form

Léo Serre 10 months ago
parent
commit
91fa18f78c
2 changed files with 13 additions and 13 deletions
  1. 10
    10
      controllers/d.contact.php
  2. 3
    3
      views/d.contact.html

+ 10
- 10
controllers/d.contact.php View File

@@ -11,8 +11,8 @@ if(isset($_POST['submit'])) {
11 11
 	$message .= "<hr>\r\n";
12 12
 	$message .= "<pre style='padding: 10px; background: #ccc;'>".strip_tags(post('message'))."</pre><br>\r\n";
13 13
 
14
-	$headers = 'From: '. post('mail') . "\r\n" .
15
-	'Reply-To: '. post('mail') . "\r\n" .
14
+	$headers = 'From: '. post('email') . "\r\n" .
15
+	'Reply-To: '. post('email') . "\r\n" .
16 16
 	'X-Mailer: PHP/' . phpversion() . "\r\n" .
17 17
 	'MIME-Version: 1.0' . "\r\n" .
18 18
 	'Content-type: text/html; charset=UTF-8' . "\r\n"; 
@@ -27,8 +27,8 @@ if(isset($_POST['submit'])) {
27 27
 			$error = "subject";
28 28
 			$send = false;
29 29
 		}
30
-		if(post('mail') == '') {
31
-			$error = "mail";
30
+		if(post('email') == '') {
31
+			$error = "email";
32 32
 			$send = false;
33 33
 		}
34 34
 		if(post('message') == '') {
@@ -50,17 +50,17 @@ if(isset($_POST['submit'])) {
50 50
 
51 51
 if(post('name') != '')
52 52
 	$contact['name'] = post('name');
53
-else if($user->role > 0)
53
+else if($user->rankIsHigher("registered"))
54 54
 	$contact['name'] = $user->name;
55 55
 else
56 56
 	$contact['name'] = '';
57 57
 
58
-if(post('mail') != '')
59
-	$contact['mail'] = post('mail');
60
-else if($user->role > 0)
61
-	$contact['mail'] = $user->mail;
58
+if(post('email') != '')
59
+	$contact['email'] = post('email');
60
+else if($user->rankIsHigher("registered"))
61
+	$contact['email'] = $user->email;
62 62
 else
63
-	$contact['mail'] = '';
63
+	$contact['email'] = '';
64 64
 
65 65
 $contact['subject'] = post('subject');
66 66
 $contact['message'] = post('message');

+ 3
- 3
views/d.contact.html View File

@@ -16,7 +16,7 @@
16 16
 				<? if($error=="subject") { ?>
17 17
 					<p style="color: red;">Veuillez renseigner un sujet.</p>
18 18
 				<? } ?>
19
-				<? if($error=="mail") { ?>
19
+				<? if($error=="email") { ?>
20 20
 					<p style="color: red;">Veuillez renseigner une adresse mail.</p>
21 21
 				<? } ?>
22 22
 				<? if($error=="message") { ?>
@@ -33,10 +33,10 @@
33 33
 					<p style="color: green;">Message bien envoyé.</p>
34 34
 				<? } ?>
35 35
 				<input type="text" name="name" id="name" placeholder="Nom" value="<?=$contact['name']?>">
36
-				<input type="text" name="mail" id="mail" placeholder="Adresse mail" value="<?=$contact['mail']?>">
36
+				<input type="text" name="email" id="email" placeholder="Adresse mail" value="<?=$contact['email']?>">
37 37
 				<input type="text" name="subject" id="subject" placeholder="Sujet" value="<?=$contact['subject']?>">
38 38
 				<textarea name="message" id="message" rows="12" placeholder="Contenu de votre message"><?=$contact['message']?></textarea>
39
-				<? if($user->role >= 200) { ?>
39
+				<? if($user->rankIsHigher("registered")) { ?>
40 40
 					<input type="hidden" name="captcha" value="-2">
41 41
 					<input type="submit" name="submit" value="Envoyer">
42 42
 				<? } 

Loading…
Cancel
Save