Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. turipazzo
    3. Post
    T

    turipazzo

    @turipazzo

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 1
    • Post 1
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Località palermo Età 39
    0
    Reputazione
    1
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da turipazzo

    • Chiavi primarie

      Ciao ragazzi, essenso nuovo prima di tutto vi saluto tutti..
      Ho cercato all'interno del forum ma non riesco a trovare le risposte al mio problema..

      Utilizzavo tempo fa in uno script php per inserire dati in una tabella ed utilizzavo il seguente codice per rendere i campi univoci:

      $query = "SELECT * FROM `librosoci` WHERE `Nome` = '" . $_POST['Nome'] ."' AND `Cognome` = '" .$_POST['Cognome'] . "' AND `Datadinascita` = '" .$_POST['Datadinascita'] ."';";
      $result = mysql_query($query);
      
      if (!$result)
      echo 'Impossibile ottenere informazioni dal database: '. mysql_error();
      
      $count = mysql_num_rows($result);
      
      if ($count == 0)
      {
      
      

      ma adesso con questo script in php non riesco a renderlo "compatibile".

      <?php require_once('Connections/Modulo.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;
      }
      }
      
      $editFormAction = $_SERVER['PHP_SELF'];
      if (isset($_SERVER['QUERY_STRING'])) {
        $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
      }
      
      
      if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
        $insertSQL = sprintf("INSERT INTO librosoci (Cognome, Nome, Sesso, Indirizzo, N, Localita, Provincia, CAP, Datadinascita, Datadirichiesta, Email, Cellulare, Nazionalita, ViaPiazza, Inviata) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                             
      
      
      
      
                            GetSQLValueString(strtoupper($_POST['Cognome']), "text"),
                             GetSQLValueString(strtoupper($_POST['Nome']), "text"),
                             GetSQLValueString(strtoupper($_POST['Sesso']), "text"),
                             GetSQLValueString(strtoupper($_POST['Indirizzo']), "text"),
                             GetSQLValueString(strtoupper($_POST['N']), "text"),
                             GetSQLValueString(strtoupper($_POST['Localita']), "text"),
                             GetSQLValueString(strtoupper($_POST['Provincia']), "text"),
                             GetSQLValueString(strtoupper($_POST['CAP']), "text"),
                             GetSQLValueString(str_replace("-","/", $_POST['Datadinascita']), "text"),
                             GetSQLValueString(str_replace("-","/", $_POST['Datadirichiesta']), "text"),
                             GetSQLValueString(strtoupper($_POST['Email']), "text"),
                             GetSQLValueString(strtoupper($_POST['Cellulare']), "text"),
                             GetSQLValueString(strtoupper($_POST['Nazionalita']), "text"),
                             GetSQLValueString(strtoupper($_POST['ViaPiazza']), "text"),
                             GetSQLValueString($_POST['Inviata'], "text"));
      
      
      
      
      
      
      
        mysql_select_db($database_Modulo, $Modulo);
        $Result1 = mysql_query($insertSQL, $Modulo)  or die(mysql_error());
      }
      
      
      
      mysql_select_db($database_Modulo, $Modulo);
      $query_mysql = "SELECT Cognome, Nome, Sesso, Indirizzo, N, Localita, Provincia, CAP, Datadinascita, Datadirichiesta, Email, Cellulare, Nazionalita, ViaPiazza, Inviata FROM librosoci";
      $mysql = mysql_query($query_mysql, $Modulo) or die(mysql_error());
      $row_mysql = mysql_fetch_assoc($mysql);
      $totalRows_mysql = mysql_num_rows($mysql);
      ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="w3.org/1999/xhtml">
      <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
      <link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
      <script src="../SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script>
      <link href="../SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" />
      <style type="text/css">
      body,td,th {
      	font-family: Verdana, Geneva, sans-serif;
      	font-weight: bold;
      	font-style: italic;
      	text-align: left;
      }
      </style>
      <body bgcolor="#000000" text="#FFFFFF"><form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
      Arci Barcollo - Modulo Online
      <p>&nbsp;</p>
        <table width="834" border="0">
          <tr>
            <td width="142">Cognome</td>
            <td width="682"><span id="sprytextfield2">
              <label for="Cognome"></label>
              <input name="Cognome" type="text" id="Cognome7" size="30" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Nome</td>
            <td><span id="sprytextfield3">
              <label for="Nome"></label>
              <input name="Nome" type="text" id="Nome" size="30" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Sesso</td>
            <td><span id="sprytextfield4">
              <label for="Sesso"></label>
              <input name="Sesso" type="text" id="Sesso" size="1" maxlength="1" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Via/Piazza</td>
            <td><span id="sprytextfield5">
              <label for="ViaPiazza"></label>
              <input name="ViaPiazza" type="text" id="ViaPiazza" value="VIA" size="6" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Indirizzo</td>
            <td><span id="sprytextfield6">
              <label for="Indirizzo"></label>
              <input name="Indirizzo" type="text" id="Indirizzo" size="40" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>N</td>
            <td><span id="sprytextfield7">
              <label for="N"></label>
              <input name="N" type="text" id="N" size="5" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Localita'</td>
            <td><span id="sprytextfield8">
              <label for="Localita"></label>
              <input name="Localita" type="text" id="Localita" value="PALERMO" size="35" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Provincia</td>
            <td><span id="sprytextfield9">
              <label for="Provincia"></label>
              <input name="Provincia" type="text" id="Provincia" value="PA" size="1" maxlength="2" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>C.A.P.</td>
            <td><span id="sprytextfield10">
              <label for="CAP"></label>
              <input name="CAP" type="text" id="CAP" size="3" maxlength="5" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Data di nascita</td>
            <td><span id="sprytextfield11">
              <label for="Datadinascita"></label>
              <input name="Datadinascita" type="text" id="Datadinascita" size="5" maxlength="8" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span>Formato corretto Esempio 07/04/86</td>
          </tr>
          <tr>
            <td>Data di oggi</td>
            <td><span id="sprytextfield12">
              <label for="Datadirichiesta"></label>
              <input name="Datadirichiesta" type="text" id="Datadirichiesta" size="6" maxlength="10" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span>Formato corretto 01/01/2011</td>
          </tr>
          <tr>
            <td>E-mail</td>
            <td><span id="sprytextfield13">
              <label for="Email"></label>
              <input name="Email" type="text" id="Email" size="30" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Cellulare</td>
            <td><span id="sprytextfield14">
              <label for="Cellulare"></label>
              <input name="Cellulare" type="text" id="Cellulare" size="7" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Nazionalita'</td>
            <td><span id="sprytextfield16">
              <label for="Nazionalita"></label>
              <input name="Nazionalita" type="text" id="Nazionalita" value="ITALIANA" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td>Inviata</td>
            <td><span id="sprytextfield17">
              <label for="Inviata"></label>
              <input name="Inviata" type="text" disabled id="Inviata" value="DCINTERNET" />
            <span class="textfieldRequiredMsg">Campo obbligatorio.</span></span></td>
          </tr>
          <tr>
            <td height="20">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
        <span>
        <label for="Cognome"><span id="sprytextfield15"><span class="textfieldRequiredMsg">bligatorio specificare un valore.</span></span>  </label>
        </span>
        <p><span id="sprycheckbox1">
          <input type="checkbox" name="aggree" id="aggree" />
          Spuntanto la seguente casella 
      di controllo Lei Dichiara di aver preso visione dello<font FACE="Arial,Bold, sans-serif"><b> <a target="_blank" href="statuto.html">statuto</a> </b></font> dell'associazione e di condividerne i contenuti, si impegna altresi' al rispetto dello 
      Statuto sociale e della civile convivenza e dichiara di non avere pendenze 
      penali e di avere il pieno godimento dei diritti civili. Acconsente inoltre al 
      trattamento dei dati personali in relazione all'informativa riportata alla fine 
      dello statuto.
      <label for="aggree"></label>
        <span class="checkboxRequiredMsg">Devi accettare i termini e le condizioni.</span></span></p>
        <input type="submit" name="Invio" id="Invio" value="Invia" />
        <input type="hidden" name="MM_insert" value="form1" />
      </form>
      <script type="text/javascript">
      var sprytextfield15 = new Spry.Widget.ValidationTextField("sprytextfield15");
      var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1");
      var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
      var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
      var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
      var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
      var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
      var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7");
      var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8");
      var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9");
      var sprytextfield10 = new Spry.Widget.ValidationTextField("sprytextfield10");
      var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11");
      var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12");
      var sprytextfield13 = new Spry.Widget.ValidationTextField("sprytextfield13");
      var sprytextfield14 = new Spry.Widget.ValidationTextField("sprytextfield14");
      var sprytextfield16 = new Spry.Widget.ValidationTextField("sprytextfield16");
      var sprytextfield17 = new Spry.Widget.ValidationTextField("sprytextfield17");
      </script>
      </html>
      
      <?php
      mysql_free_result($mysql);
      ?>
      
      

      Spero vivamente che qualcuno di voi possa aiutarmi a farlo funzionare 🙂 facendo in modo che se Cognome, Nome e Datadinascita coincidono lo script porti ad una pagina chiamata utenteesistente.html

      Un saluto, Turi.

      postato in Coding
      T
      turipazzo