<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Creare e mantenere una sessione]]></title><description><![CDATA[<p dir="auto">Un saluto agli amici del forum, vi spiego brevissimamente il mio problema.<br />
Ho 3 pagine .php</p>
<p dir="auto">login.php</p>
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns=".w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Accesso&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="/script/ire/css/ire.css" &gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id="contenitore" &gt;
          &lt;form name="login" method="post" action="anagrafica.php"&gt;
        &lt;label&gt;Id Utente
          &lt;input name="id" type="text" id="id" /&gt;
        &lt;input name="Invia" type="submit" /&gt;
        &lt;/label&gt;
          &lt;/form&gt;

&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p dir="auto">che altro non è che un semplice form dove l'utente inserisce il proprio id che tramite il campo POST viene ricevuto dalla pagina</p>
<p dir="auto">anagrafica.php</p>
<pre><code>&lt;?php require_once('Connections/conn.php'); ?&gt;
&lt;?php $id = $_POST['id']; ?&gt;

&lt;?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION &lt; 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);
?&gt;





&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns=".w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Anagrafica&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="/script/ire/css/ire.css" /&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id="contenitore"&gt;
&lt;div id="header_menu"&gt;&lt;a href="anagrafica.php" tabindex="10" title="Anagrafica"&gt;Anagrafica&lt;/a&gt; | &lt;a href="info_adesione.php" tabindex="20" title="Info Adesione"&gt;Info Adesione&lt;/a&gt; | &lt;a href="info_quota_associativa.php" tabindex="30" title="Info Quota Associativa"&gt;Info Quota Associativa&lt;/a&gt; |&lt;a href="info_kit_associati.php" tabindex="40" title="Info Kit Associati"&gt; Info Kit Associati&lt;/a&gt; | &lt;a href="documentazione_allegata.php" tabindex="50" title="Documentazione Allegata"&gt;Documentazione Allegata&lt;/a&gt; | &lt;a href="opportunita.php" tabindex="60" title="Opportunità"&gt;Opportunità&lt;/a&gt; | &lt;a href="logout.php" tabindex="70" title="Logout"&gt;Logout&lt;/a&gt;&lt;/div&gt;
&lt;div id="header_anagrafica"&gt;Anagrafica&lt;/div&gt;
&lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;id&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['id']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  
&lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Ragione Sociale&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['name']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt;
    &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Data Firma Contratto&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['data_firma_c']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt;

  &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Stato Adesione&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['stato_adesione_c']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  

     &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Indirizzo Sede Legale&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['billing_address_street']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt; 
       &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Indirizzo Comunicazioni&lt;/td&gt;
        &lt;td width="221"&gt;&amp;quot;da definire&amp;quot;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt; 
         &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Partita IVA&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['piva_c']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt; 
           &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Codice Fiscale&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['codice_fiscale_c']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      
    &lt;/table&gt;
  &lt;/div&gt; 
  &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Telefono Ufficio&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['phone_office']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      
    &lt;/table&gt;
  &lt;/div&gt; 
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;

&lt;?php
mysql_free_result($ire_db);
?&gt;
</code></pre>
<p dir="auto">tale pagina stampa a video nelle varie celle i valori restituiti dalla query, fin qui tutto ok.</p>
<p dir="auto">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.</p>
<p dir="auto">Vi posto il codice della pagina info_adesione.php nella speranza di risolvere il problema con il vostro aiuto.</p>
<pre><code>&lt;?php require_once('Connections/conn.php'); ?&gt;


&lt;?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION &lt; 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);
?&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns=".w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Info Adesione&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="/script/ire/css/ire.css" &gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id="contenitore"&gt;
&lt;div id="header_menu"&gt;&lt;a href="anagrafica.php" tabindex="10" title="Anagrafica"&gt;Anagrafica&lt;/a&gt; | &lt;a href="info_adesione.php" tabindex="20" title="Info Adesione"&gt;Info Adesione&lt;/a&gt; | &lt;a href="info_quota_associativa.php" tabindex="30" title="Info Quota Associativa"&gt;Info Quota Associativa&lt;/a&gt; |&lt;a href="info_kit_associati.php" tabindex="40" title="Info Kit Associati"&gt; Info Kit Associati&lt;/a&gt; | &lt;a href="documentazione_allegata.php" tabindex="50" title="Documentazione Allegata"&gt;Documentazione Allegata&lt;/a&gt; | &lt;a href="opportunita.php" tabindex="60" title="Opportunità"&gt;Opportunità&lt;/a&gt;| &lt;a href="logout.php" tabindex="70" title="Logout"&gt;Logout&lt;/a&gt;&lt;/div&gt;
&lt;div id="header_anagrafica"&gt;Info Adesione&lt;/div&gt;


  &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Codice Associato&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['codice_associato_c']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt;

  &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Data Firma Contratto&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['data_firma_c']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt; 

  &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Data Consegna&lt;/td&gt;
        &lt;td width="221"&gt;&lt;?php echo $row_ire_db['data_consegna_c']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt; 
       &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Distinta Elettronica&lt;/td&gt;
        &lt;td width="221"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt; 
         &lt;div id="tabella"&gt;
    &lt;table width="420" border="1"&gt;
      &lt;tr&gt;
        &lt;td width="183"&gt;Risparmio Ottenuto&lt;/td&gt;
        &lt;td width="221"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p dir="auto">Confido in voi <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/ad0a1f8d-b404-40e4-a46a-e563b14044da-dho.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--arrabbiato" style="height:1.4em;width:auto;vertical-align:middle" title=":x" alt="" /></p>
