"); #$_POST['f_matricola'] = "1234"; #$_POST['f_nome']="marco"; #$_POST['f_cognome']="surna"; #$_POST['f_password']="123"; #$_POST['f_password1']="123"; ##$_POST['f_mail']="marco.procaccini@me.com"; #$_POST['f_mail']="giorgi@acm.org"; #$_POST['MAX_MATRLEN']=30; #$_POST['MAX_PASSLEN']=30; #$_POST['MAX_NOMELEN']=30; #$_POST['MAX_SURLEN']=30; #$_POST['mailproto']="http"; #$_POST['mailsrv']="x.dii.unisi.it"; #$_POST['mailsrvport']=":8088"; #$_POST['mailuser']="giorgi"; #$_POST['coursedida']="didattica"; #$_POST['courseacro']="arcal1"; #$_POST['savemsg']="dai"; $locmatr=(isset($_POST['f_matricola'])?$_POST['f_matricola']:""); $locnome=(isset($_POST['f_nome'])?$_POST['f_nome']:""); $loccogn=(isset($_POST['f_cognome'])?$_POST['f_cognome']:""); $locpass=(isset($_POST['f_password'])?$_POST['f_password']:""); $locpas1=(isset($_POST['f_password1'])?$_POST['f_password1']:""); $locmail=(isset($_POST['f_mail'])?$_POST['f_mail']:""); $loclchk=(isset($_POST['f_mylcheck'])?$_POST['f_mylcheck']:""); $locsvat=(isset($_POST['saveat'])?$_POST['saveat']:""); $_POST['saveat'] = $locsvat; #$a=$_POST['f_matricola']; #$b=$_POST['f_password']; #$c=$_POST['f_password1']; #echo "$a $b $c"; #$_POST['f_mail'] = trim($_POST['f_mail']); $_POST['f_mail'] = trim($locmail); $_POST['f_mail'] = PREG_REPLACE("/ /", "//", $_POST['f_mail']); #$loccogn = trim($_POST['f_cognome']); $loccogn = trim($loccogn); $loccogn = PREG_REPLACE("/ /", "/_/", $loccogn); $loccogn = PREG_REPLACE("/[^0-9a-zA-Z_]/i", '', $loccogn); $_POST['f_cognome'] = strtoupper(substr($loccogn,0,1)).strtolower(substr($loccogn,1)); $locnome = trim($locnome); $locnome = PREG_REPLACE("/ /", "/_/", $locnome); $locnome = PREG_REPLACE("/[^0-9a-zA-Z_ ]/", "", $locnome); $_POST['f_nome'] = strtoupper(substr($locnome,0,1)).strtolower(substr($locnome,1)); #PRINTDEBUG # #print ("MATRICOLA =".$_POST['f_matricola']."
"); #print ("NOME =".$_POST['f_nome']."
"); #print ("COGNOME =".$_POST['f_cognome']."
"); #print ("PASSWORD =".$_POST['f_password']."
"); #print ("PASSWORD1 =".$_POST['f_password1']."
"); #print ("EMAIL =".$_POST['f_mail']."
"); #print ("MAX_MATRLEN =".$_POST['MAX_MATRLEN']."
"); #print ("MAX_PASSLEN =".$_POST['MAX_PASSLEN']."
"); #print ("MAX_NOMELEN =".$_POST['MAX_NOMELEN']."
"); #print ("MAX_SURLEN =".$_POST['MAX_SURLEN']."
"); $ptmp=PREG_REPLACE("/[<>\$\\\\ \+()#]/", "", $locpass); $ptmp2=str_replace("\$", "", $ptmp); #$ptmp=PREG_REPLACE("/ /", "//", $locpass); #$ptmp2=PREG_REPLACE("/ /", "//", $locpass); #print("CIAO2 ptmp2=".$ptmp2."
"); #if (strpos($_POST['f_mail'], '@')>0) { #print("CIAO3 ".$_POST['f_mail']."
"); if(filter_var($_POST['f_mail'], FILTER_VALIDATE_EMAIL)) { #print("CIAO4
"); if ($ptmp2<>"") { #print("CIAO5
"); if ($locpass==$ptmp2) { #print("CIAO6
"); $_POST['f_password'] = $locpass; $_POST['f_password1'] = $locpas1; $_POST['f_mylcheck'] = $loclchk; if ($_POST['f_matricola']<>"" and $_POST['f_cognome']<>"" and $_POST['f_nome']<>"" and $_POST['f_mail']<>"" and $_POST['f_password']<>"" and $_POST['f_password1']<>"" ) { #print("CIAO7
"); if (strlen($_POST['f_matricola']) < $_POST['MAX_MATRLEN'] and strlen($_POST['f_password']) < $_POST['MAX_PASSLEN'] and strlen($_POST['f_nome']) < $_POST['MAX_NOMELEN'] and strlen($_POST['f_cognome']) < $_POST['MAX_SURLEN']) { #print("CIAO8
"); if ($_POST['f_password']==$_POST['f_password1']) { #print("CIAO9
"); #curl request to mailsrv $maildata = array( 'f_matricola' => $_POST['f_matricola'], 'f_nome' => $_POST['f_nome'], 'f_cognome' => $_POST['f_cognome'], 'f_mail' => $_POST['f_mail'], 'f_password' => $_POST['f_password'], 'f_mylcheck' => $_POST['f_mylcheck'] ); #print("CIAO10
"); #$pathemail=$mailproto."://".$mailsrv."/".$courseowner."/".$coursedida."/".$corso_dir1."/email.php"; if ($_POST['mailuser'] != "") { $myurl = $_POST['mailsrv'].$_POST['mailsrvport']."/~".$_POST['mailuser']."/".$_POST['coursedida']."/".$_POST['courseacro']; } else { $myurl = $_POST['courseacrsh'].".".$_POST['mailsrv'].$_POST['mailsrvport']; } $pathemail=$_POST['mailproto']."://".$myurl."/email.php"; #print("PATH MAIL: $pathemail
"); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); #print_r($maildata); $ch_mail = curl_init(); if ($ch_mail === false) { die('Failed to initialize cURL session
'); } curl_setopt_array($ch_mail, array( CURLOPT_URL => $pathemail, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CONNECTTIMEOUT => 60, //120,// time-out on connect CURLOPT_TIMEOUT => 60, //120,// time-out on response CURLOPT_VERBOSE => true, // Enable verbose mode CURLOPT_POSTFIELDS =>$maildata )); $verbose = fopen('php://temp', 'w+'); curl_setopt($ch_mail, CURLOPT_STDERR, $verbose); $response = curl_exec($ch_mail); if ($response === false) { rewind($verbose); $verboseLog = stream_get_contents($verbose); print ("Registration error:".curl_error($ch_mail)."
"); print ("Registration error:".curl_errno($ch_mail)."
"); echo "
Verbose information:
", nl2br(htmlspecialchars($verboseLog)), "
"; $error_msg = curl_error($ch_mail); echo "
cURL error:
", $error_msg; die('cURL error: ' . $error_msg); } else { #print "
OK
"; echo "
".$_POST['savemsg']." "; # echo 'Response:
' . $response; } curl_close($ch_mail); } else { echo "
".$_POST['savepw1']." "; } #length field check } else { if(strlen($_POST['f_matricola']) >= $_POST['MAX_MATRLEN']){ echo "
".$_POST['checklenmatr']." "; } if(strlen($_POST['f_password']) >= $_POST['MAX_PASSLEN']){ echo "
".$_POST['checklenpass']." "; } if(strlen($_POST['f_nome']) >= $_POST['MAX_NOMELEN']){ echo "
".$_POST['checklennome']." "; } if(strlen($_POST['f_cognome']) >= $_POST['MAX_SURLEN']){ echo "
".$_POST['checklensur']." "; } } #empty field check } else { echo "
".$_POST['saveall']." "; if ($_POST['f_matricola']=="") { echo "
".$_POST['savemat']." "; } if ($_POST['f_cognome']=="") { echo "
".$_POST['savesur']." "; } if ($_POST['f_nome']=="") { echo "
".$_POST['savenam']." "; } if ($_POST['f_password']=="") { echo "
".$_POST['savepas']." "; } if ($_POST['f_password']<>$_POST['f_password1']) { echo "
".$_POST['savepw2']." "; } } } else { echo "
".$_POST['savepw3']." "; } } else { echo "
".$_POST['savepas']." "; } } else { echo "
".$_POST['saveat']." "; } ?>