Pouvez-vous donner votre avis sur une petite application

fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention   -  
jordane45 Messages postés 38486 Date d'inscription   Statut Modérateur Dernière intervention   -
Bonjour, Mes Camarde svp je viens de terminer une petite application web qu'est affiche un tableaux contient le lien d'un fichier pdf avec lors sujet et date...
je vais poster mon code ci-dissous et je veux attende vos commentaire pour avoir les point faible de mon application et les chose qui doit ajouter avant de poster l'application dans un serveur web
Merci de m'aide et de donner votre avis :)

6 réponses

fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 
########page index#########
<!DOCTYPE html>
<html lang="en" dir="rtl">
  <head>
		<meta charset="utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="style/css/Bootstrap v3.3.0.css" rel="stylesheet" id="bootstrap-css">
		<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> 
		<link href="style/css/style_index.css" rel="stylesheet">
		<link href="https://necolas.github.io/normalize.css/8.0.0/normalize.css" rel="stylesheet">
		<link href="style/css/normalize.css" rel="stylesheet">
    <title>Identification</title>

  </head>

  <body class="text-center">

    <div class="container">

      <form method="post" class="form-signin">
        <!--<h6 class="form-signin-heading">المرجوا إدخال اسم المستخدم و كلمة السر</h6>-->
        <h1 class="h3 mb-3 font-weight-normal">المرجوا إدخال اسم المستخدم و كلمة السر</h1>
        <label for="inputEmail" class="sr-only"> إسم المستخدم</label>
        <input type="text" name="login" class="form-control" placeholder="إسم المستخدم" required autofocus>
        <label for="inputPassword" class="sr-only"> كلمة السر </label>
        <input type="password" name="mot_pass" class="form-control" placeholder="كلمة السر" required>
        <button class="btn btn-lg btn-primary btn-block" type="submit" name="connexion" >Connexion</button>
		</br><p class="mt-5 mb-3 text-muted">© 2018-2019</p>
      </form>

    </div> <!-- /container -->
	<?php
		if(isset($_POST['connexion'])){
			//$login = htmlentities(trim($_POST['login']));
			//$mot_pass = htmlentities(trim($_POST['mot_pass']));
			if(!empty($_POST['login']) && !empty($_POST['mot_pass'])){
				if($_POST['login']=='user' && $_POST['mot_pass']=='user'){
					header("Location:user.php");
				}
				else if($_POST['login']=='admin' && $_POST['mot_pass']=='admin'){
					header("Location:Admin.php");		
				}
			}
		}
	?>
	
	
	
  </body>
</html>


0
fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 

########page Admin ############
  <?php
  if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
   echo '!! This is a server using Windows!!';
  } else {
   echo ' !!This is a server not using Windows!!';
  }
  ?>
