par
Invité » 14 mars 2009, 14:49
j'ai essayé de mettre 2 script ensemble en les modifient un peu j'ai une erreur sur ma page :
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mon-id'@'serveur.mavenfrance8.com' (using password: YES) in /home/mon-id/public_html/son/upload/upload.php on line 83
Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'mon-id'@'localhost' (using password: NO) in /home/mon-id/public_html/son/upload/upload.php on line 85
Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/mon-id/public_html/son/upload/upload.php on line 85
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/mon-id/public_html/son/upload/upload.php on line 101
Access denied for user 'mon-id'@'localhost' (using password: NO)
voici mon code :
Code : Tout sélectionner
<?php
require_once('config.php');
if(isset($_POST['submit']))
{
if($_FILES['fichier']['size']>$poids_max)
{
$message='Le fichier est trop lourd !';
}
else
{
$name_fichier=$_FILES['fichier']['name'];
$extension_upload=substr(strrchr($_FILES['fichier']['name'], '.') ,1);
$name_file1=substr($name_fichier, 0, strrpos($name_fichier, '.'));
$caracteres = array('\'', ' ', '\\', '*', '%', 'ù', ';', ',');
$name_file=str_replace($caracteres, '', $name_file1);
if(in_array($extension_upload,$extensions_autorisees))
{
$nom=getName('uploads/',$name_file,$extension_upload);
move_uploaded_file($_FILES['fichier']['tmp_name'],$nom);
$message='Votre fichier a bien été uploadé. Il est disponible à l\'adresse suivante :<br /><a href="'.$url_site.$nom.'">'.$url_site.$nom.'</a><br /><br /><a href=\'upload.php\'>Retour à la page d\'upload</a>';
$message='Votre fichier a bien été uploadé. Il est disponible à l\'adresse suivante :<br /><a href="'.$url_site.$nom.'">'.$url_site.$nom.'</a><br /><textarea cols="50" rows="3" name="text"><a href="'.$url_site.$nom.'">'.$url_site.$nom.'</a></textarea><br />Pour les forums, voilà le code : <br /><textarea cols="50" rows="3" name="text">[url=http://www.decoupe-fr.com/forums/][img]'.$url_site.$nom.'[/img][/url]</textarea><br /><br /><a href=\'upload.php\'>Retour à la page d\'upload</a>';
}
else
{
$message='L\'extension n\'est pas autorisée';
}
}
echo $message;
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Upload de fichiers</title>
</head>
<body>
<form method="post" action="" enctype="multipart/form-data">
<label for="fichier">Fichier (Poids max. : <?php echo intval($poids_max/1000000); ?> Mo)</label><br />
<input type="file" name="fichier" id="fichier" size="30" /><br /><br />
<input type="submit" name="submit" value="Envoyer" />
</form>
echo "</body>
</html>
<?php
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN"
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
<html Xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mailing</title>
<link href="formulaire.css" rel="stylesheet" type="text/css" />
</head>
<form name="insertion" action="insertion2.php" method="POST">
<table border="0" align="center" cellspacing="2" cellpadding="2">
<tr align="center">
<td>titre</td>
<td><input type="text" name="titre"></td>
</tr>
<tr align="center">
<td>artiste</td>
<td><input type="text" name="artiste"></td>
</tr>
<tr align="genre">
<td>genre</td>
<td><input type="text" name="genre"></td>
</tr>
</table>
</form>
</body>
</html>";
<?php
//connection au serveur
$cnx = mysql_connect( "mon-ftp", "mon-id", "mon-pass" ) ;
//sélection de la base de données:
$db = mysql_select_db( "doofxcomp3" ) ;
//récupération des valeurs des champs:
//label:
$label = $_POST["titre"] ;
//reference:
$reference = $_POST["artiste"] ;
//artiste:
$artiste = $_POST["genre"] ;
//création de la requête SQL:
$sql = "INSERT INTO handsandarms (titre, artiste, genre,)
VALUES ( '$titre', '$artiste', '$genre') " ;
//exécution de la requête SQL:
$requete = mysql_query($sql, $cnx) or die( mysql_error() ) ;
//affichage des résultats, pour savoir si l'insertion a marchée:
if($requete)
{
echo("L'insertion a été correctement effectuée") ;
}
else
{
echo("L'insertion à échouée") ;
}
?>
si je compren bien il n'arrive pas a ce connecté a la base de donné mais je ne vois pas ou est l'erreur
merci pour votre aide [/code]
j'ai essayé de mettre 2 script ensemble en les modifient un peu j'ai une erreur sur ma page :
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mon-id'@'serveur.mavenfrance8.com' (using password: YES) in /home/mon-id/public_html/son/upload/upload.php on line 83
Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'mon-id'@'localhost' (using password: NO) in /home/mon-id/public_html/son/upload/upload.php on line 85
Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/mon-id/public_html/son/upload/upload.php on line 85
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/mon-id/public_html/son/upload/upload.php on line 101
Access denied for user 'mon-id'@'localhost' (using password: NO)
voici mon code :
[code]<?php
require_once('config.php');
if(isset($_POST['submit']))
{
if($_FILES['fichier']['size']>$poids_max)
{
$message='Le fichier est trop lourd !';
}
else
{
$name_fichier=$_FILES['fichier']['name'];
$extension_upload=substr(strrchr($_FILES['fichier']['name'], '.') ,1);
$name_file1=substr($name_fichier, 0, strrpos($name_fichier, '.'));
$caracteres = array('\'', ' ', '\\', '*', '%', 'ù', ';', ',');
$name_file=str_replace($caracteres, '', $name_file1);
if(in_array($extension_upload,$extensions_autorisees))
{
$nom=getName('uploads/',$name_file,$extension_upload);
move_uploaded_file($_FILES['fichier']['tmp_name'],$nom);
$message='Votre fichier a bien été uploadé. Il est disponible à l\'adresse suivante :<br /><a href="'.$url_site.$nom.'">'.$url_site.$nom.'</a><br /><br /><a href=\'upload.php\'>Retour à la page d\'upload</a>';
$message='Votre fichier a bien été uploadé. Il est disponible à l\'adresse suivante :<br /><a href="'.$url_site.$nom.'">'.$url_site.$nom.'</a><br /><textarea cols="50" rows="3" name="text"><a href="'.$url_site.$nom.'">'.$url_site.$nom.'</a></textarea><br />Pour les forums, voilà le code : <br /><textarea cols="50" rows="3" name="text">[url=http://www.decoupe-fr.com/forums/][img]'.$url_site.$nom.'[/img][/url]</textarea><br /><br /><a href=\'upload.php\'>Retour à la page d\'upload</a>';
}
else
{
$message='L\'extension n\'est pas autorisée';
}
}
echo $message;
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Upload de fichiers</title>
</head>
<body>
<form method="post" action="" enctype="multipart/form-data">
<label for="fichier">Fichier (Poids max. : <?php echo intval($poids_max/1000000); ?> Mo)</label><br />
<input type="file" name="fichier" id="fichier" size="30" /><br /><br />
<input type="submit" name="submit" value="Envoyer" />
</form>
echo "</body>
</html>
<?php
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN"
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
<html Xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mailing</title>
<link href="formulaire.css" rel="stylesheet" type="text/css" />
</head>
<form name="insertion" action="insertion2.php" method="POST">
<table border="0" align="center" cellspacing="2" cellpadding="2">
<tr align="center">
<td>titre</td>
<td><input type="text" name="titre"></td>
</tr>
<tr align="center">
<td>artiste</td>
<td><input type="text" name="artiste"></td>
</tr>
<tr align="genre">
<td>genre</td>
<td><input type="text" name="genre"></td>
</tr>
</table>
</form>
</body>
</html>";
<?php
//connection au serveur
$cnx = mysql_connect( "mon-ftp", "mon-id", "mon-pass" ) ;
//sélection de la base de données:
$db = mysql_select_db( "doofxcomp3" ) ;
//récupération des valeurs des champs:
//label:
$label = $_POST["titre"] ;
//reference:
$reference = $_POST["artiste"] ;
//artiste:
$artiste = $_POST["genre"] ;
//création de la requête SQL:
$sql = "INSERT INTO handsandarms (titre, artiste, genre,)
VALUES ( '$titre', '$artiste', '$genre') " ;
//exécution de la requête SQL:
$requete = mysql_query($sql, $cnx) or die( mysql_error() ) ;
//affichage des résultats, pour savoir si l'insertion a marchée:
if($requete)
{
echo("L'insertion a été correctement effectuée") ;
}
else
{
echo("L'insertion à échouée") ;
}
?>
[/code]
si je compren bien il n'arrive pas a ce connecté a la base de donné mais je ne vois pas ou est l'erreur
merci pour votre aide [/code]