Bonjour à tous, mes codes marches bien à locale mais apres l'hebegement quand j'envoie des données pas de message d'erreur et en meme tempts rien est enregistré dans la base de donnée!! si vous avez du tempts aidez-moi.
1- formulaire
2-stockage:
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 <html><head> <link rel="stylesheet" type="text/css" href="style11.css"/><title>Déclarer un perdus الإعلان عن ضائع</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> </head> <body><div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <img src="DM/accueil2.gif" align="center" border="2" width="100%" height="80"/> <div class ="logo"><marquee direction="right" height="12" width="100%" ><h0>مرحبا بكم في موقع اجبار الظالة الذي يمكنكم من الإعلان المجاني عن كل ما ضاع عليكم أو ما وجدتموه ضائعا على غيركم و تودون إيصاله إليه </marquee><marquee direction="left" height="12" width="100%"><h0> Vous etes les bienvenues dans votre site Ejbardhalla qui vous permet de déclarer gratuitement vos objets perdus ou les objets que vous avez retrouvés et que vous voulez rendre à leurs propriétaires</marquee></div><table background = "DM/livre.jpg" cellpadding="0" cellspacing="0" border="1" width="100%"> <h3><TR><h3><TD width="150" align="center"><A CLASS="menub" HREF="index.php"><font color= "noir">الرئيسية</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="contacta.php"><font color= "noir">للإتصال بنا</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF=" livreor.php"><font color= "noir">شارك برأيك</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="affich.php"><font color= "noir">الأشياء الضائعة</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="affich1.php"><font color= "noir">الأشياء المعثور عليها</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="saisit.php"><font color= "noir">الإعلان عن ضائع</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="saisit1.php"><font color= "noir">الإعلان عن معثور عليه</font></A></TD></h3></tr> <h3><TR><h3><TD width="150" align="center"><A CLASS="lien" HREF="index.php"><font color= "noir">Accueil </font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="contact.php"><font color= "noir">Nous contacter</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="livreor.php"><font color= "noir">Participez</font></A></TD></h3> <h3><TD width="150" align="center"><A CLASS="menub" HREF="affich.php"><font color= "noir">Objets perdus</font></A></TD></h3> <h3><TD width="180" align="center"><A CLASS="menub" HREF="affich1.php"><font color= "noir">Objets retrouvés</font></A></TD></h3> <h3><TD width="180" align="center"><A CLASS="menub" HREF="saisit.php"><font color= "noir">Ajouter un perdu</font></A></TD></h3> <h3><TD width="220" align="center"><A CLASS="menub" HREF="saisit1.php"><font color= "noir">Ajouter un retrouvé</font></A></TD></h3> </tr></table></H2> <div class="fb-like" data-href="http://www.ejbardhalla.com/" data-send="true" data-width="450" data-show-faces="true"></div> <font size="4" align="left" color="cfe001"><center><?php include('datte.php');?></center></font> <table bgcolor="#0066FF" background= "DM/H.jpg" cellpadding="29" cellspacing="23" border="0" width="20%" heigth="20%" align="left" bordercolor="red"> <tr><TD width="150"><H3></body> </html><div><marquee direction="left" height="12" width="100%" ><img src="DM/vc.jpg" align="center" width="150" height="100"/></marquee></div></TD></tr></h3> <tr><h3><TD width="150" align="center"><A CLASS="menub" HREF="info.php"><font color= "blue">Infomations sur l'utilisation</font></A></TD></tr> <tr><h3><TD width="150" align="center"><A CLASS="menub" HREF="sitsa.php"><font color= "blue"> Sites importants </font></A></TD><h3></TR> <tr><h3><TD width="150" align="center"><A CLASS="menub" HREF="nous.php"><font color= "blue">Qui sommes nous</font></A></TD><h3></tr> </table> <table bgcolor="#0066FF" cellpadding="19" cellspacing="21" border = "0" width="20%" heigth="20%" align="right" bordercolor="red" background= "DM/H.jpg"> <tr><TD width="150"><h1><div><marquee direction="left" height="12" width="100%" ><img src="DM/vc.jpg" align="center" width="150" height="100"/></marquee></div></TD></tr></h3></TD></tr></h1> <tr><h3><TD width="150" align="center"><A CLASS="menub" HREF="infoa.php"><h4><font color= "blue">معلومات عن الإستخدام</font></A></TD><h3> <tr><h3><TD width="150" align="center"><A CLASS="menub" HREF="sitsa.php"><h4><font color= "blue"> مواقع مهمة </font></A></TD><h3></TR> <tr><h3><TD width="150" align="center"><A CLASS="menub" HREF="nousa.php"><h4><font color= "blue">من نحن</font></A></TD><h3></tr> </table> <form enctype="multipart/form-data" action="stocke.php" method="post"> <table border ="0" align ="center"><td>Les champs precedés par étoile sont obligatoires</td> <td> الخانات المسبوقة بنجمة كلها ضرورية </td></tr></table> <br><table width="57%" border="0" align="center" cellpadding="6" bordercolor="red" cellspacing="0" bgcolor ="#38435C" background=""> <tr> <td width="30%"> <div align="right">Nom complet <font color="red"> *</font></div> </td> <td colspan="2"> <div align="left"> <input type="text" name="name" size="32" maxlength="50"> <font color="red"> *</font> الإسم الكامل</div> </td> </tr> <tr> <td width="30%"> <div align="right">E-mail</div> </td> <td height="2" colspan="2"> <input type="text" name="email" size="32" maxlength="50"> البريد الإلكتروني</td> </tr> <tr> <td width="30%"> <div align="right">Téléphone <font color="red"> *</font></div> </td> <td height="2" > <input type="text" name="tel" size="32" maxlength="20"> <font color="red"> *</font> الهاتف</td> </tr> <tr> <td width="30%"> <div align="right">L'objet perdu <font color="red"> *</font></div> </td> <td height="2" > <input type="text" name="objetp" size="32" maxlength="50"> <font color="red"> *</font> إسم الشيء الضائع</td> </tr> <tr> <td width="30%"> <div align="right">Photo </div> </td> <td height="2" > <input type="hidden" name="MAX_FILE_SIZE" value="100000"> <input type="file" name="image" size="33"> صورة</td> </tr> <tr> <td width="30%" height="57"> <div align="right">Description <font color="red"> *</font></div> </td> <td height="57" colspan="2"> <textarea name="description" cols="33" rows="6"></textarea> <font color="red"> *</font> الوصف</td> </tr> <tr><td></td> <td colspan="2"> <div align="left"> <input type="submit" name="Submit" value="Envoyez إرسال"> <input type="reset" name="Submit" value="Supprimez مسح"> </div> </td> </tr> </table> <br><br> </form></body> </html> </TD></tr></h3> <?php include ("prc.php");?> <?php include('connectes.php');?> <center><font color ="cyan"><h6> كل الحقوق محفوظة Copyright © 2013 ejbardhalla.com</h6></font></center> <table width ="100%" heigth="20%" border ="0" background ="DM/11.jpg"><tr><td width="100%" align ="center"></td></tr> <tr><td width="100%" align ="center"></td></tr><tr><td width="100%" align ="center"></td></tr></table> </body></html> </body></html>
3-La BD:
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 <?php include("fonctions.php"); ?><html><head> <link rel="stylesheet" type="text/css" href="style.css"/><title>Stckage des données تخزين المعطيات</title> <meta http-equiv="Content-type" content="text/html; charset=UTF-8"/> </head> <body bgcolor="#911ff1"><H2> <pre><?php header('Content-Type: text/html; charset=UTF-8'); if (isset($_POST['Submit'])) { $name=$_POST['name']; $email=$_POST['email']; $tel=$_POST['tel']; $objetp=$_POST['objetp']; $description=$_POST['description']; if ( empty($name) ) { die("<center>Vous devez écrire votre nom-يجب أن تكتبوا إسمكم"); } if((empty($_POST['email']))) { echo $_POST['email']; } else if ( 1 < (strlen($_POST['email']) < 5) || (strlen($_POST['email']) > 60)) { die("L'adresse e-mail est trop court ou trop long-البريد إما طويل جدا أو قصير جدا"); } else if(!(preg_match("#@#",$_POST['email']))){ die("L'adresse e-mail n'est pas correct, le symbole @ est absent البريد غير صالح, العلامة @ غير موجودة"); } else { } if ( empty($tel) ) { die("<center>Vous devez entrer votre numéro de téléphone-يجب أن تكتبوا رقم هاتفكم"); } if ( empty($objetp) ) { die("<center>vous devez écrire le nom d'objet perdu-يجب أن تكتبوا إسم الشيئ الضائع"); } if ( empty($description)) { die("<center>Vous devez décrir l'objet perdu-يجب وصف الشيئ الضائع"); } // ************************* if(empty($_POST['name'])) { die("Vous devez écrire votre nom-يجب أن تكتبوا إسمكم"); } elseif ( (strlen($_POST['name']) < 3) || (strlen($_POST['name']) > 40)) { die("Le nom incorrect-الإسم غير صالح"); } else { } if(empty($_POST['tel'])) { die("Vous devez entrer votre numéro de téléphone-يجب أن تكتبوا رقم هاتفكم"); } elseif ((strlen($_POST['tel']) < 8) || (strlen($_POST['tel']) > 20)) { die("Numéro de téléphone trop court ou trop long-رقم الهاتف إما طويل جدا أو قصير جدا"); } else { } if(empty($_POST['objetp'])) { die("Vous devez ecrire le nom d'objet perdu-يجب أن تكتبوا إسم الشيئ الضائع"); } elseif ((strlen($_POST['objetp']) < 3) || (strlen($_POST['objetp']) > 25)) { die("Nom d'objet trop court ou trop long-إسم الشيئ الضائع طويل جدا أو قصير جدا"); } else { } if(empty($_POST['description'])) { die("Vous devez décrire l'objet perdu-يجب وصف الشيئ الضائع"); } elseif ( (strlen($_POST['description']) < 5) || (strlen($_POST['description']) > 400)) { die("La description est trop courte ou trop longe-الوصف إما طويل جدا أو قصير جدا"); } else { } $dossier = './imagesp/'; $fichier = basename($_FILES['image']['name']); $taille_maxi = 1000000; $taille = filesize($_FILES['image']['tmp_name']); $extensions = array('.png', '.gif', '.jpg', '.jpeg','.bmp'); $extension = strrchr($_FILES['image']['name'], '.'); //Début des vérifications de sécurité... if(empty($fichier)){ $fichier="pas-d'imagep.jpg";} else { if(!in_array($extension, $extensions)) //Si l'extension n'est pas dans le tableau { die ("Vous devez uploader seulement une image de type: png, gif, jpg, jpeg ou bmp. .bmp أو jpeg ,jpg ,gif ,png :ينبغي أن تكون الصورة المرفقة فقط من النوع "); } if($taille>$taille_maxi) { die ("Le fichier est trop gros...الصورة كبيرة الحجم"); } if(!isset($erreur)) //S'il n'y a pas d'erreur, on upload { //On formate le nom du fichier ici... $fichier = strtr($fichier, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy'); $fichier = preg_replace('/([^.a-z0-9]+)/i', '-', $fichier); if(move_uploaded_file($_FILES['image']['tmp_name'], $dossier . $fichier)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné... { } else //Sinon (la fonction renvoie FALSE). { die ("Echec de téléchargement de photo ! هناك خطأ في تحميل الصورة"); } } } connectejbardha_inscription(); if(empty($fichier)){ $fichier="pas-d'imagep.jpg";} date_default_timezone_set("UTC"); $date = date("Y/m/d"); //Obtention de l'ID en incrmentant d'une unit // le dernier ID cr. $query="select MAX(id) as id from objet_perdu"; $result=mysql_query($query); if($row=mysql_fetch_array($result)) { $id = ++$row[0]; } else { echo mysql_errno($base)." : ".mysql_error($base); } $query="INSERT into objet_perdu VALUES('".mysql_real_escape_string(stripslashes($id))."','".mysql_real_escape_string(stripslashes($name))."','".mysql_real_escape_string(stripslashes($email))."','".mysql_real_escape_string(stripslashes($tel))."','".mysql_real_escape_string(stripslashes($objetp))."','".mysql_real_escape_string(stripslashes($fichier))."','".mysql_real_escape_string(stripslashes($description))."','".mysql_real_escape_string(stripslashes($date))."')"; $result=mysql_query($query); if (!($result)) { echo mysql_errno($result)." : ".mysql_error($result); }else{echo '$result'; }} //Affichage en retour des donnes enregistres. ?> <table align= "center" border ="0" width= "100%" height= "79%"> <?php echo " <tr><td align=center><font color= cyan > <h2><B>Merci, vos données sont conservées : شكرا , لقد تم حفظ معطياتكم</B></h2></font>","</td></tr>"; echo " <tr><td align=center><u><font color= cyan ><h2><B> Vous أنتم </h2></B></u></font></tr></td>"; echo " <tr><td align=center><h3><B>",$name," // ",$email," // ",$tel,"</h3></B></tr></td>" ; echo " <tr><td align=center><u><font color= cyan ><h2><B>L'objet perdu الشيء الضائع</h2></B></u></font></tr></td>"; echo " <tr><td align=center><h3><B>",$objetp,"</h3></B></tr></td>"; echo " <tr><td align=center><h3><B>",$fichier,"</h3></B></tr></td>"; echo " <tr><td align=center><h3><B>",$description,"</h3></B></tr></td>"; echo " <tr><td align=center><h3><B>",$date,"</h3></B></tr></td>"; ?> </table> <h3><A CLASS="menub" HREF="index.php"><center><b>Accueil-الرئيسية</center></b></A></h3> <?php include ("prc.php"); ?> </body></html>
3-Connexion à la BD:
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 -- phpMyAdmin SQL Dump -- version 3.3.9 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Apr 05, 2016 at 01:59 PM -- Server version: 5.5.8 -- PHP Version: 5.3.5 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `ejbardha_inscription` -- -- -------------------------------------------------------- -- -- Table structure for table `objet_perdu` -- CREATE TABLE IF NOT EXISTS `objet_perdu` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Nom` varchar(50) NOT NULL, `E-mail` varchar(50) DEFAULT NULL, `Tel` int(50) NOT NULL, `Objetp` varchar(50) NOT NULL, `image_src` varchar(150) DEFAULT NULL, `Description` text NOT NULL, `date_inscrit` date NOT NULL, UNIQUE KEY `id` (`id`), KEY `Objetp` (`Objetp`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `objet_perdu` -- -- -------------------------------------------------------- -- -- Table structure for table `objet_trouve` -- CREATE TABLE IF NOT EXISTS `objet_trouve` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Nom` varchar(50) CHARACTER SET utf8 NOT NULL, `E-mail` varchar(50) CHARACTER SET utf8 DEFAULT NULL, `Tel` int(50) NOT NULL, `Objett` varchar(50) CHARACTER SET utf8 NOT NULL, `image_src` varchar(150) DEFAULT NULL, `Description` varchar(400) CHARACTER SET utf8 NOT NULL, `date_inscritt` date NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`), KEY `Objett` (`Objett`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -- Dumping data for table `objet_trouve` --
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <?php header('Content-Type: text/html; charset=UTF-8'); function connectejbardha_inscription(){ $base = mysqli_connect("localhost","admin","ejbardha"); mysqli_select_db('ejbardha_inscription', $base) ; mysqli_query("SET NAMES 'utf8'"); } echo mysql_errno($base)." : ".mysql_error($base); ?>
Partager