<!DOCTYPE html>
<html  lang="ar" dir="rtl" >
 <head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="style/css/titr_css.css" rel="stylesheet" media="screen, projection, tv">
  <link href="style/css/Bootstrap v3.3.0.css" rel="stylesheet" id="bootstrap-css">
  <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
  <link href="https://necolas.github.io/normalize.css/8.0.0/normalize.css" rel="stylesheet">
  <link href="style/css/normalize.css" rel="stylesheet">
  <title> المذكرات الوزارية </title> 
 </head>
 <body>
  <header>
    <h2 id="titrecap">المذكرات الوزارية</h2>
  </header>
  <div  class="container">
   <div class="row">
   <!-- <div class="col-md-12 col-sm-12 col-xs-12 ">-->
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">     
      <form method= "post">
       <input  type="submit" class = "btn btn-primary" value="Ajouter" name="ajouter"/>
       <input  type="submit" class = "btn btn-primary" value="Affichage" name = "Affichage"/>
      </form>
      <table id="mytable" class="table table-hover table-bordered" style="width:100%">      
       <thead> 
       <!--<caption id="titrecap">المذكرات الوزارية</caption>-->
       <tr>
        <th><center>الموضوع</center></th>
        <th><center>التاريخ </center></th>
        <th><center>المذكرات</center></th>
        <th><center>حذف</center></th>
        <th><center>تعديل</center></th>
       </tr>
       </thead>
       <tbody>
        <?php
         require 'connexion_BD/connect.php' ;
         header( 'content-type: text/html; charset=utf-8' );    
         $req = $db->query('SELECT * FROM tb_modakirat order by id desc ');      
         while($data = $req->fetch()){
           $id = $data['id'];
           $url_de_fichier = $data['file_url'];         
           $nom_de_fichier = $data['name_file'];
           $date_creation = $data['date_creation'];
           $sujet = $data['sujet'];
           echo '<tr><td>' .$sujet.'</td>' ;
           echo "<td>" .$date_creation. "</td>";
           echo '<td><a href= "'.$url_de_fichier. '"> Afficher </a></td>';
           echo "<td><a href = 'code/supprimer.php?id=$id'  onclick='return confirm(\"هل تريد فعلا حذف المعطيات......؟؟\");' ><button class='btn btn-danger btn-xs' data-title='Delete' data-toggle='modal'><span class='glyphicon glyphicon-trash'></span></button></a></td>";
           echo"<td><a href = 'modifier.php?id=$id' ><button class='btn btn-primary btn-xs' ><span class='glyphicon glyphicon-pencil'></span></button></a></td></tr>";
         }
         if(isset($_POST['Affichage'])){
          header("Location:user.php");
         }
         if(isset($_POST['ajouter'])){
         header("Location:ajouter.php");
         }
        ?>
       </tbody>
      </table>
  
    </div>
   </div>
  </div>  
 </body>
</html>


0
jordane45 Messages postés 38486 Date d'inscription   Statut Modérateur Dernière intervention   4 752
 
0
fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 
Ok je le ferais inchallah.. merci
0
fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 
sachant que ce code est mal utilisé il sa marche bien.. est ce que ce probleme d'organisation peut bloque cette application au plus tard ??
0
jordane45 Messages postés 38486 Date d'inscription   Statut Modérateur Dernière intervention   4 752 > fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 
bloquer non....
mais géner sa maintenance ou son évolution ...oui
0
fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 
###### Page User###########
<!DOCTYPE html>
<html  lang="ar" dir="rtl" >
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="style/css/titr_css.css" rel="stylesheet" media="screen, projection, tv">
		<link href="style/css/Bootstrap v3.3.0.css" rel="stylesheet" id="bootstrap-css">
		<link href="https://necolas.github.io/normalize.css/8.0.0/normalize.css" rel="stylesheet">
		<link href="style/css/normalize.css" rel="stylesheet">
		<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
		
		<title> المذكرات الوزارية </title>	
	</head>
	<body>
		<div  class="container">
			<div class="row">
				<div class="col-sm-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
						<table  id="mytable" class="table table-hover table-bordered" style="width:100%">
							<thead>
								<caption id="titrecap">المذكرات الوزارية</caption>							
								<th><center>الموضوع<center></th>
								<th><center>التاريخ</center></th>
								<th><center>المذكرات</center></th>
							</thead>
							<tbody>
								<?php
									require 'connexion_BD/connect.php' ;
									header( 'content-type: text/html; charset=utf-8' );				
									$req = $db->query('SELECT * FROM tb_modakirat order by id desc ');						
									while($data = $req->fetch()){
											$id = $data['id'];
											$url_de_fichier = $data['file_url'];									
											$nom_de_fichier = $data['name_file'];
											$date_creation = $data['date_creation'];
											$sujet = $data['sujet'];
											echo '<tr><td>' .$sujet.'</td>' ;
											echo "<td><center>" .$date_creation. "</center></td>";
											echo '<td><center><a href= "'.$url_de_fichier.'">Afficher</a></center></td></tr>';
									} 
								?>		
							</tbody>
						</table>
				</div>
			</div>
		</div>
	</body>
