Bonjour j'aimerai bien savoir comment puis je faire pour ajouter du CSS dans mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
#!/usr/bin/perl
 
$mailprog = '/usr/sbin/sendmail';
 
$admin_email="mail@gmail.com";
 
$list_name="Newsletter";
 
$adminpass="123456";
 
$sendto="0";
 
$temp="0";
 
$remove_notice="1";
 
$html = "1"; 
 
$file = "list.txt";
 
$temp_file = "temp.txt";
 
@bannedaddresses = ('john@johndoe.com','joe@joedoe.com');
 
$lock = "2";
 
@months = ('January','February','March','April','May','June','July','August','September','October','November','December');
@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
($mday,$mon,$year,$wday) = (localtime(time))[3,4,5,6];
$year += 1900; 
$date = "$months[$mon] $mday, $year";
 
$url = $ENV{'SERVER_NAME'};
$script_url = $ENV{'SCRIPT_NAME'};
 
print "Content-type: text/html\n\n";
 
✓
 
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
 
foreach $pair (@pairs) 
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$in{$name} = $value;
}
 
if ($in{'action'} eq "Subscribe") {&subscribe}
if ($in{'action'} eq "Unsubscribe") {&unsubscribe}
if ($in{'action'} eq "avec") {&subscribe}
if ($in{'action'} eq "Sans") {&subscribe}
if ($in{'action2'} eq "avec") {&unsubscribe}
if ($in{'action2'} eq "Sans") {&unsubscribe}
if ($in{'action'} eq "Envoyer") {&Envoyer}
if ($in{'action'} eq "Charger") {&Charger}
if ($in{'adminpass'} ne "$adminpass") {&adminerror}
if ($in{'adminpass'} eq "$adminpass") {&adminform}
 
exit;
 
