Sign in to follow this  
LWD

Problema Na Função Fprintf()

Recommended Posts

Olá!

Eu estou tentando rodar um script mas esta dando este erro:

Fatal error: Call to undefined function: fprintf() in c:\arquivos de programas\apache group\apache\htdocs\mule-commit-to-mule.php on line 89

Alguém pode me ajudar a resolver? estou tentando arrumar mas sem sucesso, pois sou iniciante no PHP...

Obrigado!

Script:

<html>
<head><link rel=stylesheet type=text/css href=style.css></head>
<body>
<center>


<table width=600px cellspacing=0 cellpadding=0>
<tr><td><img src=images/ptop.png /></td></tr>
<tr><td background=images/parch.png>
<center>
<table width=85%><tr><td>

<center>
<p class=book><font size=+2>Quittance</font></p>

<p class=book>Vous avez transféré</p>
<p class=book>

<?php

require_once "mule-read-inventories.php";

$conn = odbc_connect ("Servidor", "Account", "Password");

// Parcourt la liste des items dans l'équipement du joueur
for ($playeritem_index = 0; $playeritem_index < $playeritem_count; $playeritem_index++)
{
   // Veut-on transférer cet item ?
   if ($_POST["iusr" . $playeritem_index] > 0)
   {
      // Identifie chaque part de la ligne existante de l'objet
      $object = explode ("|", $playeritem[$playeritem_index], 6);
      $ItemsID = $object[0];
      $ObjID = $object[1];
      $OwnerID = $object[2];
      $EquipPos = $object[3];
      $ObjType = $object[5];

      // Commence par vérifier les quantités
      if ($_POST["iusr" . $playeritem_index] <= $object[4])
         $WantedQty = $_POST["iusr" . $playeritem_index];
      else
         $WantedQty = $object[4];

      echo $WantedQty . " " . $object[5] . "<br />\n"; // affiche une ligne

      // Parcourt la liste des items dans le coffre du joueur
      for ($muleitem_index = 0; $muleitem_index < $muleitem_count; $muleitem_index++)
      {
         $muleobject = explode ("|", $muleitem[$muleitem_index], 6);

         if (strcasecmp ($muleobject[5], $object[5]) == 0)
            break; // Arrête dès qu'on trouve un objet similaire
      }

      // N'a-t-on PAS trouvé un objet similaire ?
      if ($muleitem_index == $muleitem_count)
      {
         $muleitem[$muleitem_index] = sprintf ("%d|%d|%d|%d|%d|%s", $ItemsID, $ObjID, $OwnerID, $EquipPos, $WantedQty, $ObjType);
         $muleitem_count++;
      }

      // Sinon, ajoute la quantité demandée de ce même objet
      else
      {
         $Qty = $muleobject[4] + $WantedQty;
         $muleitem[$muleitem_index] = sprintf ("%d|%d|%d|%d|%d|%s", $ItemsID, $ObjID, $OwnerID, $EquipPos, $Qty, $ObjType);
      }

      // Finalement, supprime la quantité désirée de l'objet dans l'inventaire du joueur (ou supprime carrément l'objet)
      if ($object[4] - $WantedQty > 0)
         odbc_exec ($conn, "UPDATE PlayerItems SET Qty=" . ($object[4] - $WantedQty) . " WHERE ItemsID=" . $ItemsID);
      else
         odbc_exec ($conn, "UPDATE PlayerItems SET OwnerID=484 WHERE ItemsID=" . $ItemsID);
   }
}

odbc_close ($conn);

// Réécrit maintenant le fichier de mule dans son intégralité
$fp = fopen ("C:/t4c/T4C Server/mules/" . $_POST["uid"], "w");
for ($muleitem_index = 0; $muleitem_index < $muleitem_count; $muleitem_index++)
   if ($muleitem[$muleitem_index] != "")
      fprintf($fp, "%s\n", $muleitem[$muleitem_index]);      [color=#FF0000]//Essa linha que está dando erro[/color]
fclose ($fp);

?>

</p>

<form action="mule.php" method="POST">
<input type="hidden" name="uid" value="<?php echo $_POST["uid"]; ?>" />
<input type="submit" value="Retour" />
</form>
</center>


</center>
</body>
</html>

Obrigado!

Share this post


Link to post
Share on other sites

Valeu cara!

Só to tento um problema, eu não consigo instala o PHP5, eu baixo ele la do site do PHP mas quando eu tento abri o zip aparece uma msg de erro: Final inesperado do arquivo. E não consigo extrair nada...

Sabe porque está dando esse erro, ou de um outro lugar que tenha o php5 para baixar? talves uma outra vs do php5...

Mais uma vez obrigado!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this