IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

double appel de page avec Firefox


Sujet :

Langage PHP

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2009
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2009
    Messages : 25
    Points : 19
    Points
    19
    Par défaut double appel de page avec Firefox
    Bonsoir,
    J'ai un script php qui me permet de générer un pdf, quand je l'utilise dans Firefox j'ai un double appel de la page, je n'est pourtant pas de CSS, IMG, dans mon script
    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
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    <?php 
    session_start() ; 
    if(!isset($_SESSION["email"]) || $_SESSION["status_admin"] == "0")
    {	
      header("Location: /index.php");
      exit();
    }
     
    if (isset($_GET["status_commande"]))
    {
    	$status_commande= $_GET["status_commande"];
    	$num_commande = $_GET["num_commande"];
    	$num_client = $_GET["num_client"];
     
    	include ('../include/connect.php');	
    	$sql_info_client = "SELECT * FROM client WHERE num_client = '".$num_client."'";
    	$req_info_client = mysql_query($sql_info_client) or die('Erreur SQL !<br>'.$sql_info_client.'<br>'.mysql_error());
    	$data = mysql_fetch_array($req_info_client);
     
    	if($status_commande == "1")
    	{		
    		/////////////////////////////// MAIL pour commande en preparation ///////////////////////////////////////
    		 $to      = $data['email'];
    		 $subject = 'Commande Print : N° '.$num_commande.'';
    		 $message = 'Cher/e '.$data['prenom'].' '.$data['nom'].', votre commande est en cours de réalisation'.'\r\n';
    		 $message .= '';
    		 $message = wordwrap($message, 70);
    		 $headers = 'From: service@print.be' . "\r\n" .
    		 'Reply-To: webmaster@anyprint.be' . "\r\n" .
    		 'X-Mailer: PHP/' . phpversion();
     
    		if(mail($to, $subject, $message, $headers))
    		{
    			$sql = "UPDATE `commande` SET `status_commande` = 2 WHERE `num_commande` = '$num_commande';";
    			$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());	
    			header("Location: commande_client_details.php?num_commande=$num_commande&num_client=$num_client");
    		}
    		else
    		{
    			header("Location: commande_client_details.php?num_commande=$num_commande&num_client=$num_client&mail=no");
    		} 
     
     
    	}
    	elseif($status_commande == "2")
    	{
    		/////////////////////////////// generation facture ///////////////////////////////////////
    		require('facture/tfpdf.php');
     
    		if(isset($_GET['num_commande']))
    		{
    			$num_commande = $_GET['num_commande'];
    			$num_client = $_GET['num_client'];
     
    			//generation du num de facturée
    			$result_commande_livrer = mysql_query('SELECT * FROM commande WHERE status_commande = 3');  	
    			if (!$result_commande_livrer) 
    			{
    				die('Impossible d\'exécuter la requête :' . mysql_error());
    			}
    			$total_commande_livrer = mysql_num_rows($result_commande_livrer);
    			$num_facture = 20110001 + $total_commande_livrer;
     
    			//insertion dans la db facture du num_client, num_commande et generation du num de facture
    			$sql = "INSERT INTO facture (num_commande,num_client,num_facture,status) VALUES	('$num_commande','$num_client','$num_facture','')";
    		$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
     
    			$result_info_commande = mysql_query('SELECT * FROM commande WHERE num_commande = '.$num_commande.'');
    			if (!$result_info_commande) 
    			{
    				die('Impossible d\'exécuter la requête :' . mysql_error());
    			}
    			$data_commande = mysql_fetch_array($result_info_commande);
     
    			$result_info_client = mysql_query('SELECT * FROM client WHERE num_client = '.$num_client.'');
    			if (!$result_info_client) 
    			{
    				die('Impossible d\'exécuter la requête :' . mysql_error());
    			}
    			$data_client = mysql_fetch_array($result_info_client);
     
    			$pdf=new tFPDF();
    			$pdf->SetMargins(20,20);
    			$pdf->AddPage();
    			$pdf->Image('facture/img/logo_print.png',140,20,50);
     
    			$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
    			$pdf->SetFont('DejaVu','',14);
    			$pdf->Cell(85,10,'Facture N° : '.$num_facture.'');
    			$pdf->Ln();
     
    			$pdf->SetFont('Arial','B',12);
    			$pdf->Cell(85,3,'Date: '.$data_commande['date'].'',0,1);
    			$pdf->Ln();
     
    			$pdf->Cell(85,40);
    			$pdf->Ln();
     
    			$pdf->SetFont('Arial','B',12);
    			$pdf->Cell(85,3,'De Print',0,1);
    			$pdf->Ln();
     
    			$pdf->SetFont('DejaVu','',10);
    			$pdf->MultiCell(85,5,'45, rue royale
    7500 Tournai
    Belgique
    N° TVA BE8154568464
    facture@anyprint.be',0,1);
     
     
    			$pdf->SetXY(120,77);
    			$pdf->SetFont('Arial','B',12);
    			$pdf->Cell(85,3,'Client : '.$data_commande['num_client'].'',0,1);
    			$pdf->Ln();
     
    			$pdf->SetX(120);
    			$pdf->SetFont('DejaVu','',10);
    			if($data_client["adresse_choisi"] == "0")
    			{
    			$pdf->MultiCell(85,5,''.$data_client['nom'].' '.$data_client['prenom'].'
    '.$data_client["adresse_facturation"].'
    '.$data_client["adresse_facturation_2"].'
    '.$data_client["codepostal_facturation"].' '.$data_client["ville_facturation"].'
    '.$data_client["pays_facturation"].'
    Téléphone: '.$data_client['telephone'].'
    
    Email: '.$data_client['email'].'
    N° de TVA: '.$data_client['tva_facturation'].'',0,1);
    			}
    			else
    			{
    				$pdf->MultiCell(85,5,''.$data_client['nom'].' '.$data_client['prenom'].'
    '.$data_client["adresse_societe"].'
    '.$data_client["adresse_societe_2"].'
    '.$data_client["codepostal_societe"].' '.$data_client["ville_societe"].'
    '.$data_client["pays_societe"].'
    Téléphone: '.$data_client['telephone'].'
    
    Email: '.$data_client['email'].'
    N° de TVA: '.$data_client['tva_facturation'].'',0,1);
    			}
    			$pdf->Ln();
     
    			$pdf->SetFont('Arial','B',11);
    			$pdf->Cell(85,3,'Paiement',0,1);
    			$pdf->Ln();
     
    			$pdf->SetFont('DejaVu','',10);
    			$pdf->Cell(85,3,'Effectué le '.$data_commande['date'].' a '.$data_commande['heure'].'',0,1);
     
    			//titre recap
    			$pdf->SetXY(40,156);
    			$pdf->SetFont('Arial','',10);
    			$pdf->Cell(50,3,'Produit',0,1);
     
    			$pdf->SetXY(100,156);
    			$pdf->SetFont('Arial','',10);
    			$pdf->Cell(50,3,'Description',0,1);
     
    			$pdf->SetXY(165,156);
    			$pdf->SetFont('Arial','',10);
    			$pdf->Cell(50,3,'Prix',0,1);
     
    			// ligne 1
    			$pdf->Line(20,160,190,160);
     
    			// recap
    			$pdf->SetXY(30,165);
    			$pdf->SetFont('Arial','',10);
    			$pdf->Cell(50,3,'Flyers',0,1);
     
    			$pdf->SetXY(90,165);
    			$pdf->SetFont('DejaVu','',9);
    			$pdf->MultiCell(50,4,'Grammage : '.$data_commande['grammage'].'
    Format : '.$data_commande['format'].'
    Impression : '.$data_commande['impression'].'
    Pelliculage : '.$data_commande['pelliculage'].'
    Finition : '.$data_commande['finition'].'
    Quantité : '.$data_commande['quantite'].'
    Livrer en : '.$data_commande['delais'].' jours',0,1);
     
    			$pdf->SetXY(160,165);
    			$pdf->SetFont('DejaVu','',10);
    			$pdf->Cell(50,3,'125,00 €',0,1);
     
    			//ligne 2
    			$pdf->Line(20,198,190,198);
     
    			$pdf->SetXY(150,205);
    			$pdf->SetFont('DejaVu','',10);
    			$pdf->Cell(50,3,'Prix HT : 125,00 €',0,1);
     
    			$pdf->SetXY(148,210);
    			$pdf->SetFont('DejaVu','',10);
    			$pdf->Cell(50,3,'Prix TTC :',0,1);
     
    			$pdf->SetXY(165,210);
    			$pdf->SetFont('DejaVu','',10);
    			$pdf->Cell(50,3,'145,00 €',0,1);
     
    			//footer
    			$pdf->SetY(270);
    			$pdf->SetFont('DejaVu','',10);
    			$pdf->Cell(170,3,'www.print.com',0,1,'C');
     
    			$pdf->Output('facture/facture_all/Facture-'.$num_facture.'.pdf','F');
    			$pdf->Close();
    		}
    		else
    		{
    			header("Location: admin/facture_client_all.php");
    		}
     
     
    		/////////////////////////////// MAIL pour commande livrer ///////////////////////////////////////
    		$to      = $data['email'];
    		$subject = 'Commande Any Print : N° '.$num_commande.'';
    		$message = 'Cher/e '.$data['prenom'].' '.$data['nom'].', commande livrer'.'\r\n';
    		$message .= '';
    		$message = wordwrap($message, 70);
    		$headers = 'From: service@print.be' . "\r\n" .
    		'Reply-To: webmaster@print.be' . "\r\n" .
    		'X-Mailer: PHP/' . phpversion();
    		// si mail envoyer, on update le champ status commande
    		if(mail($to, $subject, $message, $headers))
    		{
    			$sql = "UPDATE `commande` SET `status_commande` = 3 WHERE `num_commande` = '$num_commande';";
    			$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());	
    			header("Location: commande_client_details.php?num_commande=$num_commande&num_client=$num_client");
    		}
    		// Sinon mail pas envoyer, mail=no
    		else
    		{
    			header("Location: commande_client_details.php?num_commande=$num_commande&num_client=$num_client&mail=no");
    		} 
    	}
    	else
    	{
    		header("Location: commande_client_details.php?num_commande=$num_commande&num_client=$num_client");
    	}
    	mysql_close(); 	
    }
    else
    {
    	header("Location: commande_client_all.php");
    }	
    ?>

  2. #2
    Membre émérite
    Avatar de Eric2a
    Homme Profil pro
    Technicien
    Inscrit en
    Septembre 2005
    Messages
    1 225
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Corse (Corse)

    Informations professionnelles :
    Activité : Technicien

    Informations forums :
    Inscription : Septembre 2005
    Messages : 1 225
    Points : 2 411
    Points
    2 411
    Par défaut
    Salut,

    Place un appel à la fonction exit() après chaque
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    header('Location: ...');
    pour voir...

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2009
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2009
    Messages : 25
    Points : 19
    Points
    19
    Par défaut re :)
    heuu oui, c'est la première chose que j'ai essayer, mais ca ne fonctionne pas, j'ai un double appel de page quand je passe en $status_commande == "2"

Discussions similaires

  1. Appeler des pages avec MenuBar
    Par nathy31 dans le forum GWT et Vaadin
    Réponses: 3
    Dernier message: 23/06/2011, 14h45
  2. Impression une seule page avec Firefox
    Par cdlr27 dans le forum Firefox
    Réponses: 3
    Dernier message: 19/01/2009, 21h53
  3. Effet fondu entre 2 pages avec Firefox
    Par identifiant_bidon dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 10/09/2008, 11h26
  4. [AJAX] Appel de plusieurs pages avec Ajax
    Par shadowbob dans le forum Général JavaScript
    Réponses: 16
    Dernier message: 13/02/2006, 18h29
  5. Son dans une page Web avec Firefox
    Par diod dans le forum Applications et environnements graphiques
    Réponses: 4
    Dernier message: 02/12/2005, 17h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo