| 12
 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
 
 | <?php 
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{ 
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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']); 
} 
$nom = $_POST['nom']; 
$prenom = $_POST['prenom']; 
$email = $_POST['email']; 
$ref = $_POST['reference']; 
$adresse = $_POST['adresse']; 
$ville = $_POST['ville']; 
$cp = $_POST['cp']; 
$tel = $_POST['tel']; 
$date = date("d-m-Y"); 
$heure = date("H"); 
$minutes = date("i"); 
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) { 
$insertSQL = sprintf("INSERT INTO auteurs (ID, nom, prenom, adresse, ville, cp, tel, email, pass, statut, reference) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", 
GetSQLValueString($_POST['ID'], "int"), 
GetSQLValueString($nom, "text"), 
GetSQLValueString($prenom, "text"), 
GetSQLValueString($adresse, "text"), 
GetSQLValueString($ville, "text"), 
GetSQLValueString($cp, "text"), 
GetSQLValueString($tel, "text"), 
GetSQLValueString($email, "text"), 
GetSQLValueString($_POST['pass'], "text"), 
GetSQLValueString($_POST['statut'], "text"), 
GetSQLValueString($ref, "text")); 
mysql_select_db($database_Connexionbook, $Connexionbook); 
$Result1 = mysql_query($insertSQL, $Connexionbook) or die(mysql_error()); 
if ($_FILES['nom_du_fichier']['error']) { 
switch ($_FILES['nom_du_fichier']['error']){ 
case 1: // UPLOAD_ERR_INI_SIZE 
echo"Le fichier dépasse la limite autorisée"; 
break; 
case 2: // UPLOAD_ERR_FORM_SIZE 
echo "Le fichier dépasse la limite autorisée dans le formulaire HTML !"; 
break; 
case 3: // UPLOAD_ERR_PARTIAL 
echo "L'envoi du fichier a été interrompu pendant le transfert !"; 
break; 
case 4: // UPLOAD_ERR_NO_FILE 
echo "Le fichier que vous avez envoyé a une taille nulle !"; 
break; 
} 
$insertGoTo = "../index.php"; 
} 
else { 
// $_FILES['nom_du_fichier']['error'] vaut 0 soit UPLOAD_ERR_OK 
// ce qui signifie qu'il n'y a eu aucune erreur 
$titre = $_FILES['nom_du_fichier']['name']; 
move_uploaded_file ($_FILES['nom_du_fichier']['tmp_name'],"/homez.116/bookimpu/www/manuscrit/".$titre); 
$headers1 ='From: "Book"<commande@book.com>'."\n"; 
$headers1 .='Reply-To: <a href="mailto:ut@book.com">ut@book.com</a>'."\n"; 
$headers1 .='Content-Type: text/html; charset="iso-8859-1"'."\n"; 
$headers1 .='Content-Transfer-Encoding: 8bit'; 
$message ='<html><head><title>Nouveau manuscrit</title></head> 
<body> 
Un nouveau manuscrit est disponible dans le dossier : www/manuscrit<br/> 
Nom du fichier : '.$titre.'<br/> 
Référence : '.$ref.'<br/> 
Auteur : '.$prenom.' '.$nom.' ('.$email.')<br/> 
Date : '.$date.' à '.$heure.'h'.$minutes.' 
</body></html>'; 
mail('commande@book.com', 'Nouveau manuscrit', $message, $headers1); 
$headers2 ='From: "Book"<commande@book.com>'."\n"; 
$headers2 .='Reply-To: <a href="mailto:ut@book.com">ut@book.com</a>'."\n"; 
$headers2 .='Content-Type: text/html; charset="iso-8859-1"'."\n"; 
$headers2 .='Content-Transfer-Encoding: 8bit'; 
$message2 ='<html><head><title>Félicitations !</title></head> 
<body> 
Si une des informations ci-dessous est incorrect, merci de répondre à cet email : <br/> 
Prénom : '.$prenom.'<br/> 
Nom : '.$nom.'<br/> 
Téléphone : '.$tel.'<br/><br/> 
</body></html>'; 
mail($email, 'Félicitations !', $message2, $headers2); 
$insertGoTo ="?page=validationManuscrit.php"; 
} 
if (isset($_SERVER['QUERY_STRING'])) { 
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; 
$insertGoTo .= $_SERVER['QUERY_STRING']; 
} 
@header(sprintf("Location: %s", $insertGoTo)); 
} 
mysql_select_db($database_Connexionbook, $Connexionbook); 
$query_rsAuteurs = "SELECT * FROM auteurs"; 
$rsAuteurs = mysql_query($query_rsAuteurs, $Connexionbook) or die(mysql_error()); 
$row_rsAuteurs = mysql_fetch_assoc($rsAuteurs); 
$totalRows_rsAuteurs = mysql_num_rows($rsAuteurs); 
?> | 
Partager