Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 18 su 18
  1. #11
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    IHMO dovresti specificare "indirizzo e-mail".
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  2. #12
    Utente di HTML.it L'avatar di clasku
    Registrato dal
    Aug 2006
    Messaggi
    3,197
    Quote Originariamente inviata da badaze Visualizza il messaggio
    Non c'è l'immissione della mail nella form (o allora mi manca un elemento).

    Allegato 27802
    ah boh, io ho guardato solo la parte di codice che potrebbe restituirgli errore quando tenta di mandare l'email via PHP

  3. #13
    Ho controllato meglio e hai ragione tu io mi sono dimenticato di mettere la text mail. Ora ho modificato tutto e non funziona lo stesso adesso posto tutto

    registrati.php
    codice:
    <html>
    <head>
    <title>Modulo di registrazione</title>
    </head>
    <body>
    <form action="register.php" method="post">
    <div align="center">
    <table border="0" width="300">
    	<tr>
    		<td>Nome:</td>
    		<td><input type="text" name="name"></td>
    	</tr>
    	<tr>
    		<td>Cognome:</td>
    		<td><input type="text" name="surname"></td>
    	</tr>
    	<tr>
    		<td>Indirizzo:</td>
    		<td><input type="text" name="indirizzo"></td>
    	</tr>
    	<tr>
    		<td>Occupazione</td>
    		<td><input type="text" name="occupazione"></td>
    	</tr>
    	<tr>
    		<td>Username:</td>
    		<td><input type="text" name="username"></td>
    	</tr>
    	<tr>
    		<td>Password:</td>
    		<td><input type="password" name="password"></td>
    	</tr>
    	<tr>
    		<td>Mail:</td>
    		<td><input type="text" name="mail"></td>
    	</tr>
    	<tr>
    		<td colspan="2" align="center"><input type="submit" name="action" value="Invia"></td>
    	</tr>
    </table>
    </div>
    </form>
    </body>
    </html>
    register.php

    codice:
    <html>
    <head>
    <style type="text/css">
    .style1 {
    	color: #FF0000;
    	font-weight: bold;
    }
    </style>
    </head>
    <body>
    <?php
    include_once("include/config.php");
    include_once("include/reg.lib.php");
    
    
    if(isset($_POST['action']) and $_POST['action'] == 'Invia'){
    	$ret = reg_check_data($_POST);
    	$status = ($ret === true) ? reg_register($_POST) : REG_ERRORS;
    	
    	switch($status){
    		case REG_ERRORS:
    			?>
    			<span class="style1">Sono stati rilevati i seguenti errori:</span><br>
    			<?php
    			foreach($ret as $error)
    				printf("<b>%s</b>: %s<br>", $error[0], $error[1]);
    			?>
    			<br>Premere "indietro" per modificare i dati
    			<?php
    		break;
    		case REG_FAILED:
    			echo "Registrazione Fallita a causa di un errore interno.";
    		break;
    		case REG_SUCCESS:
    			echo "Registrazione avvenuta con successo.<br>
    			Vi è stata inviata una email contente le istruzioni per confermare la registrazione.";
    		break;
    	}
    }
    ?>
    </body>
    </html>
    reg.lib.php

    codice:
    <?php
    function reg_register($data){
    	//registro l'utente
    	global $_CONFIG;
    	
    	$id = reg_get_unique_id();
    	mysql_query("
    	INSERT INTO ".$_CONFIG['table_utenti']."
    	(name, surname, indirizzo, occupazione, username, password, temp, regdate, uid)
    	VALUES
    	('".$data['name']."','".$data['surname']."','".$data['indirizzo']."',
    	'".$data['occupazione']."','".$data['username']."',MD5('".$data['password']."'),
    	'1', '".time()."','".$id."')");
    	
    	//Decommentate la riga seguente per testare lo script in locale
    	//echo "<a href=\"http://localhost/Articoli/autenticazione/2/scripts/confirm.php?id=".$id."\">Conferma</a>";
    	if(mysql_insert_id()){
    		return reg_send_confirmation_mail($data['mail'], "test@localhost", $id);
    	}else return REG_FAILED;
    }
    
    
    function reg_send_confirmation_mail($to, $from, $id){
    	//invio la mail di conferma
    	$msg = "Per confermare l'avvenuta registrazione, clicckate il link seguente:
    	http://localhost/Articoli/autenticazione/1/scripts/confirm.php?id=".$id."
    	";
    	return (mail($to, "Conferma la registrazione", $msg, "From: ".$from)) ? REG_SUCCESS : REG_FAILED;
    }
    
    
    function reg_clean_expired(){
    	global $_CONFIG;
    	
    	$query = mysql_query("
    	DELETE FROM ".$_CONFIG['table_utenti']."
    	WHERE (regdate + ".($_CONFIG['regexpire'] * 60 * 60).") <= ".time()." and temp='1'");
    }
    
    
    function reg_get_unique_id(){
    	//restituisce un ID univoco per gestire la registrazione
    	list($usec, $sec) = explode(' ', microtime());
    	mt_srand((float) $sec + ((float) $usec * 100000));
    	return md5(uniqid(mt_rand(), true));
    }
    
    
    function reg_check_data(&$data){
    	global $_CONFIG;
    	
    	$errors = array();
    	
    	foreach($data as $field_name => $value){
    		$func = $_CONFIG['check_table'][$field_name];
    		if(!is_null($func)){
    			$ret = $func($value);
    			if($ret !== true)
    				$errors[] = array($field_name, $ret);
    		}
    	}
    	
    	return count($errors) > 0 ? $errors : true;
    }
    
    
    function reg_confirm($id){
    	global $_CONFIG;
    	
    	$query = mysql_query("
    	UPDATE ".$_CONFIG['table_utenti']."
    	SET temp='0'
    	WHERE uid='".$id."'");
    	
    	return (mysql_affected_rows () != 0) ? REG_SUCCESS : REG_FAILED;
    }
    ?>
    config.php

    codice:
    <?php
    $_CONFIG['host'] = "localhost";
    $_CONFIG['user'] = "root";
    $_CONFIG['pass'] = "root";
    $_CONFIG['dbname'] = "pesca";
    $_CONFIG['port'] = 8888;
    $_CONFIG['table_sessioni'] = "sessioni";
    $_CONFIG['table_utenti'] = "utenti";
    
    
    $_CONFIG['expire'] = 60;
    $_CONFIG['regexpire'] = 24; //in ore
    
    
    $_CONFIG['check_table'] = array(
    	"username" => "check_username",
    	"password" => "check_global",
    	"nome" => "check_global",
    	"cognome" => "check_global",
    		"indirizzo" => "check_global",
    	"occupazione" => "check_global",
    	"mail" => "check_global"
    );
    
    
    function check_username($value){
    	global $_CONFIG;
    	
    	$value = trim($value);
    	if($value == "")
    		return "Il campo non può essere lasciato vuoto";
    	$query = mysqli_query($success,"
    	SELECT id
    	FROM ".$_CONFIG['table_utenti']."
    	WHERE username='".$value."'");
    	
    	if(mysqli_num_rows($query) != 0)
    		return "Nome utente già utilizzato";
    	
    	return true;
    }
    
    
    function check_global($value){
    	global $_CONFIG;
    	
    	$value = trim($value);
    	if($value == "")
    		return "Il campo non può essere lasciato vuoto";
    	
    	return true;
    }
    
    
    
    
    //--------------
    define('AUTH_LOGGED', 99);
    define('AUTH_NOT_LOGGED', 100);
    
    
    define('AUTH_USE_COOKIE', 101);
    define('AUTH_USE_LINK', 103);
    define('AUTH_INVALID_PARAMS', 104);
    define('AUTH_LOGEDD_IN', 105);
    define('AUTH_FAILED', 106);
    
    
    define('REG_ERRORS', 107);
    define('REG_SUCCESS', 108);
    define('REG_FAILED', 109);
    
    
    $link = mysqli_init();
    $success = mysqli_real_connect($link,$_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass'], $_CONFIG['dbname'], $_CONFIG['port']);
    ?>
    e inoltre ho aggiunto sul Database tabella utenti
    mail

  4. #14
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Classico problema che ne nasconde altri.
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  5. #15
    Infatti io non riesco a capire dove sta l'errore. Mi sai dire come vedo dove ci sono problemi direttamente come ad esempio visual basic ti dice dove hai sbagliato

  6. #16
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Quote Originariamente inviata da Danielepaol Visualizza il messaggio
    Infatti io non riesco a capire dove sta l'errore. Mi sai dire come vedo dove ci sono problemi direttamente come ad esempio visual basic ti dice dove hai sbagliato
    Dovresti seguire il suggerimento di clasku, cioè provare con php mailer.
    Per sapere dove si trovano i problemi metto delle tracce nei programmi. Per esempio stampo a video i valori delle variabili che voglio controllare. Stampo a video dei messaggi per vedere dove si passa nel programma.
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  7. #17
    si l ho appena scarico ma che devo fare nel php mailer?

  8. #18
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    L'ho installato 10 anni fa. Manco mi ricordo. Cerca in rete che troverai.
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

Tag per questa discussione

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 © 2025 vBulletin Solutions, Inc. All rights reserved.