Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14
  1. #1

    Warning: printf on line 153

    Salve,

    Come da titolo ho questo errore in un CMS.

    Sto creando un add-on e mi da errore in questo file:

    <?php
    /*================================================= ==+
    || # HoloCMS - Website and Content Management System
    |+================================================ ===+
    || # Copyright © 2008 Meth0d. All rights reserved.
    || # http://www.meth0d.org
    |+================================================ ===+
    || # HoloCMS is provided "as is" and comes without
    || # warrenty of any kind. HoloCMS is free software!
    |+================================================ ===+
    || # Staff App System by HandyAndy160 of RaGEZONE forum
    || # http://nipperhotel.tk
    |+================================================ ===*/

    require_once('../core.php');
    if($hkzone !== true){ header("Location: index.php?throwBack=true"); exit; }
    if(!session_is_registered(acp)){ header("Location: index.php?p=login"); exit; }

    $pagename = "Gestisci le richieste di Competizioni";

    if($do == "clear") {
    $column = $_GET['column'];
    if($column == "1")
    {
    mysql_query("UPDATE applications SET `appstatus` = '2'");
    header("location:index.php?p=competition_manage");
    }
    if($column == "2")
    {
    mysql_query("UPDATE applications SET `appstatus` = '1'");
    header("location:index.php?p=competition_manage");
    }
    else
    {
    header("location:index.php?p=competition_manage");
    }
    }

    if($do == "delete" && is_numeric($key)){

    $check = mysql_query("SELECT id FROM applications WHERE id = '".$key."' LIMIT 1") or die(mysql_error());
    $exists = mysql_num_rows($check);

    if($exists > 0){
    mysql_query("DELETE FROM applications WHERE id = '".$key."' LIMIT 1") or die(mysql_error());
    $msg = "La richiesta è stata eliminata.";
    } else {
    $msg = "Non è stato possibile eliminare la richiesta. Richiesta non trovata";
    }

    } elseif($do == "edit" && is_numeric($key)){

    $check = mysql_query("SELECT * FROM applications WHERE id = '".$key."' LIMIT 1") or die(mysql_error());
    $exists = mysql_num_rows($check);

    if($exists > 0){
    $rare = mysql_fetch_assoc($check);
    $editor_mode = true;
    } else {
    $msg = "Impossibile visualizzare la richiesta. Richiesta non trovata.";
    }

    } elseif($do == "save" && is_numeric($key)){

    $check = mysql_query("SELECT id FROM applications WHERE id = '".$key."' LIMIT 1") or die(mysql_error());

    $exists = mysql_num_rows($check);

    if($exists > 0){

    $id = $key;

    $appstat = addslashes($_POST['appstatus']);

    $appuser = addslashes($_POST['1username']);
    $appuserid = addslashes($_POST['2username']);

    if($appstat != 0 && $appstat != 1 && $appstat != 2) { $appstat = 0; }
    if(!is_numeric($appstat)) { $appstat = 0; }
    if($appstat == 1) {

    mysql_query("INSERT INTO cms_alerts (userid,alert,type) VALUES ('".$appuserid."','Salve.
    La sua richiesta di competizione è stata rifiutata. La sua ringraziamo per aver partecipato attivamente con il nostro staff
    Grazie e divertiti in $sitename,
    - $sitename Management','2')");
    mysql_query("UPDATE applications SET appstatus = '".$appstat."' WHERE id = '".$id."' LIMIT 1") or die(mysql_error());
    $msg = "RIFIUTATA. Lo status della richiesta è stato editato.
    . Inviato un alert a $appuser !";
    }
    elseif($appstat == 2) {
    mysql_query("INSERT INTO cms_alerts (userid,alert,type) VALUES ('".$appuserid."','Salve.
    La sua richiesta è stata accettata. Ora lei potrà contattare uno staff per sapere come comportarsi e se vuole può aiutarci nello svolgimento della sua competizione
    Le chiediamo se in futuro potrà inviare la news intera per la competizione allo staff!
    - $sitename Management','2')");
    mysql_query("UPDATE applications SET appstatus = '".$appstat."' WHERE id = '".$id."' LIMIT 1") or die(mysql_error());
    $msg = "ACCETTATA. Lo status della richiesta è stato editato. Inviato un alert a $appuser !";
    }



    } else {

    $msg = "Non è stato possibile editare la richiesta; Oggetto non trovato.";


    }

    }

    @include('subheader.php');
    @include('header.php');
    ?>
    <table cellpadding='0' cellspacing='8' width='100%' id='tablewrap'>
    <tr> <td width='22%' valign='top' id='leftblock'>
    <div>

    <?php @include('sitemenu.php'); ?>

    </div>
    </td>
    <td width='78%' valign='top' id='rightblock'>
    <div>

    <?php if($editor_mode !== true){ ?>
    <?php if(isset($msg)){ ?>

    <?php echo $msg; ?></p><?php } ?>

    <form action='index.php?p=competition_manage&do=save' method='post' name='theAdminForm' id='theAdminForm'>
    <div class='tableborder'>
    <div class='tableheaderalt'>Richieste [Accetta tutte] [Rifiuta tutte]</div>
    <table cellpadding='4' cellspacing='0' width='100%'>
    <tr>
    <td class='tablesubheader' width='1%' align='center'>ID</td>
    <td class='tablesubheader' width='28%'>User Name</td>
    <td class='tablesubheader' width='10%' align='center'>Status Richiesta</td>
    <td class='tablesubheader' width='10%' align='center'>Indirizzo IP</td>
    <td class='tablesubheader' width='10%' align='center'>Visualizza Richiesta</td>
    <td class='tablesubheader' width='12%' align='center'>Elimina Richiesta</td>
    </tr>
    <?php
    $get_rares = mysql_query("SELECT id,username,appstatus,title,comp FROM competition ORDER BY appstatus DESC") or die(mysql_error());
    while($row = mysql_fetch_assoc($get_rares)){

    if($row['appstatus'] == 1) { $vs="Richiesta Rifiutata."; }
    else if($row['appstatus'] == 2) { $vs="Richiesta Accettata."; }
    else if($row['appstatus'] == 0) { $vs="Nuova Richiesta!"; }




    $info = $vs.$rs.$hc.".";

    printf(" <tr>
    <td class='tablerow1' align='center'>%s</td>
    <td class='tablerow2'>%s<div class='desctext'>%s</div></td>
    <td class='tablerow2' align='center'>%s</td>
    <td class='tablerow2' align='center'>%s</td>
    <td class='tablerow2' align='center'>[img]./images/edit.gif[/img]</td>
    <td class='tablerow2' align='center'>[img]./images/delete.gif[/img]</td>
    </tr>", $row['id'], htmlspecialchars(stripslashes($row['username'])), htmlspecialchars($info), $row['appstatus'], $row['id'], $row['id']);
    }
    ?>

    </table>
    <?php } else { ?>
    <form action='index.php?p=competition_manage&do=save&key =<?php echo $rare['id']; ?>' method='post' name='theAdminForm' id='theAdminForm'>
    <div class='tableborder'>
    <div class='tableheaderalt'>Richieste Visualizzate: (<?php echo $rare['username']; ?>, App ID: <?php echo $rare['id']; ?>)</div>

    <table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
    <tr>
    <td class='tablerow1' width='40%' valign='middle'>User Name<div class='graytext'>L'username del richiedente.</div></td>
    <td class='tablerow2' width='60%' valign='middle'><input type='text' name='1username' value="<?php echo $rare['username']; ?>" size='30' maxlength='0' class='textinput'></td>
    </tr>

    <tr>
    <td class='tablerow1' width='40%' valign='middle'>ID Utente<div class='graytext'>ID assegnato all'utente durante la registrazione.</div></td>
    <td class='tablerow2' width='60%' valign='middle'><input type='text' name='2username' value="<?php echo $rare['userid']; ?>" size='30' maxlength='0' class='textinput'></td>
    </tr>


    <tr>
    <td class='tablerow1' width='40%' valign='middle'>Cosa sa fare<div class='graytext'>Improvements & Suggestions that the applicant has for <?php echo $sitename; ?>. </div></td>
    <td class='tablerow2' width='60%' valign='middle'><input type='text' name='category' value="<?php echo $rare['message1']; ?>" size='100' maxlength='0'class='textinput'></td>
    </tr>

    <tr>
    <td class='tablerow1' width='40%' valign='middle'>Perchè vuole questo ruolo<div class='graytext'>Reasons why the applicant wants to become a staff member for <?php echo $sitename; ?>. </div></td>
    <td class='tablerow2' width='60%' valign='middle'><input type='text' name='category' value="<?php echo $rare['message2']; ?>" size='100' maxlength='0'class='textinput'></td>
    </tr>

    <tr>
    <td class='tablerow1' width='40%' valign='middle'>Status della Richiesta<div class='graytext'>0 = Nuova Richiesta, 1 = Accettata, 2 = Declinata.
    Edit this here, and press Save below.</div></td>
    <td class='tablerow2' width='60%' valign='middle'><input type='text' name='appstatus' value="<?php echo $rare['appstatus']; ?>" size='1' maxlength='1' class='textinput'></td>
    </tr>

    <tr>
    <tr><td align='center' class='tablesubheader' colspan='2' ><input type='submit' value='Save' class='realbutton' accesskey='s'></td></tr>
    </form></table></div>

    <?php } ?>
    </div>
    </td></tr>
    </table>
    </div>
    <div align='center'>

    <?php
    $mtime = explode(' ', microtime());
    $totaltime = $mtime[0] + $mtime[1] - $starttime;
    printf('Time: %.3f', $totaltime);
    ?>
    </div>


    Ecco il database sql:

    CREATE TABLE `competition` (
    `id` int(100) NOT NULL auto_increment,
    `userid` int(100) NOT NULL,
    `username` text NOT NULL,
    `appstatus` text NOT NULL,
    `title` text NOT NULL,
    `comp` text NOT NULL,
    `visitoripaddy` text NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=84 ;
    Se riuscite a risolvermelo.

    Grazie

  2. #2
    Vi prego, mi serve urgentemente

  3. #3
    quale è la linea 153? <_<

  4. #4
    Dovrebbe essere questo pezzo:

    <td class='tablerow2' align='center'>[img]./images/edit.gif[/img]</td>
    <td class='tablerow2' align='center'>[img]./images/delete.gif[/img]</td>
    </tr>", $row['id'], htmlspecialchars(stripslashes($row['username'])), htmlspecialchars($info), $row['appstatus'], $row['id'], $row['id']);
    Calcolando una minima percentuale di errori nel conteggio dovrebbe essere in quella parte.

  5. #5
    uhm che ne dici di chiudere il printf con " ? mi pare che non sia chiuso quella parte

  6. #6
    per meglio dire la parte:

    $info = $vs.$rs.$hc.".";

    printf(" <tr>
    <td class='tablerow1' align='center'>%s</td>
    <td class='tablerow2'>%s<div class='desctext'>%s</div></td>
    <td class='tablerow2' align='center'>%s</td>
    <td class='tablerow2' align='center'>%s</td>
    <td class='tablerow2' align='center'>[img]./images/edit.gif[/img]</td>
    <td class='tablerow2' align='center'>[img]./images/delete.gif[/img]</td>
    </tr>", $row['id'], htmlspecialchars(stripslashes($row['username'])), htmlspecialchars($info), $row['appstatus'], $row['id'], $row['id']);
    }
    ?>

    il problema potrebbe essere dopo la chiusura del tr alla quart'ultima riga.

  7. #7
    E' già chiuso con ", qual'è il problema?

  8. #8
    che warning ti dà? precisamente intendo

  9. #9
    Warning: printf() [function.printf]: Too few arguments in C:\Users\Valerio\Desktop\xampp_007\htdocs\cms\hous ekeeping\comp_manage.php on line 153

    Warning: printf() [function.printf]: Too few arguments in C:\Users\Valerio\Desktop\xampp_007\htdocs\cms\hous ekeeping\comp_manage.php on line 153
    Eccolo

  10. #10
    As the message said - you provided "Too few arguments" for
    "printf" function. You used 10 "%s" placeholders in first parameter
    and provided only 9 strings (next parameters).
    Again it looks like you didn't check the obvious cause of error.
    Next time try cutting the code to the minimum which does not
    cause the error and try adding rest of the code piece by piece.

    link:

    http://www.issociate.de/board/goto/8...n_line_27.html

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.