![]()
voila mon problème je voudrai maitre un formulaire de connections pour un apple chat an java.
mon problème je veux évité un "attaquant" d'insérer des javascripts a la place des variables attendues mais j'ai cherché je ne trouve pas.
je précise que sa ne fait tres peut de temps que je fait du php.
donc je voudrai sécurisé la variable $_post.
voila le code du formulaire.
Code html : 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 <table class="wg-paragraph" width="100%"><tr> <td><FORM action="modules/chat/chat.php" method="post" onSubmit="this.target = new Date().getMilliseconds(); w = window.open('', this.target, 'scrollbars=no, menubar=no, toolbar=no, resizable=yes, screenX=50, screenY=50, width=1200, height=1200'); if (w != null && !w.closed) w.focus(); else this.target = '_top'; return(true);"> <p align="center"><font size="4"><b>Connexion au chat :</b></font></p> <p align="center"><font size="4">Pseudo : <input type="text" name="Pseudo" size="26" maxlength="25"></font></p> <p align="center"><font size="4">Mot de passe (facultatif) : </font> <input type="password" name="Passns" size="25"></font></p> <p align="center"><font size="4">Age : <input type="text" name="Age" size="3" maxlength="2"> Sexe : <input type="radio" value="H" checked name="Sexe"><font size="3"> Homme <input type="radio" name="Sexe" value="F"> Femme <input type="radio" name="Sexe" value="?"> ??</font> Ville : <input type="text" name="Ville" size="16" maxlength="20"></font></p> </select><p> <p align="center"> <input type="submit" value="Connexion au chat" name="send" style="background-color: #CBC1B7"> </p> <p align="center">Vous devez disposer du JavaVM, si le chat ne se lance pas, cliquez <a target="_blank" href="http://jdl.sun.com/webapps/getjava/BrowserRedirect?locale=en&host=java.com:80"> ici</a> et cliquez sur oui !!</p> <input type="hidden" name="mbg" value="#FFFFFF"> <input type="hidden" name="fcolor" value="#000000"> <input type="hidden" name="website" value="Bienvenue sur irc.chat-sympa.org ... !"> </form></td> </tr><tr><td style="text-align:justify"> </td> </tr></table>
et la le code de lapple. ou je voudrai sécurisé doc la variabe
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 <HTML> <HEAD> <title><?php $titleb = $_POST['website']; print($titleb);?> - http://www.chat-sympa.org</title> <STYLE type="text/css"> BODY { margin: 0; background-color: #36C8BD; } </STYLE> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD> <BODY> <p> <?php $Pseudo = $_POST['Pseudo']; $Passns = $_POST['Passns']; $Age = $_POST['Age']; $Sexe = $_POST['Sexe']; $ville = $_POST['Ville']; $mbg = $_POST['mbg']; $fcolor = $_POST['fcolor']; $chan = $_POST['chan']; if($Pseudo == '' OR $Age == '' OR $ville == '') { echo '<p align="center">Paramètres de connexion incorrect. Remplissez le champ "pseudo" puis votre ASV et revenez</p>'; exit; } ?> <CENTER><div class="applet"> <APPLET code="EIRC" width="100%" height="100%"> <PARAM name="archive" value="EIRC.jar, EIRC-cfg.jar"> <PARAM name="server" value="irc.chat-sympa.org"> <PARAM name="port" value="6667"> <PARAM name="irc_pass" value=""> <PARAM name="mainbg" value="<?php print($mbg);?>"> <PARAM name="mainfg" value="<?php print($fcolor);?>"> <PARAM name="textbg" value="#FFFFFF"> <PARAM name="textfg" value="#000000"> <PARAM name="selbg" value="#8080FF"> <PARAM name="selfg" value="#000000"> <?php $tux = mt_rand(100000,9999999); echo '<PARAM name="username" value="user-'.$tux.'">'; ?> <PARAM name="realname" value="<?php print($Age);?> <?php print($Sexe);?> <?php print($ville);?>"> <PARAM name="nickname" value="<?php print($Pseudo);?>"> <PARAM name="nicksrv_pass" value="<?php print($Passns);?>"> <PARAM name="join" value="<?php print($chan);?>"> <PARAM name="login" value="1"> <PARAM name="spawn_frame" value="0"> <PARAM name="framew" value="700"> <PARAM name="frameh" value="500"> <PARAM name="write_color" value="1"> <PARAM name="debug_traffic" value="0"> <param name="smileys" value="true"> </APPLET> </div> <CENTER> <p> <B>Votre java doit être installé et activé !</B> </p></CENTER> </BODY> </HTML>je vous remercie a l'avance de vaux réponses
bien a vous
Partager