<p dir="auto">P.S</p>
<p dir="auto">Mi ero creato, grazie all'aiuto di un amico anche una pagina d'appoggio gestione_login.php ma non sono mai riuscito a implementarla</p>
<pre><code>&lt;?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');
 }



 ?&gt;

&lt;?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION &lt; 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;
}
}
?&gt;
</code></pre>
<p dir="auto">Thanks !</p>
]]></description><link>https://dev.connect.gt/topic/145329/creare-e-mantenere-una-sessione</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 17:28:03 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/145329.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 10 Feb 2011 23:11:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 13:01:16 GMT]]></title><description><![CDATA[<p dir="auto">Scusami tu tigrone,<br />
ti ho rubato un bel po' di tempo ma grazie al tuo prezioso aiuto sono riuscito a risolvere il problema. <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/54a3bffb-5e4a-4eb8-81dc-99b2072e5d05-175.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--ciauz" style="height:1.4em;width:auto;vertical-align:middle" title=":ciauz:" alt="" /></p>
<p dir="auto">Thanks - Thanks - Thanks</p>
]]></description><link>https://dev.connect.gt/post/973770</link><guid isPermaLink="true">https://dev.connect.gt/post/973770</guid><dc:creator><![CDATA[condor.uk]]></dc:creator><pubDate>Fri, 11 Feb 2011 13:01:16 GMT</pubDate></item><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 12:05:10 GMT]]></title><description><![CDATA[<p dir="auto">Emh... scusa...<br />
Il codice giusto dovrebbe essere così... vado un po' di fretta...<img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/29fff08e-17e5-4013-ae14-11c7dde7a411-124.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--rollo" style="height:1.4em;width:auto;vertical-align:middle" title=":rollo:" alt="" /></p>
<pre><code>&lt;?php
session_start(); 
if (!$_SESSION['id']) {
$id=$_POST['id'];
$_SESSION['id']=$id;
} else {
$id=$_SESSION['id'];
} 
?&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/973735</link><guid isPermaLink="true">https://dev.connect.gt/post/973735</guid><dc:creator><![CDATA[tigrone]]></dc:creator><pubDate>Fri, 11 Feb 2011 12:05:10 GMT</pubDate></item><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 11:59:21 GMT]]></title><description><![CDATA[<p dir="auto">Ho modificato seguendo le tue indicazioni, ma niente da fare appena torna su anagrafica.php cancella tutto e mostra un errore</p>
<pre><code>[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]
</code></pre>
<p dir="auto"><strong>anagrafica.php</strong></p>
<pre><code>&lt;?php
session_start(); 
if (!$id) {
$id = $_POST['id']; 
$_SESSION['id']=$id;
}
?&gt;