sub check
{
open(LIST,"$file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
close(LIST);
 
foreach $member(@addresses)
{
chomp($member);
$in{'address'} = "$ENV{'QUERY_STRING'}";
if ($in{'address'} eq $member){&unsubscribe}
}
 
open(LIST,"$temp_file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
close(LIST);
 
foreach $tempmember(@addresses)
{
chomp($tempmember);
@info = split(/::/, $tempmember);
($in{'address'},$in{'number'})=split('&',$ENV{'QUERY_STRING'});
if ($in{'number'} eq $info[0]){&subscribetemp}
} 
 
if("admin" eq $ENV{'QUERY_STRING'}){
&admin
} 
}
 
sub subscribe
{
open(LIST,"$file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
close(LIST);
$in{'address'} =~ tr/[A-Z]/[a-z]/;
if ($in{'address'}!~ /.*\@.*\..*/){&bademail}
 
foreach $bannedaddress(@bannedaddresses)
{
if ($in{'address'} eq $bannedaddress){&banned_message}
}
 
foreach $member(@addresses)
{
chomp($member);
if ($in{'address'} eq $member){&already_subscribed}
}
 
if ($in{'action'} eq "Sans") {
push (@addresses,$in{'address'});
open(LIST,">>$file");
if ($lock){ 
flock(LIST, $lock);
}
$in{'address'} =~ tr/[A-Z]/[a-z]/;
print LIST "$in{'address'}\n";
close(LIST);
$message="L'adresse <font color=red>$in{'address'}</font> a été ajouter avec succèes à $list_name.";
&message;
exit;
}
if ($temp eq "1") {
push (@addresses,$in{'address'});
open(LIST,">>$temp_file");
if ($lock){ 
flock(LIST, $lock);
}
$in{'address'} =~ tr/[A-Z]/[a-z]/;
srand(time|$$); 
$RandomNumber = int(rand(10000000)); 
$Num = "_$RandomNumber"; 
$Num .= "_$$"; 
$Num =~ s/-//g; 
$Num =~ s/_//g; 
$address = "$in{'address'}";
$number = "$Num";
$in{'number'} = "$number";
$temp_entry = $number . "::" .
$address . "::"; 
print LIST "$temp_entry\n";
close(LIST);
$message="L'adresse mail <font color=red>$in{'address'}</font> a été déplacer de la liste temporaire et en attente de confirmation. Veuillez confirmez s'il vous plaît votre addition à notre $list_name on cliquant sur ce lien.";
&mailtemp;
&message;
exit;
 
}
if ($temp eq "0") {
push (@addresses,$in{'address'});
open(LIST,">>$file");
if ($lock){ 
flock(LIST, $lock);
}
print LIST "$in{'address'}\n";
close(LIST);
$message="L'adresse mail<font color=red>$in{'address'}</font> a été ajouter avec succès a notre $list_name.";
if ($in{'action'} ne "Sans") {
&mailadd;
}
&message;
exit;
}
}
 
sub subscribetemp
{
open(LIST,"$file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
close(LIST);
if ($in{'address'}!~ /.*\@.*\..*/){&bademail}
 
foreach $bannedaddress(@bannedaddresses)
{
if ($in{'address'} eq $bannedaddress){&banned_message}
}
 
push (@addresses,$in{'address'});
open(LIST,">>$file");
if ($lock){ 
flock(LIST, $lock);
}
print LIST "$in{'address'}\n";
close(LIST);
$message="L'adresse mail <font color=red>$in{'address'}</font> a ete retirer de la liste temporaire et ajouter à $list_name.";
&mailadd;
&message;
&unsubscribetemp;
exit;
}
 
sub bademail
{
$message="Il parait qu'il y'a une erreur
Ressayer s'il vous plaît. ou contactez le webmaster du site <a href=mailto:$admin_email> $admin_email</a>.";&message;
exit;
}
 
sub banned_message
{
$message="Desoler mais il parait que <font color=red>$in{'address'}</font> a été banit pour certaine raisons.";&message;
exit;
}
 
sub already_subscribed
{
$message="Il paraît que <font color=red>$in{'address'}</font> est deja enrigistrer dans notre base ";&message;
exit;
}
 
sub unsubscribe
{
open(LIST,"$file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
close(LIST);$x=0;
foreach $member(@addresses)
{
&clean;
if ($in{'address'} eq $member){&deletemember}
$x++;
}
&not_found;
}
 
sub unsubscribetemp
{
open(LIST,"$temp_file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
close(LIST);$x=0;
foreach $member(@addresses)
{
@info = split(/::/, $member);
&clean;
if ($in{'address'} eq $info[1]){@addresses[$x]="";
open(LIST,">$temp_file");
if ($lock){ 
flock(LIST, $lock);
}
foreach $member(@addresses)
{
@info = split(/::/, $member);
&clean;
unless($member eq "")
{print LIST "$member\n";}
}}
$x++;
}
exit;
}
 
sub adminerror
{
$message="Il parâit qu'il y'a une erreur dans le mot de passe. Retournez à la page précedente et ressayer s'il vous plaît.";&message;
exit;
}
 
sub admin
{
$message="<form action=mailmachine.cgi method=post>Mot de passe : <input type=password name=adminpass><BR><BR><input type=submit value=Valider><input type=reset value=Vider></FORM>";&message;
exit;
}
 
sub clean
{
chomp($member);
$member=~ s/^\s+//;
$member=~ s/\s+$//;
}
 
sub not_found
{
$message="Il paraît que <font color=red>$in{'address'}</font>
n'est pas dans la liste donc cette adresse ne peut pas être retirer de notre base de donnèes";&message;
exit;
}
 
sub deletemember
{
@addresses[$x]="";
open(LIST,">$file");
if ($lock){ 
flock(LIST, $lock);
}
foreach $member(@addresses)
{
&clean;
unless($member eq "")
{print LIST "$member\n";}
}
$message="<font color=red>$in{'address'}</font> est supprimer avec succès de notre $list_name.";
if ($in{'action2'} ne "Sans") {
&mailun;
}
&message;
exit;
}
 
sub mailadd{
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "From: $admin_email\n";
print MAIL "To: $in{'address'}\n";
print MAIL "Subject: Newsletter -\n\n";
print MAIL <<to_the_end;
Ce message est pour confirmer votre adition a notre $list_name.
 
Merci de votre inscription a notre newsletter.
 
 
 
to_the_end
 
close (MAIL);
 
if ($Envoyerto eq "1") {
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "From: $admin_email\n";
print MAIL "To: $admin_email\n";
print MAIL "Subject: Mailing List Entry\n\n";
print MAIL <<to_the_end;
$in{'address'} has been added to the $list_name.
 
to_the_end
 
close (MAIL);
}
}
 
sub mailtemp{
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "From: $admin_email\n";
print MAIL "To: $in{'address'}\n";
print MAIL "Subject: Confirmation e-mail\n\n";
print MAIL <<to_the_end;
Ceci est pour confirmer votre ajout a notre the $list_name. Cliquez sur le lien ci-dessous pour déplacer votre adresse e-mail de la liste provisoire à $list_name. If you did NOT subscribe to this list, then here is the person who did: $ENV{'REMOTE_ADDR'} In any case, don't click on the link below and you will NEVER receive anything from us :)
 
http://$url$script_url?$in{'address'}&$in{'number'}
(ou copier et coller cet url sur votre navigateur)
 
Regards,
Your_Name
 
to_the_end
 
close (MAIL); 
}
 
sub mailun{
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "From: $admin_email\n";
print MAIL "To: $in{'address'}\n";
print MAIL "Subject: Vous avez été désinscrit de Notre Newsletter!\n\n";
print MAIL <<to_the_end;
 Vous avez été désinscrit de Notre $list_name.
 
to_the_end
 
close (MAIL);
 
if ($Envoyerto eq "1") {
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "From: $admin_email\n";
print MAIL "To: $admin_email\n";
print MAIL "Subject: Adios!\n\n";
print MAIL <<to_the_end;
$in{'address'} has been unsubscribed from the $list_name.
 
to_the_end
 
close (MAIL);
}
}
 
sub adminform
{
 
$number=0;
open(LIST,"$file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
print LIST "$number\n";
close(LIST);
$number = push(@addresses);
 
$number2=0;
open(TEMPLIST,"$temp_file");
if ($lock){ 
flock(TEMPLIST, $lock);
}
@tempaddresses=<TEMPLIST>;
print TEMPLIST "$number2\n";
close(TEMPLIST);
$number2 = push(@tempaddresses);
 
print "<html><title>$list_name</title><body bgcolor=white>
<center><pre>
 
 
</pre>
<table width=500>
<td align=center>
<font face=arial>
<font face=arial size=+1 color=blue><b>$list_name</b></font>
<br><br>
Il y'a actuellement <font color=red>$number</font> email dans notre base de données, et <font color=red>$number2</font> e-mail en attente de vérification.
<form action=mailmachine.cgi method=post><BR>Archives: <select name=archives>";
 
open(LIST,"archives/log.txt");
if ($lock){ 
flock(LIST, $lock);
}
@entries=<LIST>;
close(LIST);
@entries = reverse(@entries);
foreach $entry(@entries)
{
print "<option>$entry\n";
$x++;
}
 
print "</select><input type=submit name=action value=Charger></form><form action=mailmachine.cgi method=post>Sujet: <input type=text name=subject><BR><BR>Message: <BR><textarea id=textarea name=message rows=12 cols=50></textarea><BR><BR><input type=submit name=action value=Envoyer><input type=reset value=Vider name=></FORM><BR><form action=mailmachine.cgi method=post><input type=text name=address> 
Inscrire l'utilisateur <input type=submit name=action value=avec><input type=submit name=action value=Sans> notification.</form>
<br><TABLE><TR><form action=mailmachine.cgi method=post>
<TD>Base de donnèes:<BR>
<select name=address size=6>";
 
@addresses = sort(@addresses);
foreach $member(@addresses)
{
print "<option>$member";
$x++;
}
 
print "</select><BR><CENTER>Désinscrire l'utilisateur <input type=submit name=action2 value=avec><input type=submit name=action2 value=Sans> notification.</CENTER></TD></form></TR></TABLE>";
 
print "<BR><BR><BR><BR>
 
</td>
</table>
</body></html>";
}
 
sub Charger
{
 
print "<html><title>$list_name</title><body bgcolor=white>
<center><pre>
 
 
</pre>
<table width=500>
<td align=center>
<font face=arial>
<font face=arial size=+1 color=blue><b>$list_name</b></font>
<br><br><form action=mailmachine.cgi method=post>Archives: <select name=archives>";
 
open(LIST,"archives/log.txt");
if ($lock){ 
flock(LIST, $lock);
}
@entries=<LIST>;
close(LIST);
@entries = reverse(@entries);
foreach $entry(@entries)
{
print "<option>$entry\n";
$x++;
}
 
print "</select><input type=submit name=action value=Charger></form><form action=mailmachine.cgi method=post>Subject: <input type=text name=subject value=\"";
 
open(FILE,"archives/$in{'archives'}.txt");
while (<FILE>) {
($message, $subject) = split /::/;
 
if($subject ne "")
{
print "$subject\"";
}
}
close(FILE);
 
print "><BR><BR>Message: <BR><textarea name=message rows=12 cols=50>";
 
open(FILE,"archives/$in{'archives'}.txt");
while (<FILE>) {
($message, $subject) = split /::/;
print "$message";
}
close(FILE);
 
print "</textarea><BR><BR><input type=submit name=action value=Envoyer><input type=reset value=Clear name=></FORM><A HREF=\"javascript:history.back()\">Précédente</A>";
 
 
print "<BR><BR><BR><BR>
 
</td>
</table>
</body></html>";
exit;
}
 
sub Envoyer
{
$pid = fork();
$pid;
if ($pid) {
&Envoyercomplete;
&archive;
exit(0);
}
else {
close (STDOUT);
 
open(LIST,"$file");
if ($lock){ 
flock(LIST, $lock);
}
@addresses=<LIST>;
close(LIST);
 
foreach $member(@addresses)
{
chomp($member);
 
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
if ($html eq "1") {
print MAIL "Content-type:text/html\n";
}
print MAIL "From: $admin_email\n";
print MAIL "To: $member\n";
print MAIL "Subject: $in{'subject'}\n\n";
print MAIL "$in{'message'}\n\n";
if ($remove_notice eq "1") {
if ($html eq "1") {
print MAIL <<to_the_end;
<BR><BR>
---------------------------------------------------------------------<BR>
Copier et coller cet url sur votre navigateur et cliquer sur "Enter" si vous voulez vous désabonnez de
$list_name.<BR><BR>
 
<A HREF="http://$url$script_url?$member">http://$url$script_url?$member</A><BR>
(Vous recevrez une confirmation de notre part.)<BR>
---------------------------------------------------------------------
to_the_end
}
else {
print MAIL <<to_the_end;
---------------------------------------------------------------------
Cliquer sur le lien si vous souhaiterai vous désinscrire de notre newsletter
$list_name.
 
http://$url$script_url?$member
(Ou bien copier coller ce lien sur votre navigateur)
---------------------------------------------------------------------
to_the_end
}
} 
close (MAIL);
}
&confirmation;
exit;
}
}
 
sub archive
{
open(LIST, ">>archives/log.txt");
if ($lock){ 
flock(LIST, $lock);
}
print LIST "$date - $in{'subject'}\n";
close(LIST);
 
$message = "$in{'message'}";
$subject = "$in{'subject'}";
$new_entry = $message . "::" .
$subject;
open(FILE, ">>archives/$date - $in{'subject'}.txt");
if ($lock){ 
flock(FILE, $lock);
}
print FILE "$new_entry\n";
close(FILE);
}
 
sub Envoyercomplete
{
$message="Félicitation! L'envoi a été lancé. Vous recevrez une confirmation par e-mail lors de l'envoi a été achevé.";
&message;
}
 
sub confirmation
{
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
if ($html eq "1") {
print MAIL "Content-type:text/html\n";
}
print MAIL "From: $admin_email\n";
print MAIL "To: $admin_email\n";
print MAIL "Subject: Félicitation!\n\n";
if ($html eq "1") {
print MAIL <<to_the_end;
Félicitations! La diffusion s'est terminée avec succès. :<BR><BR>
 
$in{'message'}
to_the_end
close (MAIL);
}
else {
print MAIL <<to_the_end;
Félicitations! La diffusion s'est terminée avec succès :
 
$in{'message'}
to_the_end
close (MAIL);
}
}
 
sub message
{
print qq~
<html><title>$list_name</title><body bgcolor=white>
<center><pre>
 
 
</pre>
<table width=500>
<td align=center>
<font face=arial>
<font face=arial size=+1 color=blue><b>$list_name</b></font>
<br><br>$message~;
if("admin" ne $ENV{'QUERY_STRING'}){
print "<BR><BR><A HREF=\"javascript:history.back()\">Précédente</A>"
} 
 
print "<BR><BR><BR><BR>
</td>
</table>
</body></html>";
}