Visualizzazione dei risultati da 1 a 9 su 9
  1. #1

    [PHP] Problemi nel configurare script per ticket

    Ho scaricato da internet un sorgente di un ticket.

    Purtroppo non riesco a configurarlo perchè mi visualizza quest'errore:

    Notice: Constant _DELETE already defined in c:\programmi\easyphp1-8\www\php ticket\lang_ita.inc.php on line 237
    An error occured in function 'functions.inc.php::mysql_select_db()': 'mysql_select_db() failed'
    Additional info: 'Nome tabella'

  2. #2
    Ho scaricato da internet un sorgente di un ticket.
    Com'era caruccio sto sorgente

    Notice: Constant _DELETE already defined in c:\programmi\easyphp1-8\www\php ticket\lang_ita.inc.php on line 237
    Vai al file e riga indicate ad occhio se trovi una cosa
    del genere
    Codice PHP:
    define("_DELETE""value"); 
    ripetuta due volte commenta una delle due.


    Codice PHP:
    An error occured in function 'functions.inc.php::mysql_select_db()''mysql_select_db() failed'
    Additional info'Nome tabella' 
    Azzardo un lo hai configurato lo script ?


    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  3. #3
    intanto grazie per la risposta.
    Si, lo script l'ho configurato a dovere. Ho seguito il tuo consiglio ed in effetti c'era la stessa stringa ripetuta 2 volte.

    Nonostante tutto rimane sempre questo problema:

    codice:
    An error occured in function 'get_variable(n:imap_support)::mysql_query()': 'mysql query failed'
    Additional info: 'La tabella 'ticket.ts_2settings' non esiste'
    Ho creato il database, però la tabella in questione anche se la creo io a mano, non so quali sono i campi da inserirgli.

    Lo script mi sa che è stato scritto da utenti linux... io uso windows... funziona lo stesso ?
    Scusami se ti dico ciò, ma è scritto in maniera molto molto diversa.

    Inoltre se puo esserti d'aiuto, lo script è così configurato:

    action.php
    add.php
    config.php
    config.inc.php
    default.php
    edit.php
    functions.inc.php
    help.php
    imap.inc.php
    index.php
    install.php
    lang.eng.inc.php
    lang.ita.inc.php
    main.php
    mysql.inc.php
    search.php
    top.php

  4. #4
    inoltre se dovesse servire ti inserisco il codice del file imap.inc.php

    codice:
    <?
    
    
    
    /*
    
    * IMAP include file, contains all email importing functions
    
    * STILL EXPERIMENTAL - USE WITH CARE! you've been warned :)
    
    */
    
    
    
    // supported protocols
    
    $GLOBALS['IMAP_IMAP']         = 1;
    
    $GLOBALS['IMAP_POP3']         = 2;
    
    $GLOBALS['IMAP_IMAP_SSL']     = 3;
    
    $GLOBALS['IMAP_POP3_SSL']     = 4;
    
    
    
    
    
    /* decode mime format strings */
    
    function imap_decode($text)
    
    {
    
        $elements=imap_mime_header_decode($text);
    
        for($i=0;$i<count($elements);$i++) 
    
        {
    
            return htmlspecialchars($elements[$i]->text);
    
        }
    
    }
    
    
    
    /* get mime type */
    
    function imap_get_mime_type(&$structure)
    
    {
    
        $primary_mime_type = array("TEXT", "MULTIPART", "MESSAGE", "APPLICATION", "AUDIO", "IMAGE", "VIDEO", "OTHER");
    
        if($structure->subtype)
    
            return $primary_mime_type[(int) $structure->type] . '/' . $structure->subtype;
    
    
    
        return "TEXT/PLAIN";
    
    }
    
    
    
    /* get part of body by mime type */
    
    function imap_get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false)
    
    {
    
        if(!$structure)
    
        $structure = imap_fetchstructure($stream, $msg_number);
    
        
    
        if($structure)
    
        {
    
            if($mime_type == imap_get_mime_type($structure))
    
            {
    
                if(!$part_number)
    
                      $part_number = "1";
    
                
    
                 $text = imap_fetchbody($stream, $msg_number, $part_number);
    
            
    
                if($structure->encoding == 3)
    
                     return imap_base64($text);
    
                 else if($structure->encoding == 4)
    
                      return imap_qprint($text);
    
                 else
    
                      return $text;
    
            }
    
        
    
            if($structure->type == 1) /* multipart */
    
             {
    
                 while(list($index, $sub_structure) = each($structure->parts))
    
                  {
    
                  if($part_number)
    
                     $prefix = $part_number . '.';
    
                
    
                $data = imap_get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1));
    
                  if($data)
    
                      return $data;
    
                  }
    
            }
    
        }
    
        return false;
    
    }
    
    
    
    /* connect to server and fetch an $mailbox object */
    
    function imap_connect($server,$port,$folder,$username,$password,$type)
    
    {
    
        //determine protocol type and fix the server connect string
    
        switch($type)
    
        {
    
            case $GLOBALS['IMAP_IMAP']:     $server_path = '{'.$server.':'.$port.'}'.$folder;             break;
    
            case $GLOBALS['IMAP_POP3']:     $server_path = '{'.$server.':'.$port.'/pop3}'.$folder;         break;
    
            case $GLOBALS['IMAP_IMAP_SSL']:    $server_path = '{'.$server.':'.$port.'/imap/ssl}'.$folder;     break;
    
            case $GLOBALS['IMAP_POP3_SSL']: $server_path = '{'.$server.':'.$port.'/pop3/ssl}'.$folder;     break;
    
            default:                         $server_path = '{'.$server.':'.$port.'}'.$folder;             break;
    
        }
    
        
    
        return imap_open($server_path, $username, $password);
    
    }
    
    
    
    /* return number of messages in current mailbox */
    
    function imap_message_count($mailbox)
    
    {
    
        if ($header = imap_check($mailbox)) 
    
              return $header->Nmsgs;
    
        else
    
            return 0;
    
    }
    
    
    
    /* close server connection gracefully */
    
    function imap_disconnect($mailbox)
    
    {
    
        return imap_close($mailbox);
    
    }
    
    
    
    /* import IMAP messages from mailbox */
    
    function imap_import($mailbox,$delete_msg=0)
    
    {
    
         $num_messages = imap_message_count($mailbox);
    
        
    
        for($i=1; $num_messages >= $i; $i++)
    
        {
    
            $msg                 = imap_header($mailbox,$i);
    
            $subject             = mysql_escape_string(imap_decode($msg->subject));
    
            $from                 = imap_decode($msg->fromaddress);
    
            $action                = mysql_escape_string(imap_get_part($mailbox, $i, "TEXT/PLAIN"));
    
            $action_html        = mysql_escape_string(imap_get_part($mailbox, $i, "TEXT/HTML"));
    
            //$action        = get_part($mbox, $i, "TEXT/HTML");
    
            
    
            //insert ticket
    
            print "[*] Importing email from '$from', subject: '".substr($subject,0,50)."', body contains ".strlen($action)." characters
    ";
    
            add_ticket($subject,$from,'','NOW()','NOW()',$GLOBALS[STATUS_OPEN],$GLOBALS[SEVERITY_NORMAL],$_SESSION[user_id]);
    
            //$query = "INSERT INTO $GLOBALS[mysql_prefix]ticket (affected,scope,owner,description,problemstart,problemend,status,date,severity) VALUES('$from','',$_SESSION[user_id],'$subject','2002-03-05 18:30:00','2002-03-05 18:30:00',$GLOBALS[STATUS_OPEN],NOW(),$GLOBALS[SEVERITY_NORMAL])";
    
            //mysql_query($query) or do_error("imap_import($delete_msg)::mysql_query()", 'mysql query failed', mysql_error());
    
    
    
            //insert action (i.e. the body of the message)
    
            //$action     = strip_html($action); //fix formatting, custom tags etc.
    
            $ticket_id     = mysql_insert_id();
    
            
    
            if ($action) //is $action empty?
    
            {
    
                 $query         = "INSERT INTO $GLOBALS[mysql_prefix]action (description,ticket_id,date,user,action_type) VALUES('$action','$ticket_id',NOW(),$_SESSION[user_id],$GLOBALS[ACTION_COMMENT])";
    
                mysql_query($query) or do_error("imap_import($delete_msg)::mysql_query()", 'mysql query failed', mysql_error());
    
            }
    
            
    
            if ($action_html)
    
            {
    
                $query         = "INSERT INTO $GLOBALS[mysql_prefix]action (description,ticket_id,date,user,action_type) VALUES('$action_html','$ticket_id',NOW(),$_SESSION[user_id],$GLOBALS[ACTION_COMMENT])";
    
                mysql_query($query) or do_error("imap_import($delete_msg)::mysql_query()", 'mysql query failed', mysql_error());
    
            }    
    
            
    
            if ($delete_msg) imap_delete($mailbox,$i);
    
        }
    
        
    
        print "[*] fetched and inserted $num_messages emails into database
    
    ";
    
        
    
        //get rid of deleted messages if deletetion is on
    
        if ($delete_msg) imap_expunge($mailbox);
    
    }
    
    
    
    ?>

  5. #5
    oggi ho provato nuovamente a fare delle prove, ma niente... non riesco proprio.
    Spero in un vostro aiuto...

  6. #6
    ti dice già tutto: Additional info: 'La tabella 'ticket.ts_2settings' non esiste'

    controlla che nel database sia stata creata.. e in caso contrario rifai l'istallazione

    ciauz

  7. #7
    il problema è proprio questo. Nel database non crea nessuna tabella. Ho provato anche a crearla manualmente... ma non so che campi inserire e pertanto non posso crearla

  8. #8
    è molto strano (non conosco lo script)...in fase di istallazione imposti i dati corretti per l'accesso al database?

    ciauz

  9. #9
    I dati li imposto tutti correttamente. Cmq purtroppo per via di quest'errore non posso avviare l'installazione.

    Se hai tempo e voglia lo script da me usato lo trovi qui:

    http://sourceforge.net/projects/ezt/

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 © 2025 vBulletin Solutions, Inc. All rights reserved.