&lt;?php require_once('Connections/conn.php'); ?&gt;

&lt;?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION &lt; 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);
?&gt;
</code></pre>
<p dir="auto"><img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/ad0a1f8d-b404-40e4-a46a-e563b14044da-dho.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--arrabbiato" style="height:1.4em;width:auto;vertical-align:middle" title=":x" alt="" /></p>
]]></description><link>https://dev.connect.gt/post/973769</link><guid isPermaLink="true">https://dev.connect.gt/post/973769</guid><dc:creator><![CDATA[condor.uk]]></dc:creator><pubDate>Fri, 11 Feb 2011 11:59:21 GMT</pubDate></item><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 11:53:11 GMT]]></title><description><![CDATA[<p dir="auto">Ti azzera il valore di $id e di conseguenza anche la $_SESSION['id'] perchè riprende il POST...<br />
Allora mettilo così:</p>
<pre><code>&lt;?php
session_start(); 
if (!$_SESSION['id']) {
$id = $_POST['id']; 
} 
$_SESSION['id']=$id;
?&gt;
</code></pre>
<p dir="auto">P.S.: se vuoi avviarti verso la programmazione PHP, partire da zero e studiare è d'OBBLIGO!!<br />
Il tuo approccio attuale è completamente sbagliato... credimi!</p>
]]></description><link>https://dev.connect.gt/post/973734</link><guid isPermaLink="true">https://dev.connect.gt/post/973734</guid><dc:creator><![CDATA[tigrone]]></dc:creator><pubDate>Fri, 11 Feb 2011 11:53:11 GMT</pubDate></item><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 11:15:54 GMT]]></title><description><![CDATA[<p dir="auto">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 <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/8d7b9529-9868-4606-8ca1-85ca7d28c845-wink.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--wink3" style="height:1.4em;width:auto;vertical-align:middle" title=":wink3:" alt="" /></p>
<p dir="auto">Detto questo ti dico che grazie al tuo aiuto sembra che ci siamo quasi, riesco a passare i valori tra due pagine</p>
<p dir="auto"><strong>info_adesione</strong></p>
<pre><code>&lt;?php
session_start();
$id=$_SESSION['id'];
?&gt;

&lt;?php require_once('Connections/conn.php'); ?&gt;


&lt;?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION &lt; 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);

?&gt;
</code></pre>
<p dir="auto"><strong>info_quota_associativa</strong></p>
<pre><code>&lt;?php
session_start();
$id=$_SESSION['id'];
?&gt;
&lt;?php require_once('Connections/conn.php'); ?&gt;

&lt;?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION &lt; 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);
?&gt;
</code></pre>
<p dir="auto">ma quando torno sulla pagina anagrafica.php mi si cancella tutto</p>
<p dir="auto"><strong>anagrafica.php</strong></p>
<pre><code>&lt;?php
session_start(); 
$id = $_POST['id']; 
$_SESSION['id']=$id;
?&gt;

&lt;?php require_once('Connections/conn.php'); ?&gt;

