Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Problema script semplice registrazione

    Ciao a tutti da ieri sera sto provando a far funzionare questo semplice script di registrazione.

    Quando provo a registrarmi mi restituisce: Not found your email in our databaseCannot send Confirmation link to your e-mail address

    Non riesco proprio capire dove sbaglio, spero che voi riusciate ad aiutarmi.

    Vi ringrazio per il vostro tempo ed aiuto.

    Ecco le due pagine, signup.php e signup_ac.php

    Codice PHP:
    <html>
    <
    head>
    </
    head>
    <
    body>
    <
    table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
      <
    tr>
      <
    td><form name="form1" method="post" action="signup_ac.php">
      <
    table width="100%" border="0" cellspacing="4" cellpadding="0">
      <
    tr>
      <
    td colspan="3">[b]Sign up[/b]</td>
      </
    tr>
      <
    tr>
      <
    td width="76">Name</td>
      <
    td width="3">:</td>
      <
    td width="305"><input name="name" type="text" id="name" size="30"></td>
      </
    tr>
      <
    tr>
      <
    td>E-mail</td>
      <
    td>:</td>
      <
    td><input name="email" type="text" id="email" size="30"></td>
      </
    tr>
      <
    tr>
      <
    td>password</td>
      <
    td>:</td>
      <
    td><input name="password" type="password" id="password" size="30"></td>
      </
    tr>
      <
    tr>
      <
    td>Country</td>
      <
    td>:</td>
      <
    td><input name="country" type="text" id="country" size="30"></td>
      </
    tr>
      <
    tr>
      <
    td> </td>
      <
    td> </td>
      <
    td><input type="submit" name="Submit" value="Submit">  
      <
    input type="reset" name="Reset" value="Reset"></td>
      </
    tr>
      </
    table>
    </
    form></td>
      </
    tr>
      </
    table>
    </
    body>
    <
    Html
    Codice PHP:
    <?
      
    include('config.php');

      
    $tbl_name=members_db_temp;
     

      
    $confirm_code=md5(uniqid(rand()));

      
    $name=$_POST['name'];
      
    $email=$_POST['email'];
      
    $country=$_POST['country'];

      
    $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
      
    $result=mysql_query($sql);
      

      if(
    $result){


      
    $to=$email;

      
    $subject="Your confirmation link here";

      
    $header="from: mio sito";

      
    $message="Your Comfirmation link \r\n";
      
    $message.="Click on this link to activate your account \r\n";
      
    $message.="http://www.miosito.com/confirmation.php?passkey=$confirm_code";

      
    $sentmail mail($to,$subject,$message,$header);
    }

      else {
      echo 
    "Not found your email in our database";
      }

      if(
    $sentmail){
      echo 
    "Your Confirmation link Has Been Sent To Your Email Address.";
      }
      else {
      echo 
    "Cannot send Confirmation link to your e-mail address";
      }
    ?>

  2. #2
    Utente di HTML.it L'avatar di boots
    Registrato dal
    Oct 2012
    Messaggi
    1,626
    Codice PHP:
    $tbl_name=members_db_temp
    hai assegnato un valore alla costante? o volevi scrivere $tbl_name="members_db_temp"; ?

    Sicuramente c'è un errore nella query, stampala e controlla se è corretta

  3. #3
    gia grazie per la risposta, quella variabile determina quale db selezionare per inserire i dati nel db, ho provato anche cosi:

    Codice PHP:
    $tbl_name="members_db_temp"
    ma il risultato è lo stesso, secondo te cosa puo essere in alternativa?

  4. #4
    Utente di HTML.it L'avatar di boots
    Registrato dal
    Oct 2012
    Messaggi
    1,626
    come ti ho detto, secondo me la query non va a buon fine. fatti una stampa della query

    Codice PHP:
    $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')"
    echo 
    $sql
    e vedi se è corretta.
    Provala anche su phpmyadmin.

  5. #5
    ciao grazie per la risposta, ci sono stato un po su e mi son reso conto che c'erano due errori,

    il primo, nel config.php c'era la variabile $password e lo script stava usando quella cosi l'ho rinominata.
    il secondo è che non avevo scritto su signup_ac.php questo:
    $password=$_POST['password'];

    ora il problema è che quando provo esce questo:

    INSERT INTO members_db_temp(confirm_code, name, email, password, country)VALUES('e3fc4d2f689c2a4dea0911724960f997', 'gennaro', 'gennahouse@hotmail.it', 'asdasd', 'italy')
    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\WebSites\*******.com_vc6an6zzd8j8xguf\signup_ac .php on line 33
    Cannot send Confirmation link to your e-mail address

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.