Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. Creare e mantenere una sessione

Creare e mantenere una sessione

Pianificato Fissato Bloccato Spostato Coding
9 Post 2 Autori 2.2k Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • C
    C
    condor.uk
    scritto su ultima modifica di
    User 0
    #1
    Creare e mantenere una sessione

    Un saluto agli amici del forum, vi spiego brevissimamente il mio problema.
    Ho 3 pagine .php

    login.php

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns=".w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Accesso</title>
    <link rel="stylesheet" type="text/css" href="/script/ire/css/ire.css" >
    </head>
    
    <body>
    <div id="contenitore" >
              <form name="login" method="post" action="anagrafica.php">
            <label>Id Utente
              <input name="id" type="text" id="id" />
            <input name="Invia" type="submit" />
            </label>
              </form>
    
    </div>
    </body>
    </html>
    

    che altro non è che un semplice form dove l'utente inserisce il proprio id che tramite il campo POST viene ricevuto dalla pagina

    anagrafica.php

    <?php require_once('Connections/conn.php'); ?>
    <?php $id = $_POST['id']; ?>
    
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
    
    mysql_select_db($database_conn, $conn);
    $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
    $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
    $row_ire_db = mysql_fetch_assoc($ire_db);
    $totalRows_ire_db = mysql_num_rows($ire_db);
    ?>
    
    
    
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns=".w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Anagrafica</title>
    <link rel="stylesheet" type="text/css" href="/script/ire/css/ire.css" />
    </head>
    
    <body>
    <div id="contenitore">
    <div id="header_menu"><a href="anagrafica.php" tabindex="10" title="Anagrafica">Anagrafica</a> | <a href="info_adesione.php" tabindex="20" title="Info Adesione">Info Adesione</a> | <a href="info_quota_associativa.php" tabindex="30" title="Info Quota Associativa">Info Quota Associativa</a> |<a href="info_kit_associati.php" tabindex="40" title="Info Kit Associati"> Info Kit Associati</a> | <a href="documentazione_allegata.php" tabindex="50" title="Documentazione Allegata">Documentazione Allegata</a> | <a href="opportunita.php" tabindex="60" title="Opportunità">Opportunità</a> | <a href="logout.php" tabindex="70" title="Logout">Logout</a></div>
    <div id="header_anagrafica">Anagrafica</div>
    <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">id</td>
            <td width="221"><?php echo $row_ire_db['id']; ?></td>
          </tr>
        </table>
      </div>
      
    <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Ragione Sociale</td>
            <td width="221"><?php echo $row_ire_db['name']; ?></td>
          </tr>
        </table>
      </div>
        <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Data Firma Contratto</td>
            <td width="221"><?php echo $row_ire_db['data_firma_c']; ?></td>
          </tr>
        </table>
    </div>
    
      <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Stato Adesione</td>
            <td width="221"><?php echo $row_ire_db['stato_adesione_c']; ?></td>
          </tr>
        </table>
      </div>
      
    
         <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Indirizzo Sede Legale</td>
            <td width="221"><?php echo $row_ire_db['billing_address_street']; ?></td>
          </tr>
        </table>
      </div> 
           <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Indirizzo Comunicazioni</td>
            <td width="221">&quot;da definire&quot;</td>
          </tr>
        </table>
      </div> 
             <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Partita IVA</td>
            <td width="221"><?php echo $row_ire_db['piva_c']; ?></td>
          </tr>
        </table>
      </div> 
               <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Codice Fiscale</td>
            <td width="221"><?php echo $row_ire_db['codice_fiscale_c']; ?></td>
          </tr>
          
        </table>
      </div> 
      <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Telefono Ufficio</td>
            <td width="221"><?php echo $row_ire_db['phone_office']; ?></td>
          </tr>
          
        </table>
      </div> 
    </div>
    </body>
    </html>
    
    <?php
    mysql_free_result($ire_db);
    ?>
    

    tale pagina stampa a video nelle varie celle i valori restituiti dalla query, fin qui tutto ok.

    Adesso il mio problema è quello di fare in modo che venga popolata anche la pagina info_adesione.php che contiene ulteriori dati riguardanti sempre lo stesso id, solo che appena mi sposto tra le pagine perdo i dati, ho provato diversi modi per implementare le sessioni ma ho fallito su tutti i fronti.

    Vi posto il codice della pagina info_adesione.php nella speranza di risolvere il problema con il vostro aiuto.

    <?php require_once('Connections/conn.php'); ?>
    
    
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
    
    mysql_select_db($database_conn, $conn);
    
    $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
    $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
    $row_ire_db = mysql_fetch_assoc($ire_db);
    $totalRows_ire_db = mysql_num_rows($ire_db);
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns=".w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Info Adesione</title>
    <link rel="stylesheet" type="text/css" href="/script/ire/css/ire.css" >
    </head>
    
    <body>
    <div id="contenitore">
    <div id="header_menu"><a href="anagrafica.php" tabindex="10" title="Anagrafica">Anagrafica</a> | <a href="info_adesione.php" tabindex="20" title="Info Adesione">Info Adesione</a> | <a href="info_quota_associativa.php" tabindex="30" title="Info Quota Associativa">Info Quota Associativa</a> |<a href="info_kit_associati.php" tabindex="40" title="Info Kit Associati"> Info Kit Associati</a> | <a href="documentazione_allegata.php" tabindex="50" title="Documentazione Allegata">Documentazione Allegata</a> | <a href="opportunita.php" tabindex="60" title="Opportunità">Opportunità</a>| <a href="logout.php" tabindex="70" title="Logout">Logout</a></div>
    <div id="header_anagrafica">Info Adesione</div>
    
    
      <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Codice Associato</td>
            <td width="221"><?php echo $row_ire_db['codice_associato_c']; ?></td>
          </tr>
        </table>
      </div>
    
      <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Data Firma Contratto</td>
            <td width="221"><?php echo $row_ire_db['data_firma_c']; ?></td>
          </tr>
        </table>
    </div> 
    
      <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Data Consegna</td>
            <td width="221"><?php echo $row_ire_db['data_consegna_c']; ?></td>
          </tr>
        </table>
    </div> 
           <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Distinta Elettronica</td>
            <td width="221">&nbsp;</td>
          </tr>
        </table>
      </div> 
             <div id="tabella">
        <table width="420" border="1">
          <tr>
            <td width="183">Risparmio Ottenuto</td>
            <td width="221">&nbsp;</td>
          </tr>
        </table>
      </div>
    </div>
    </body>
    </html>
    

    Confido in voi

    P.S

    Mi ero creato, grazie all'aiuto di un amico anche una pagina d'appoggio gestione_login.php ma non sono mai riuscito a implementarla

    <?php
    
    // Effettua il controllo se non è stata passata una variabile id tramite POST
    // Se la condizione è Vera effettua il reindirizzamento alla pagina login
    if(!isset($_POST['id']))
           header('location:login.php');
    
     else {
    session_set_cookie_params('600'); // 10 minutes.
    //session start
    session_start();
    //connessione db
    include("Connections/conn_locale.php");
    $id = $_POST['id'];
    
    mysql_select_db($database_conn, $conn);
    //$query_ire_db = "Select * from accounts WHERE id='$id'";
    
    $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
    
    
    $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
    $row_ire_db = mysql_fetch_assoc($ire_db);
    $totalRows_ire_db = mysql_num_rows($ire_db);
    
    if($totalRows_ire_db)
    {
    echo "Login effettuato con successo!!";
    $_SESSION['id'] = $row_ire_db['id'];
    header('location:anagrafica.php');
    
    }
    else  header('location:login_failed.php');
     }
    
    
    
     ?>
    
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
    ?>
    

    Thanks !

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • T
      T
      tigrone
      scritto su ultima modifica di
      User Attivo 0
      #2

      Per utilizzare le sessioni è sufficiente inserire un 'session_start()' all'inizio del file...

      Poi, puoi creare tutte le variabili di sessione che ti pare.
      Esempio:
      $_SESSION['quellochetipare']='valore';

      In tutte le pagine che hanno il session_start(), la variabile (che in realtà è un array...) $_SESSION['quellochetipare'] conterrà sempre 'valore' finchè non la si cambia o si distrugge la sessione, per esempio chiudendo il browser.

      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • C
        C
        condor.uk
        scritto su ultima modifica di
        User 0
        #3

        Ciao Tigrone,
        quindi nel mio caso basterebbe inserire

        $_SESSION['id']='0';
        

        a partire dalla pagina login.php oppure da anagrafica.php o sbaglio ?

        Scusa le domande ma sono alle prime armi

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0
        • T
          T
          tigrone
          scritto su ultima modifica di
          User Attivo 0
          #4

          condor_uk

          Scusa le domande ma sono alle prime armi

          Ti consiglio di studiare allora! 😄
          Dunque... non toccare nulla!
          Parti da questo presupposto: devi rendere disponibile a tutte le pagine il valore id inviato col form... esatto?

          Allora:
          1- nelle pagine in cui serve recuperare tale valore, metti session_start() all'inizio del codice

          2- nella pagina che recupera i dati dal form (anagrafica.php), al posto di:

          <?php $id = $_POST['id']; ?>
          

          metti

          <?php
          session_start(); 
          $id = $_POST['id']; 
          $_SESSION['id']=$id;
          ?>
          

          3- Per ultimo, in tutte le pagine che necessitano del valore di id metti, all'inizio del file:

          <?php
          session_start();
          $id=$_SESSION['id'];
          ?>
          

          Prova a vedere se funziona...

          P.S.: ricordati che i codici php vanno capiti e compresi... scopiazzare va anche bene all'inizio ma alla lunga porta solo problemi e tempo buttato; di più di quello che ce ne sarebbe voluto per imparare!

          Ciao

          1 Risposta Ultima Risposta
          Miglior risposta 0
          0
          • C
            C
            condor.uk
            scritto su ultima modifica di
            User 0
            #5

            Tigrone, quello che dici è verissimo, a volte per tempo non si riesce ad approfondire argomenti di fondamentale importanza per chi come me vuole avviarsi verso la programmazione php ... detto questo mi riprometto e prometto a voi amici del forum che approfondirò le mie conoscenza cercando un giorno di essere un valido elemento di supporto anche per il forum

            Detto questo ti dico che grazie al tuo aiuto sembra che ci siamo quasi, riesco a passare i valori tra due pagine

            info_adesione

            <?php
            session_start();
            $id=$_SESSION['id'];
            ?>
            
            <?php require_once('Connections/conn.php'); ?>
            
            
            <?php
            if (!function_exists("GetSQLValueString")) {
            function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
            {
              if (PHP_VERSION < 6) {
                $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
              }
            
              $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
            
              switch ($theType) {
                case "text":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;    
                case "long":
                case "int":
                  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                  break;
                case "double":
                  $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
                  break;
                case "date":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;
                case "defined":
                  $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                  break;
              }
              return $theValue;
            }
            }
            
            mysql_select_db($database_conn, $conn);
            $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
            $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
            $row_ire_db = mysql_fetch_assoc($ire_db);
            $totalRows_ire_db = mysql_num_rows($ire_db);mysql_select_db($database_conn, $conn);
            $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
            $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
            $row_ire_db = mysql_fetch_assoc($ire_db);
            $totalRows_ire_db = mysql_num_rows($ire_db);
            
            ?>
            

            info_quota_associativa

            <?php
            session_start();
            $id=$_SESSION['id'];
            ?>
            <?php require_once('Connections/conn.php'); ?>
            
            <?php
            if (!function_exists("GetSQLValueString")) {
            function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
            {
              if (PHP_VERSION < 6) {
                $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
              }
            
              $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
            
              switch ($theType) {
                case "text":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;    
                case "long":
                case "int":
                  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                  break;
                case "double":
                  $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
                  break;
                case "date":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;
                case "defined":
                  $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                  break;
              }
              return $theValue;
            }
            }
            
            mysql_select_db($database_conn, $conn);
            $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
            $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
            $row_ire_db = mysql_fetch_assoc($ire_db);
            $totalRows_ire_db = mysql_num_rows($ire_db);
            ?>
            

            ma quando torno sulla pagina anagrafica.php mi si cancella tutto

            anagrafica.php

            <?php
            session_start(); 
            $id = $_POST['id']; 
            $_SESSION['id']=$id;
            ?>
            
            <?php require_once('Connections/conn.php'); ?>
            
            <?php
            if (!function_exists("GetSQLValueString")) {
            function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
            {
              if (PHP_VERSION < 6) {
                $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
              }
            
              $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
            
              switch ($theType) {
                case "text":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;    
                case "long":
                case "int":
                  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                  break;
                case "double":
                  $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
                  break;
                case "date":
                  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                  break;
                case "defined":
                  $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                  break;
              }
              return $theValue;
            }
            }
            
            mysql_select_db($database_conn, $conn);
            $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
            $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
            $row_ire_db = mysql_fetch_assoc($ire_db);
            $totalRows_ire_db = mysql_num_rows($ire_db);
            ?>
            

            Risolto questo ultimo ostacolo direi che sono apposto 😉

            Thanks !

            1 Risposta Ultima Risposta
            Miglior risposta 0
            0
            • T
              T
              tigrone
              scritto su ultima modifica di
              User Attivo 0
              #6

              Ti azzera il valore di $id e di conseguenza anche la $_SESSION['id'] perchè riprende il POST...
              Allora mettilo così:

              <?php
              session_start(); 
              if (!$_SESSION['id']) {
              $id = $_POST['id']; 
              } 
              $_SESSION['id']=$id;
              ?>
              

              P.S.: se vuoi avviarti verso la programmazione PHP, partire da zero e studiare è d'OBBLIGO!!
              Il tuo approccio attuale è completamente sbagliato... credimi!

              1 Risposta Ultima Risposta
              Miglior risposta 0
              0
              • C
                C
                condor.uk
                scritto su ultima modifica di
                User 0
                #7

                Ho modificato seguendo le tue indicazioni, ma niente da fare appena torna su anagrafica.php cancella tutto e mostra un errore

                [B]Notice[/B]:  Undefined variable: id in [B]C:\xampp\htdocs\script\ire\anagrafica.php[/B] on line [B]3[/B]
                
                [B]Notice[/B]:  Undefined index: id in [B]C:\xampp\htdocs\script\ire\anagrafica.php[/B] on line [B]4[/B]
                

                anagrafica.php

                <?php
                session_start(); 
                if (!$id) {
                $id = $_POST['id']; 
                $_SESSION['id']=$id;
                }
                ?>
                
                <?php require_once('Connections/conn.php'); ?>
                
                <?php
                if (!function_exists("GetSQLValueString")) {
                function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
                {
                  if (PHP_VERSION < 6) {
                    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
                  }
                
                  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
                
                  switch ($theType) {
                    case "text":
                      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                      break;    
                    case "long":
                    case "int":
                      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                      break;
                    case "double":
                      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
                      break;
                    case "date":
                      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                      break;
                    case "defined":
                      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                      break;
                  }
                  return $theValue;
                }
                }
                
                mysql_select_db($database_conn, $conn);
                $query_ire_db = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c INNER JOIN accounts_opportunities ON accounts.id = accounts_opportunities.account_id AND accounts_cstm.id_c = accounts_opportunities.account_id INNER JOIN opportunities_cstm ON accounts_opportunities.opportunity_id = opportunities_cstm.id_c WHERE accounts.id ='$id'";
                $ire_db = mysql_query($query_ire_db, $conn) or die(mysql_error());
                $row_ire_db = mysql_fetch_assoc($ire_db);
                $totalRows_ire_db = mysql_num_rows($ire_db);
                ?>
                

                1 Risposta Ultima Risposta
                Miglior risposta 0
                0
                • T
                  T
                  tigrone
                  scritto su ultima modifica di
                  User Attivo 0
                  #8

                  Emh... scusa...
                  Il codice giusto dovrebbe essere così... vado un po' di fretta...

                  <?php
                  session_start(); 
                  if (!$_SESSION['id']) {
                  $id=$_POST['id'];
                  $_SESSION['id']=$id;
                  } else {
                  $id=$_SESSION['id'];
                  } 
                  ?>
                  
                  1 Risposta Ultima Risposta
                  Miglior risposta 0
                  0
                  • C
                    C
                    condor.uk
                    scritto su ultima modifica di
                    User 0
                    #9

                    Scusami tu tigrone,
                    ti ho rubato un bel po' di tempo ma grazie al tuo prezioso aiuto sono riuscito a risolvere il problema.

                    Thanks - Thanks - Thanks

                    1 Risposta Ultima Risposta
                    Miglior risposta 0
                    0

                    Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

                    Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

                    Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

                    Registrati Accedi
                    Rispondi
                    • Risposta alla discussione
                    Effettua l'accesso per rispondere
                    • Da Vecchi a Nuovi
                    • Da Nuovi a Vecchi
                    • Più Voti


                    • Accedi

                    • Non hai un account? Registrati

                    • Accedi o registrati per effettuare la ricerca.
                    • Primo post
                      Ultimo post
                    Home Accedi Registrati
                    Menu
                    • CATEGORIES
                    • La Community Connect.gt
                    • Presentati alla Community
                    • News Ufficiali da Connect.gt
                    • Internet News
                    • A Scuola Di
                    • Digital Marketing
                    • Intelligenza Artificiale
                    • SEO & GEO
                    • Web Marketing e Content
                    • Google Analytics e Web Analytics
                    • Google Ads & Advertising
                    • YouTube
                    • TikTok, Instagram e altri Social
                    • Google Adsense, Affiliazioni e Guadagno
                    • E-Commerce
                    • Coding e Sistemistica
                    • Help Center: consigli per il tuo progetto
                    • Hosting e Cloud
                    • Coding
                    • CMS & Piattaforme Self-Hosted
                    • Annunci e Collaborazioni
                    • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
                    • Collaborazioni WEB e Lavoro: offro e cerco
                    • Impresa, Fisco e Leggi
                    • Consulenza Legale e Professioni Web
                    • Consulenza Fiscale, Imprese, Startup e P.Iva
                    • Gli Off Topic
                    • PC, Smartphone e altri Hardware
                    • Tutti i Software
                    • GT Fetish Cafè
                    • Discussioni
                    • Non letti 0
                    • Recenti
                    • Hashtag
                    • Popolare
                    • Utenti
                    • Privacy
                    • Termini e condizioni
                    • © 2026 Search On Media Group S.r.l.