<?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[controllo nell'inserimento di valori nel db]]></title><description><![CDATA[<p dir="auto">ciao a tutti, ho un consiglio da chiedere. spesso molti guardando il mio codice mi dicono che non faccio controlli quando faccio degli inserimenti nel database<br />
(per esempio compilare un forum i cui dati vanno nel db) eche cosi tutti possono inserire ogni cosa nel db.</p>
<p dir="auto">che tipo di controlli bisogna fare, mi potete dare qualche consiglio.</p>
<p dir="auto">grazie a tutti</p>
<p dir="auto">ciao</p>
]]></description><link>https://dev.connect.gt/topic/22202/controllo-nell-inserimento-di-valori-nel-db</link><generator>RSS for Node</generator><lastBuildDate>Fri, 27 Nov 2026 18:07:50 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/22202.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Nov 2006 20:27:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to controllo nell'inserimento di valori nel db on Mon, 27 Nov 2006 22:06:54 GMT]]></title><description><![CDATA[<p dir="auto">ho fatto cosi ma mi da questo errore:</p>
<p dir="auto"><strong>Parse error</strong>:  parse error, unexpected T_ELSE in <strong>C:\xampp\htdocs\componente\formutentemessaggistica.php</strong> on line <strong>63</strong></p>
<pre><code>&lt;?php
//Includo i file per la connessione
//e per la verifica Utente
require_once('connessione.php');
require_once('verificalogin.php');
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;?

switch ($_POST['action']) {

case "registra": 

session_start();
//Recupero i valori da una Form mediante il metodo POST
         
    $username = $_POST['username'];
    $password = $_POST['password'];
    $nome= $_POST['nome'];
    $cognome = $_POST['cognome'];
    $cellulare = $_POST['cellulare'];
    $città = $_POST['città'];
    
    /*preg_match("$!(a-Z0-9)$", $nome, $array);
    print_r($array);*/
 if(ereg("^[A-Z0-9]+$",$nome)){
 
 
 
 

     //CONTROLLO SE L'USERNAME UTILIZZATO DA UN NUOVO UTENTE E' GIA' IN USO OPPURE NO
     $query1 = "SELECT username FROM utente WHERE username = '$username'"; 
     $result1 = mysql_query($query1) or die("Errore nella query1:".mysql_error()); 
     
         
         if ((mysql_num_rows($result1) &gt; 0) ){ 
  // SE TROVO UN UTENTE CON QUELL'USERNAME MI DICE CHE IN USO
echo "Il nome $username è in uso"; 
echo "&lt;a href=\"javascript:history.back()\"&gt;Torna Indietro&lt;/a&gt;";
                                         } 


else {

$strSQL = "INSERT INTO utente(username,password, nome, cognome, cellulare, tipo)";
$strSQL .= "VALUES('$username',MD5('".$password."') , '$nome', '$cognome', '$cellulare', 'm')";

mysql_query($strSQL)OR die("Errore nella query:".mysql_error());
echo "&lt;br&gt;REGISTRAZIONE EVVENUTA CON SUCCESSO!!!";
echo "&lt;br&gt;&lt;a href='homepage.php'&gt;Vai all' homepage dell'utente loggato&lt;/a&gt;";
echo("&lt;META http-equiv=\"refresh\" content=\"2;URL=homepage.php\"&gt;\n");

}


else 
 {
 echo "no";
 }
    
$_SESSION['utenteM'][0]=$username;
//Chiudo la connessione al db
mysql_close();


break; 
    
    
    default: 
    echo '
    
&lt;div align="center"&gt;
&lt;h1&gt;REGISTRAZIONE UTENTE MESSAGGISTICA &lt;/h1&gt;
&lt;/div&gt;
&lt;FORM NAME="formregistrazioneutentemessaggistica" action="formutentemessaggistica.php" method="post" &gt;
&lt;div align="center"&gt;  
  &lt;table width="540" height="261" border="0" bordercolor="#99CC33"&gt;
    &lt;tr&gt;
      &lt;td width="75" height="35"&gt;Nome:&lt;/td&gt;
      &lt;td width="155"&gt;&lt;input type="text" name="nome"&gt;&lt;/td&gt;
      &lt;td width="86"&gt;&lt;p&gt;Cognome:&lt;/p&gt;
        &lt;/td&gt;
      &lt;td width="206"&gt;&lt;input type="text" name="cognome"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;input name="action" type="hidden" value="registra"&gt;
    &lt;tr&gt;
      &lt;td height="33"&gt;Cellulare&lt;/td&gt;
      &lt;td colspan="3"&gt;&lt;input name="cellulare" type="text" size="30"&gt;&lt;/td&gt;
      &lt;input type="hidden" name="tipo"&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td height="43"&gt;Citt&amp;agrave;&lt;/td&gt;
      &lt;td&gt;&lt;input name="citt&amp;agrave;" type="text" size="24"&gt;&lt;/td&gt;
    &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td height="41"&gt;Username:&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="username"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td height="35"&gt;Password:&lt;/td&gt;
      &lt;td&gt;&lt;input type="password" name="password"&gt;&lt;/td&gt;
      
    &lt;/tr&gt;

   &lt;td colspan="2" align="center"&gt;&lt;input type="submit" value="Invia"&gt;&lt;/td&gt;
 &lt;/tr&gt;
  &lt;/table&gt;
&lt;/div&gt;
&lt;/form&gt;';

    break;

 }



?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/402092</link><guid isPermaLink="true">https://dev.connect.gt/post/402092</guid><dc:creator><![CDATA[matti]]></dc:creator><pubDate>Mon, 27 Nov 2006 22:06:54 GMT</pubDate></item></channel></rss>