Subversion Repositories ALCASAR

Rev

Rev 3139 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2990 rexy 1
<?php
2
 
3
/********************************************************************
4
*																	*
5
*			ALCASAR EMAIL INSCRIPTION								*
6
*																	*
3011 rexy 7
*	By K@M3L & T3RRY @ La Plateforme_								*
3038 rexy 8
*	By Rexy															*
2990 rexy 9
*	Partie front de la page d'inscription des utilisateurs			*
10
*	elle envoi les infos à traiter à la page de traitement			*
3009 rexy 11
*	via AJAX (email_registration_back)								*
2990 rexy 12
*																	*
13
/********************************************************************/
14
 
3183 rexy 15
/****************************************************************
16
*			GLOBAL FILE PATHS			*
17
*****************************************************************/
18
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
19
 
3026 rexy 20
$page = "email_registration";
3003 rexy 21
$Language = 'en';
22
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
23
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
24
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
25
}
3038 rexy 26
if ($Language === 'es') {	// Spanish
27
	$l_title = "Inscripción por e-mail";
28
	$l_Email = "dirección de e-mail : *";
29
	$l_mandatory = "* Campos requeridos";
30
	$l_inscription = "Inscripción";
31
	$l_mail_success = "Se ha enviado una contraseña a su dirección de correo electrónico.\\nVRevise su correo no deseado o spam, si no ve este correo en su bandeja de entrada.";
32
	$l_mail_error = "Se ha producido un error. Por favor, renueve su registro o póngase en contacto con su administrador.";
33
} else if ($Language === 'pt') {	// Portuguese
34
	$l_title = "inscrição de e-mail";
35
	$l_Email = "endereço de e-mail : *";
36
	$l_mandatory = "* Campos obrigatórios";
37
	$l_inscription = "Inscrição";
38
	$l_mail_success = "Foi enviada uma senha para o seu endereço electrónico.\\nVerifique o seu spam ou lixo electrónico, se não vir este e-mail na sua caixa de entrada.";
39
	$l_mail_error = "Ocorreu um erro. Por favor, renove o seu registo ou contacte o seu administrador.";
40
} else if ($Language === 'de') {	// German
41
	$l_title = "E-Mail-Anschrift";
42
	$l_Email = "e-mail adress : *";
43
	$l_mandatory = "* Erforderliche Felder";
44
	$l_inscription = "Aufschrift";
45
	$l_mail_success = "Ein Passwort wurde an Ihre E-Mail-Adresse gesendet.\\nPrüfen Sie Ihre Spam- oder Junk-Mail, wenn Sie diese E-Mail nicht in Ihrem Posteingang finden.";
46
	$l_mail_error = "Es ist ein Fehler aufgetreten. Bitte erneuern Sie Ihre Registrierung oder kontaktieren Sie Ihren Administrator.";
47
} else if ($Language === 'nl') {	// Dutch
48
	$l_title = "e-mail inscriptie";
49
	$l_Email = "e-mailadres : *";
50
	$l_mandatory = "* Verplichte velden";
51
	$l_inscription = "Opschrift";
52
	$l_mail_success = "Er is een wachtwoord naar uw e-mail adres gestuurd.\\nControleer uw spam of junk mail, als u deze e-mail niet in uw inbox ziet.";
53
	$l_mail_error = "Er is een fout opgetreden. Vernieuw uw registratie of neem contact op met uw beheerder.";
54
} else if ($Language === 'zh') {	// Chinese
55
	$l_title = "电子邮件题词";
56
	$l_Email = "电子邮件地址 : *";
57
	$l_mandatory = "* 必须填写";
58
	$l_inscription = "铭文";
59
	$l_mail_success = "一个密码已经发送到你的邮箱。\\n如果你在收件箱中没有看到这封邮件,请检查你的垃圾邮件或垃圾邮件。";
60
	$l_mail_error = "发生了一个错误。请更新您的注册或联系您的管理员。";
61
} else if ($Language === 'ar') {	// Arabic
62
	$l_title = "تسجيل البريد الإلكتروني";
63
	$l_Email = "عنوان البريد الالكترونى : *";
64
	$l_mandatory = "* الحقول المطلوبة";
65
	$l_inscription = "التسجيل";
66
	$l_mail_success = "تم إرسال كلمة المرور إلى عنوان البريد الإلكتروني الخاص بك.\\nتحقق من البريد العشوائي أو البريد غير الهام ، إذا كنت لا ترى هذا البريد الإلكتروني في صندوق الوارد الخاص بك.";
67
	$l_mail_error = "الرجاء تجديد التسجيل الخاص بك أو الاتصال بالمسؤول.";
68
} else if ($Language === 'fr') {
69
	$l_title = "Inscription par e-mail";
70
	$l_Email = "Adresse e-mail : *";
3139 rexy 71
	$l_mandatory = "* Champs requis";
3038 rexy 72
	$l_inscription = "Inscription";
73
	$l_mail_success = "Un mot de passe vient d'être envoyé à votre adresse e-mail.\\nVérifier vos spams ou courriers indésirables, si vous ne voyez pas cet e-mail dans votre boîte de réception.";
74
	$l_mail_error = "Une erreur s'est produite. Veuillez renouveler votre inscription ou contacter votre administrateur.";
75
} else { // english
76
	$l_title = "e-mail inscription";
77
	$l_Email = "e-mail address : *";
78
	$l_mandatory = "* Required fields";
79
	$l_inscription = "Inscription";
80
	$l_mail_success = "A password has been sent to your e-mail address.\\nCheck your spam or junk mail, if you don't see this e-mail in your inbox.";
81
	$l_mail_error = "An error has occurred. Please renew your registration or contact your administrator.";
3003 rexy 82
}
3183 rexy 83
 
