<?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[Recuperare un dato dal database Mysql e passarlo in una sessione]]></title><description><![CDATA[<p dir="auto">Ho una database strutturato cosi: id,username,password,grado<br />
allora il login funziona perfettamente solo che non ho la più pallida idea di fare in modo che dopo ke esegue la query_login ricavi il suo grado e lo passi alla sessione $sess_user_grado</p>
<p dir="auto">potete aiutarmi???GRAZIE</p>
<pre><code class="language-php">$sess_user_nick = $_POST['login_nick'];
$sess_user_password = $_POST['login_pwd'];

$query_login = mysql_query("SELECT * FROM fs_utenti WHERE username = '$sess_user_nick' AND password = '$sess_user_password'");
if ($records= mysql_fetch_row($query_login)) {
session_register("sess_user_nick");
session_register("sess_user_password");
} else {
$err = 1;
}
</code></pre>
]]></description><link>https://dev.connect.gt/topic/22554/recuperare-un-dato-dal-database-mysql-e-passarlo-in-una-sessione</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Dec 2026 14:36:16 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/22554.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 02 Dec 2006 11:16:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Recuperare un dato dal database Mysql e passarlo in una sessione on Wed, 06 Dec 2006 16:06:25 GMT]]></title><description><![CDATA[<p dir="auto">prova così:</p>
<pre><code class="language-php">if ($_POST['entra'] != "") {

# Recuper i dati dal forrm
$sess_user_nick = $_POST['login_nick'];
$sess_user_password = $_POST['login_pwd'];

$query_login = mysql_query("SELECT grado FROM fs_utenti WHERE username = '$sess_user_nick' AND password = '$sess_user_password'");
if ($records= mysql_fetch_row($query_login)) {
$_SESSION['username'] = "sess_user_nick";
$_SESSION['password'] = "sess_user_password";
$_SESSION['grado'] = $records["grado"];

echo "$level --- $grado  --- $sess_user_nick";

} else {
$err = 1;
}
}
</code></pre>
]]></description><link>https://dev.connect.gt/post/404457</link><guid isPermaLink="true">https://dev.connect.gt/post/404457</guid><dc:creator><![CDATA[tiago]]></dc:creator><pubDate>Wed, 06 Dec 2006 16:06:25 GMT</pubDate></item><item><title><![CDATA[Reply to Recuperare un dato dal database Mysql e passarlo in una sessione on Wed, 06 Dec 2006 16:05:13 GMT]]></title><description><![CDATA[<p dir="auto">ci sono riuscito grazie lo stesso</p>
]]></description><link>https://dev.connect.gt/post/404485</link><guid isPermaLink="true">https://dev.connect.gt/post/404485</guid><dc:creator><![CDATA[thedarkita]]></dc:creator><pubDate>Wed, 06 Dec 2006 16:05:13 GMT</pubDate></item><item><title><![CDATA[Reply to Recuperare un dato dal database Mysql e passarlo in una sessione on Wed, 06 Dec 2006 16:02:14 GMT]]></title><description><![CDATA[<p dir="auto">ho provato pure cosi ma nn trova i dati del grado</p>
<pre><code class="language-php">if ($_POST['entra'] != "") {

# Recuper i dati dal forrm
$sess_user_nick = $_POST['login_nick'];
$sess_user_password = $_POST['login_pwd'];

$query_login = mysql_query("SELECT grado FROM fs_utenti WHERE username = '$sess_user_nick' AND password = '$sess_user_password'");
if ($records= mysql_fetch_row($query_login)) {
$_SESSION['username'] = "sess_user_nick";
$_SESSION['password'] = "sess_user_password";
$_SESSION['grado'] = $row["grado"];

echo "$level --- $grado  --- $sess_user_nick";

} else {
$err = 1;
}
}
</code></pre>
]]></description><link>https://dev.connect.gt/post/404484</link><guid isPermaLink="true">https://dev.connect.gt/post/404484</guid><dc:creator><![CDATA[thedarkita]]></dc:creator><pubDate>Wed, 06 Dec 2006 16:02:14 GMT</pubDate></item><item><title><![CDATA[Reply to Recuperare un dato dal database Mysql e passarlo in una sessione on Wed, 06 Dec 2006 14:39:38 GMT]]></title><description><![CDATA[<p dir="auto">help</p>
]]></description><link>https://dev.connect.gt/post/404480</link><guid isPermaLink="true">https://dev.connect.gt/post/404480</guid><dc:creator><![CDATA[thedarkita]]></dc:creator><pubDate>Wed, 06 Dec 2006 14:39:38 GMT</pubDate></item><item><title><![CDATA[Reply to Recuperare un dato dal database Mysql e passarlo in una sessione on Sun, 03 Dec 2006 16:06:52 GMT]]></title><description><![CDATA[<p dir="auto"><strong>in quel modo mi dava errore e ho fatto</strong></p>
<pre><code class="language-php">$_SESSION("user_name") == $records['username'];
$_SESSION("user_password") == $records['password'];
$_SESSION("user_grado") == $records['grado'];
</code></pre>
<p dir="auto"><strong>ma appena faccio il login mi salta fuori questo errore</strong><br />
<strong>Fatal error</strong>:  Call to undefined function:  array() in <strong>/membri/freeesoccer/login.php</strong> on line <strong>18</strong></p>
]]></description><link>https://dev.connect.gt/post/404483</link><guid isPermaLink="true">https://dev.connect.gt/post/404483</guid><dc:creator><![CDATA[thedarkita]]></dc:creator><pubDate>Sun, 03 Dec 2006 16:06:52 GMT</pubDate></item><item><title><![CDATA[Reply to Recuperare un dato dal database Mysql e passarlo in una sessione on Sun, 03 Dec 2006 15:44:11 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">$sess_user_nick = $_POST['login_nick'];<br />
$sess_user_password = $_POST['login_pwd'];</p>
<p dir="auto">$query_login = mysql_query("SELECT * FROM fs_utenti WHERE username = '$sess_user_nick' AND password = '$sess_user_password'");</p>
<p dir="auto">if ($records= mysql_fetch_row($query_login)) {<br />
session_register("sess_user_nick");<br />
session_register("sess_user_password");<br />
} else {<br />
$err = 1;<br />
}</p>
</blockquote>
<p dir="auto">Così come hai scritto questo codice in primis attento poiché sei passibile di sql injection, comunque sorvolando sull'argomento sicurezza, pewrsonalmente dovresti fare così:</p>
<pre><code>[COLOR=#000000][COLOR=#0000bb]$sess_user_nick [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'login_nick'[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000bb]$sess_user_password [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'login_pwd'[/COLOR][COLOR=#007700]];

[/COLOR][COLOR=#0000bb]$query_login [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"SELECT * FROM fs_utenti WHERE username = '$sess_user_nick' AND password = '$sess_user_password'"[/COLOR][COLOR=#007700]);

if ([/COLOR][COLOR=#0000bb]$records [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]mysql_fetch_[COLOR=#007700]array[/COLOR][/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$query_login[/COLOR][COLOR=#007700])) {
[/COLOR][COLOR=#0000bb]session_start[/COLOR][COLOR=#007700]([/COLOR][COLOR=#007700]);
[/COLOR][/COLOR][COLOR=#000000][COLOR=#0000bb]$_SESSION[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"user_name"[/COLOR][COLOR=#007700]) = $records['username'];[/COLOR][/COLOR]
[COLOR=#000000][COLOR=#0000bb]$_SESSION[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"user_password"[/COLOR][COLOR=#007700]) = $records['password'];
[/COLOR][/COLOR][COLOR=#000000][COLOR=#0000bb]$_SESSION[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"user_grado"[/COLOR][COLOR=#007700]) = $records['grado'];[/COLOR][/COLOR]
[COLOR=#000000][COLOR=#007700]} else {
[/COLOR][COLOR=#0000bb]$err [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]1[/COLOR][COLOR=#007700];
}  [/COLOR][/COLOR]
</code></pre>
<p dir="auto">in questo modo hai 3 variabili di sessione inizializzate con i dati di cui hai bisogno!</p>
]]></description><link>https://dev.connect.gt/post/404450</link><guid isPermaLink="true">https://dev.connect.gt/post/404450</guid><dc:creator><![CDATA[spaccioman]]></dc:creator><pubDate>Sun, 03 Dec 2006 15:44:11 GMT</pubDate></item><item><title><![CDATA[Reply to Recuperare un dato dal database Mysql e passarlo in una sessione on Sun, 03 Dec 2006 14:28:19 GMT]]></title><description><![CDATA[<p dir="auto">nn credo sia impossibile e ke io sn negato</p>
]]></description><link>https://dev.connect.gt/post/404478</link><guid isPermaLink="true">https://dev.connect.gt/post/404478</guid><dc:creator><![CDATA[thedarkita]]></dc:creator><pubDate>Sun, 03 Dec 2006 14:28:19 GMT</pubDate></item></channel></rss>