&lt;?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION &lt; 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);
?&gt;
</code></pre>
<p dir="auto">Risolto questo ultimo ostacolo direi che sono apposto <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--wink" style="height:1.4em;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
<p dir="auto">Thanks !</p>
]]></description><link>https://dev.connect.gt/post/973768</link><guid isPermaLink="true">https://dev.connect.gt/post/973768</guid><dc:creator><![CDATA[condor.uk]]></dc:creator><pubDate>Fri, 11 Feb 2011 11:15:54 GMT</pubDate></item><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 10:51:26 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><strong>condor_uk</strong></p>
<p dir="auto">Scusa le domande ma sono alle prime armi <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/54a3bffb-5e4a-4eb8-81dc-99b2072e5d05-175.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--ciauz" style="height:1.4em;width:auto;vertical-align:middle" title=":ciauz:" alt="" /></p>
</blockquote>
<p dir="auto">Ti consiglio di studiare allora! <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--smile" style="height:1.4em;width:auto;vertical-align:middle" title=":D" alt="😄" /><br />
Dunque... non toccare nulla!<br />
Parti da questo presupposto: devi rendere disponibile a tutte le pagine il valore id inviato col form... esatto?</p>
<p dir="auto">Allora:<br />
1- nelle pagine in cui serve recuperare tale valore, metti session_start() all'inizio del codice</p>
<p dir="auto">2- nella pagina che recupera i dati dal form (anagrafica.php), al posto di:</p>
<pre><code>&lt;?php $id = $_POST['id']; ?&gt;
</code></pre>
<p dir="auto">metti</p>
<pre><code>&lt;?php
session_start(); 
$id = $_POST['id']; 
$_SESSION['id']=$id;
?&gt;
</code></pre>
<p dir="auto">3- Per ultimo, in tutte le pagine che necessitano del valore di id metti, all'inizio del file:</p>
<pre><code>&lt;?php
session_start();
$id=$_SESSION['id'];
?&gt;
</code></pre>
<p dir="auto">Prova a vedere se funziona...</p>
<p dir="auto">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!</p>
<p dir="auto">Ciao <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/8d7b9529-9868-4606-8ca1-85ca7d28c845-wink.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--wink3" style="height:1.4em;width:auto;vertical-align:middle" title=":wink3:" alt="" /></p>
]]></description><link>https://dev.connect.gt/post/973733</link><guid isPermaLink="true">https://dev.connect.gt/post/973733</guid><dc:creator><![CDATA[tigrone]]></dc:creator><pubDate>Fri, 11 Feb 2011 10:51:26 GMT</pubDate></item><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 10:05:00 GMT]]></title><description><![CDATA[<p dir="auto">Ciao Tigrone,<br />
quindi nel mio caso basterebbe inserire</p>
<pre><code>$_SESSION['id']='0';
</code></pre>
<p dir="auto">a partire dalla pagina login.php oppure da anagrafica.php o sbaglio ?</p>
<p dir="auto">Scusa le domande ma sono alle prime armi <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/54a3bffb-5e4a-4eb8-81dc-99b2072e5d05-175.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--ciauz" style="height:1.4em;width:auto;vertical-align:middle" title=":ciauz:" alt="" /></p>
]]></description><link>https://dev.connect.gt/post/973766</link><guid isPermaLink="true">https://dev.connect.gt/post/973766</guid><dc:creator><![CDATA[condor.uk]]></dc:creator><pubDate>Fri, 11 Feb 2011 10:05:00 GMT</pubDate></item><item><title><![CDATA[Reply to Creare e mantenere una sessione on Fri, 11 Feb 2011 01:44:23 GMT]]></title><description><![CDATA[<p dir="auto">Per utilizzare le sessioni è sufficiente inserire un 'session_start()' all'inizio del file...</p>
<p dir="auto">Poi, puoi creare tutte le variabili di sessione che ti pare.<br />
Esempio:<br />
$_SESSION['quellochetipare']='valore';</p>
<p dir="auto">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.</p>
]]></description><link>https://dev.connect.gt/post/973732</link><guid isPermaLink="true">https://dev.connect.gt/post/973732</guid><dc:creator><![CDATA[tigrone]]></dc:creator><pubDate>Fri, 11 Feb 2011 01:44:23 GMT</pubDate></item></channel></rss>