8791 sujets

Développement web côté serveur, CMS

Bonjour, j'ai regarder sur plusieurs forum des sujets liés à mon problème mais je ne comprend pas! Donc je post ici:

Mon souci:
J'ai des fichiers uploader dans un dossier _admin/upload, par le biais d'une fonction "
move_uploded_file
"

Cependant j'aimerais afficher le contenu de ce dossier donc les images les pdf qui se trouve dedans dans mes pages de mon site via ma base de donnée MySql.

Le problème j'y arrive pas. Je connais pas la syntaxe donc je vous mets ci-dessous mon fichier php qui gère l'upload
Ma page galerie photo ou je dois afficher les photos via ma base de donnée en allant chercher mes photos dans le dossier _admin/upload

J'ai entendu dire qu'il fallait "concaténer" des variables pour afficher le chemin complet de l'image... Mais je ne sais pas faire! et je comprends pas trop.

Mon code Php:
<?php /*?><?php error_reporting(-1)?><?php */?>
<?php

//	---------------------------------------------
//	Pure PHP Upload version 1.1
//	-------------------------------------------
if (phpversion() > "4.0.6") {
	
	$HTTP_POST_FILES = &$_FILES;
}
define("MAX_SIZE",0);
define("DESTINATION_FOLDER", "../_admin/upload");
define("no_error", "sucess.php");
define("yes_error", "error.php");
$_accepted_extensions_ = "pdf,doc,docx,png,jpg";
if(strlen($_accepted_extensions_) > 0){
	$_accepted_extensions_ = @explode(",",$_accepted_extensions_);
} else {
	$_accepted_extensions_ = array();
}
/*	modify */
if(!empty($HTTP_POST_FILES['dl_fichier'])){
	if(is_uploaded_file($HTTP_POST_FILES['dl_fichier']['tmp_name']) && $HTTP_POST_FILES['dl_fichier']['error'] == 0){
		$_file_ = $HTTP_POST_FILES['dl_fichier'];
		$errStr = "";
		$_name_ = $_file_['name'];
		$_type_ = $_file_['type'];
		$_tmp_name_ = $_file_['tmp_name'];
		$_size_ = $_file_['size'];
		if($_size_ > MAX_SIZE && MAX_SIZE > 0){
			$errStr = "File troppo pesante";
		}
		$_ext_ = explode(".", $_name_);
		$_ext_ = strtolower($_ext_[count($_ext_)-1]);
		if(!in_array($_ext_, $_accepted_extensions_) && count($_accepted_extensions_) > 0){
			$errStr = "Estensione non valida";
		}
		if(!is_dir(DESTINATION_FOLDER) && is_writeable(DESTINATION_FOLDER)){
			$errStr = "Cartella di destinazione non valida";
		}
		if(empty($errStr)){
			if(@move_uploaded_file($_tmp_name_,DESTINATION_FOLDER . "/" . $_name_)){
				header("Location: " . no_error);
			} else {
				header("Location: " . yes_error);
			}
		} else {
			header("Location: " . yes_error);
		}
	}
}
?>
<?php require_once('../Connections/obvrly.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "bulletin")) {
  $insertSQL = sprintf("INSERT INTO download (dl_id, dl_titre, dl_fichier, dl_online) VALUES (%s, %s, '$_name_', %s)",
                       GetSQLValueString($_POST['dl_id'], "int"),
                       GetSQLValueString($_POST['dl_titre'], "text"),
                       GetSQLValueString($_POST['dl_online'], "int"));
					   

  mysql_select_db($database_obvrly, $obvrly);
  $Result1 = mysql_query($insertSQL, $obvrly) or die(mysql_error());

  $insertGoTo = "sucess.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?> 


Mon code php de ma Light-box:

<body>
<div id="gallery" class="lbGallery">
  <ul>      
  	<li> <a href="images/lightboxdemo1.jpg" title=""><img src="images/lightboxdemo1.jpg" width="72" height="72" alt="Flower" /></a> </li> 
    <li> <a href="images/lightboxdemo1.jpg" title=""><img src="images/lightboxdemo_thumb1.jpg" width="72" height="72" alt="Flower" /></a> </li>
    <li> <a href="images/lightboxdemo2.jpg" title=""><img src="images/lightboxdemo_thumb2.jpg" width="72" height="72" alt="Tree" /></a> </li>
    <li> <a href="images/lightboxdemo3.jpg" title=""><img src="images/lightboxdemo_thumb3.jpg" width="72" height="72" alt="" /></a> </li>
    <li> <a href="images/lightboxdemo4.jpg" title=""><img src="images/lightboxdemo_thumb4.jpg" width="72" height="72" alt="" /></a> </li>
    <li> <a href="images/lightboxdemo5.jpg" title=""><img src="images/lightboxdemo_thumb5.jpg" width="72" height="72" alt="" /></a> </li>
  </ul>
</div>
<script type="text/javascript">
// BeginOAWidget_Instance_2127022: #gallery

		$(function(){
			$('#gallery a').lightBox({ 
				imageLoading:			'images/lightbox/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
				imageBtnPrev:			'images/lightbox/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
				imageBtnNext:			'images/lightbox/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
				imageBtnClose:			'images/lightbox/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
				imageBlank:				'images/lightbox/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)
				fixedNavigation:		false,		// (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.
				containerResizeSpeed:	400,			 // Specify the resize duration of container image. These number are miliseconds. 400 is default.
				overlayBgColor: 		"#999999",		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
				overlayOpacity:			.6,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
				txtImage:				'Image',				//Default text of image
				txtOf:					'of'
			});
		});
		
// EndOAWidget_Instance_2127022
</script>
</body>


Mon jeu d'enregistrement de ma table "galerie":
$row_Rs_affich_photo['galerie_id'];
$row_Rs_affich_photo['galerie_titre']
$row_Rs_affich_photo['galerie_photo']
$row_Rs_affich_photo['galerie_online']


Voilà c pour mon travail du coup c assez important, ca serait super de m'aider voir de me donner le code.

Merci! Smiley ohwell