84
/****************************************************************
85
*			Read CONF_FILE				*
86
*****************************************************************/
87
$file_conf = fopen(CONF_FILE, 'r');
88
if (!$file_conf) {
89
	exit('Error opening the file '.CONF_FILE);
90
}
91
while (!feof($file_conf)) {
92
	$buffer = fgets($file_conf, 4096);
93
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
94
		$tmp = explode('=', $buffer, 2);
95
		$conf[trim($tmp[0])] = trim($tmp[1]);
96
	}
97
}
98
fclose($file_conf);
99
$whiteDomain	= $conf['MAIL_WHITEDOMAIN'];
2990 rexy 100
?>
101
<!DOCTYPE html>
102
<html>
103
<head>
104
	<meta charset="UTF-8">
105
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
3183 rexy 106
	<title>ALCASAR - <?=$l_title?></title>
2990 rexy 107
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
108
	<link rel="stylesheet" type="text/css" href="css/pass.css">
109
	<link rel="icon" href="images/favicon-48.ico" type="image/ico">
110
	<script type="text/javascript" src="js/jquery.min.js"></script>
111
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
112
</head>
113
<body>
3026 rexy 114
	<div class="col-12 col-lg-10 offset-lg-1">
115
		<?php require_once(__DIR__.'/header.php'); ?>
2990 rexy 116
		<section id="inscription" class="row">
3026 rexy 117
			<form name="master" id="contenu_acces" onsubmit="return false;" class="col-12 offset-lg-1 col-lg-10">
2990 rexy 118
				<div class="row input_row">
3026 rexy 119
					<div class="label_name col-3 col-lg-4"><?=$l_Email?></div>
120
					<div class="col-6 col-lg-4">
3183 rexy 121
					<input type="email" placeholder="@<?=$whiteDomain?>" id="email" name="email" required class="form-control"/>
2990 rexy 122
					</div>
123
					<small id="output_email" class="row"></small>
124
				</div>
125
				<div id="status">
3009 rexy 126
					<?=$l_mandatory?>
2990 rexy 127
				</div>
128
				<div class="row input_row">
3026 rexy 129
					<div class="col-5 offset-xs-1 col-md-4 offset-md-2">
2990 rexy 130
						<input id="buttons" class="btn btn-default" value="Annuler" onclick="window.location.href = 'index.php';">
131
					</div>
3139 rexy 132
				<div class="col-5 col-md-4">
3038 rexy 133
						<button type="submit" class="btn btn-primary btn-lg" id="buttons" ><?=$l_inscription?></button>
2990 rexy 134
					</div>
135
				</div>
136
			</form>
137
		</section>
138
		<script>
3139 rexy 139
			jQuery(document).ready(function($){
2990 rexy 140
				$("#contenu_acces input").focus(function(){
141
					$("#status").fadeOut(800);
142
				});
143
				$("#contenu_acces").submit(function(){
144
					var status = $("#status");
145
					var Fmail = $("#email").val();
146
					$.ajax({
147
						type: "post",
3009 rexy 148
						url:  "email_registration_back.php",
2990 rexy 149
						data: {
150
							'Fmail' : Fmail,
151
						},
152
						beforeSend: function(){
153
							$("#status").attr("value", "Traitement en cours...");
154
						},
155
						success: function(data){
156
							if (data.match("success")) {
157
								status.html(data).fadeIn(400);
3038 rexy 158
								alert("<?=$l_mail_success?>");
3037 rexy 159
								document.location.href="index.php";
2990 rexy 160
							} else {
161
							console.log(data);
3038 rexy 162
								alert("<?=$l_mail_error?>");
2990 rexy 163
								status.css("color", "red").html(data).fadeIn(400);
164
							}
165
						}
166
					});
167
				});
168
			});
169
		</script>
170
	</div>
171
</body>
172
</html>