Page 1 sur 1

Problème avec register_global = OFF

Posté : 09 mars 2006, 14:07
par rarnold
Bonjour à tous j'ai un petit soucis, je n'arrive plus a utiliser la focntion de mon script qui utilise jpgraph!

Code : Tout sélectionner

<? include ( "***/jpgraph/jpgraph.php"); include ("***/jpgraph/jpgraph_line.php"); // The callback that converts timestamp to minutes and seconds function TimeCallback($aVal) { return Date('H:i:s',$aVal); } if ($nomfile == "") { echo("<h3>Le champ nom est vide !</h3>"); $valide = false; } else { $readfile = file($nomfile); } for ($k=1; $k<=count($readfile)-1; $k++) { $fields = split("\t",$readfile[$k]); $temps[] = $fields[0]*60; $powerc[] = $fields[1]; $power[] = $fields[2]; $presc[] = $fields[3]; $press[] = $fields[4]; $temp[] = $fields[5]; $depla[]= $fields[6]/10; } //$delta_t = $temps[1]-$temps[0] //Set data to plot switch($plot1) { case 0: $ydata = $power; break; case 1: $ydata = $temp; break; case 2: $ydata = $press; break; case 3: $ydata = $presc; break; case 4: $ydata = $powerc; break; case 5: $ydata = $depla; break; } switch($plot2) { case 0: $y2data = $power; break; case 1: $y2data = $temp; break; case 2: $y2data = $press; break; case 3: $y2data = $presc; break; case 4: $y2data = $powerc; break; case 5: $y2data = $depla; break; } // Create the graph. These two calls are always required $graph = new Graph(750,375,"auto"); $graph->img->SetMargin(50,100,50,75); //$graph->SetScale("textlin"); $graph->SetScale("linlin"); $graph->SetShadow(); $interval=$k/10; $graph->xaxis->SetTextTickInterval($interval,1); $graph->SetY2Scale("lin"); // Create the linear plot $xdata=$temps; $lineplot=new LinePlot($ydata,$xdata); $lineplot2=new LinePlot($y2data,$xdata); switch($plot1) { case 0: $lineplot ->SetLegend("P(W)"); break; case 1: $lineplot ->SetLegend("T(C)"); break; case 2: $lineplot ->SetLegend("P(bar)"); break; case 3: $lineplot ->SetLegend("Pc(bar)"); break; case 4: $lineplot ->SetLegend("Pc(W)"); break; case 5: $lineplot ->SetLegend("d(mm)"); break; } switch($plot2) { case 0: $lineplot2 ->SetLegend("P(W)"); break; case 1: $lineplot2 ->SetLegend("T(C)"); break; case 2: $lineplot2 ->SetLegend("P(bar)"); break; case 3: $lineplot2 ->SetLegend("Pc(bar)"); break; case 4: $lineplot2 ->SetLegend("Pc(W)"); break; case 5: $lineplot2 ->SetLegend("d(mm)"); break; } $graph ->legend->Pos( 0.01,0.5,"right" ,"center"); // Add the plot to the graph $graph->Add($lineplot); $graph->AddY2($lineplot2); $lineplot2->SetColor("orange"); $lineplot2->SetWeight(2); $graph->y2axis->SetColor("orange"); $graph->title->Set("Belt parameters ON LINE"); //$graph->xaxis->title->Set("Time x step "); //$graph->yaxis->title->Set("Belt on line"); $graph->title->SetFont(FF_FONT1,FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); $graph->xaxis->SetLabelFormatCallback('TimeCallback'); $graph->xaxis->SetLabelAngle(90); $lineplot->SetColor("blue"); $lineplot->SetWeight(2); $lineplot2->SetColor("orange"); $lineplot2->SetWeight(2); $graph->yaxis->SetColor("blue");// Display the graph $graph->Stroke(); //$graph ->Stroke("***/images/result2002.png" ); ?>
Si quelqu'un peus m'aider je rappelle que la fonction register_globals est desactiver sur mon hébergeur !

Re: Problème avec register_global = OFF

Posté : 09 mars 2006, 14:29
par rarnold

Code : Tout sélectionner

<? include ( "***/jpgraph/jpgraph.php"); include ("***/jpgraph/jpgraph_line.php"); /
Si quelqu'un peus m'aider je rappelle que la fonction register_globals est desactiver sur mon hébergeur !
voilà j'ai finalement trouvé :)
Il est necessaire de rajouter les lignes suivantes:

Code : Tout sélectionner

<? foreach ($_POST as $key => $value) $$key = addslashes($value); foreach ($_GET as $key => $value) $$key = addslashes($value); ?> <? include ( "***/jpgraph/jpgraph.php"); include ("***/jpgraph/jpgraph_line.php");
Juste avant le script lui meme