</html>
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 
########## Page Modifier #########

	<?php					 
		header( 'content-type: text/html; charset=utf-8');
		$suj = "";
		$dat= "";
		if(isset($_GET["id"])){		
			$id = $_GET["id"];	
			if(!empty($id) && is_numeric($id)){		
				include 'connexion_BD/connect.php' ;
				$req = "SELECT * FROM tb_modakirat where id=$id";		
				$res = $db->query($req);	
				$data = $res->fetchAll();		
				$suj = $data[0]['sujet'];
				$dat = $data[0]['date_creation'];			
			}
		}
	?>
<!Doctype html>
<html lang = "ar" dir="rtl">
	<head>
		<title> المذكرات الوزارية </title>
		<meta charset = "utf-8"/>	
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="style/css/Bootstrap v3.3.0.css" rel="stylesheet" id="bootstrap-css">
		<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
		<link href="style/css/style_ajouter_modifier.css" rel="stylesheet">
		<link href="https://necolas.github.io/normalize.css/8.0.0/normalize.css" rel="stylesheet">
		<link href="style/css/normalize.css" rel="stylesheet">		
	</head>
	<body>
		<form method="post" class="form-signin" enctype="multipart/form-data">
		<h2>إضافة المذكرات الوزارية</h2>
		<div class="form-group">		
		<label>الموضوع</label>	
		<input type = "text" class="form-control" value = "<?=$suj;?>" name="sujet" /></br>
		<label>التاريخ</label>
		<input type = "date" class="form-control" value = "<?=$dat;?>" name = "date_creation" /></br>
		<label>تحميل المذكرة</label>
		<input type="file" class = "btn-link " name="files[]" multiple /></br>
		<p class="help-block">المرجو تحميل المذكرة من هنا...</p>
		<input  type="submit" class = "btn btn-primary" value = "Modifier" name = "valide" />
		<input  type="reset" class = "btn btn-primary" name = "Reset" />
		<input  type="submit" class = "btn btn-primary" value="Annuler" name = "annuler"/>
		<?php
			require 'connexion_BD/connect.php' ;
			header('content-type: text/html; charset=utf-8' );
			if(isset($_POST['valide'])){
				if(isset($_GET["id"]) && isset($_POST["sujet"]) && isset($_POST["date_creation"])){ 
					$id = $_GET["id"];
					$sujet = mysql_real_escape_string(htmlspecialchars($_POST['sujet']));
					$date_creation = $_POST['date_creation'];
					$files = $_FILES['files'];
					$failed = array();
					$allowed = array('PHP', 'php');
					if(!empty($files['name'][0])){
						foreach($files['name'] as $position => $file_name){
							$file_ext = explode('.' , $file_name);
							$file_ext = strtolower(end($file_ext));
							if(in_array($file_ext , $allowed)){
								echo '</br>erreur : les extensions PHP sont refuser!!! ';
								exit;
							}
							$file_error = $files['error'][$position];
							if($file_error === 0 ){	
								$file_ext = explode('.' , $file_name);
								$file_ext = strtolower(end($file_ext));
								$file_tmp = $files['tmp_name'][$position];
								$req = $db->query('SELECT * FROM tb_modakirat');
								$data = $req->fetchAll();
								$totale = count($data);
								$filename = "Telecharger".$totale.".".$file_ext;
								$file_dest ='files/'.$filename;
								if(move_uploaded_file($file_tmp, $file_dest)){
									$req = $db->query('SELECT * FROM tb_modakirat');						
									while($data = $req->fetch()){
										if($file_dest == $data['file_url']){
											echo '</br>le file ou le nom de file est deja exist';
											exit;
										}
									}
									$req = $db->prepare('update tb_modakirat set file_url = ? , name_file=? , sujet = ?, date_creation=? where id=?');
									$req->execute(array($file_dest,  $filename, $sujet, $date_creation , $id));
									header("Location:Admin.php");
								}
								else{
									$failed[$position] = "[{$file_name}] failed to upload";
								}
							}
							else {
								$failed[$position] = "[{$file_name}] errored with code {$file_error}.";
							}
						}
						
					}
					if(!empty($failed)){
						print_r($failed);		
					}	
				}
				else{
					$req = "UPDATE tb_modakirat set sujet='$sujet', date_creation='$date_creation' where id=$id";
					$db->exec($req);
					header("Location:Admin.php");
				}	
			}	
			else if(isset($_POST['annuler'])){
				header("Location:Admin.php");
			}			
		?>
			</form>
	</body>
</html>
0
fabdessamad Messages postés 34 Date d'inscription   Statut Membre Dernière intervention  
 
###########Page AJOUTER#########
<!Doctype html>
<html lang = "ar" dir="rtl">
	<head>
		<meta charset = "utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1">		
		<link href="style/css/Bootstrap v3.3.0.css" rel="stylesheet" id="bootstrap-css">
		<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
		<link href="style/css/style_ajouter_modifier.css" rel="stylesheet">
		<link href="https://necolas.github.io/normalize.css/8.0.0/normalize.css" rel="stylesheet">
		<link href="style/css/normalize.css" rel="stylesheet">
		<title> المذكرات الوزارية </title>	
	</head>
	<body>
		<form method="post" class="form-signin" enctype="multipart/form-data">
		<h2>إضافة المذكرات الوزارية</h2>
		<div class="form-group">		
		<label>الموضوع</label>	
		<input type = "textarea" class="form-control" placeholder="موضوع المذكرة" name="sujet" required /></br>
		<label>التاريخ</label>
		<input type = "date" class="form-control" name = "date_creation" /></br>
		<label>تحميل المذكرة</label>
		<input type="file" class = "btn-link " name="files[]" multiple required /></br>
		<p class="help-block">المرجو تحميل المذكرة من هنا...</p>
		<input  type="submit"  class = "btn btn-primary" name="ajouter" value="Ajouter"/>
		<input  type="reset" class = "btn btn-primary" name = "reset"/>
			
			<?php
				require'connexion_BD/connect.php';
				header('content-type: text/html; charset=utf-8' );
				if(isset($_POST['ajouter'])){
					$sujet = mysql_real_escape_string(htmlspecialchars($_POST['sujet']));
					$date_creation = $_POST['date_creation'];
					$files = $_FILES['files'];
					$failed = array();
					//$allowed = array('docx' , 'pdf', 'PDF','jpeg', 'BMP','gif', 'TIF', 'TIFF',);
					$allowed = array('PHP', 'php');
					if(!empty($files['name'][0])){
						foreach($files['name'] as $position => $file_name){
							$file_ext = explode('.' , $file_name);
							$file_ext = strtolower(end($file_ext));
							if(in_array($file_ext , $allowed)){
								echo '</br>erreur : les extensions PHP sont refuser!!! ';
								exit;
							}
							$file_error = $files['error'][$position];
							if($file_error === 0 ){
								$file_ext = explode('.' , $file_name);
								$file_ext = strtolower(end($file_ext));
								$file_tmp = $files['tmp_name'][$position];
								$req = $db->query('SELECT * FROM tb_modakirat');
								$data = $req->fetchAll();
								$totale = count($data);					
								$file_name = "Telecharger".$totale.".".$file_ext;
								$file_dest ='files/'.$file_name;
								if(move_uploaded_file($file_tmp, $file_dest)){
									$req = $db->query('SELECT * FROM tb_modakirat');						
											while($data = $req->fetch()){
												if($file_dest == $data['file_url']){
													echo 'le file ou le nom de file est déja exist';
													break;
												}
											}
									$req = $db->prepare('INSERT INTO tb_modakirat VALUES(?,?,?,?,?)');
									$req->execute(array('',$file_dest, $file_name, $sujet, $date_creation));
									$nbr_de_uploaded++;
									header("Location:Admin.php");
								}										
							}
							else{
								$failed[$position] = "[{$file_name}] errored with code {$file_error}.";
							}	
						}	
					} 
					if(!empty($failed)){
						print_r($failed);		
					}	
				}	
				
			?>
			
		</form>
	
	</body>
</html>
0