Access Code Validation Error: directory "../accesscode/" not found. Script will quit now.'; exit; } if ( !is_writable( $captchaDir ) ) { echo 'ErrorAccess Code Validation Error: directory "../accesscode/" is not writeable. Script will quit now.'; exit; } $handle = opendir( $captchaDir ); while ( $captchaFile = readdir($handle) ) { if ( ( substr($captchaFile, 0, 1) != '.' ) && ( substr($captchaFile, 0, 1) != '_' ) && ( !is_dir( '../accesscode' . '/' . $captchaFile ) ) ) { if ( ( filemtime( '../accesscode' . '/' . $captchaFile ) + 600 ) < time() ) { unlink( '../accesscode' . '/' . $captchaFile ); } } } closedir( $handle ); $handle = @fopen( '../accesscode' . '/' . $fileName, 'w' ); if ( !$handle ) { echo 'ErrorAccess Code Validation Error: unable to create captcha control file. Script will quit now.'; exit; } fclose($handle); if (imagetypes() & IMG_JPG) { header('Content-type: image/jpeg'); imagejpeg($im); } elseif (imagetypes() & IMG_PNG) { header('Content-type: image/png'); imagepng($im); } exit; } function DoStripSlashes($fieldValue) { // temporary fix for PHP6 compatibility - magic quotes deprecated in PHP6 if ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) { if (is_array($fieldValue) ) { return array_map('DoStripSlashes', $fieldValue); } else { return trim(stripslashes($fieldValue)); } } else { return $fieldValue; } } function FilterCChars($theString) { return preg_replace('/[\x00-\x1F]/', '', $theString); } function CheckString($value, $low, $high, $mode, $limitAlpha, $limitNumbers, $limitEmptySpaces, $limitExtraChars, $optional) { $regEx = ''; if ($limitAlpha == kYes) { $regExp = 'A-Za-z'; } if ($limitNumbers == kYes) { $regExp .= '0-9'; } if ($limitEmptySpaces == kYes) { $regExp .= ' '; } if (strlen($limitExtraChars) > 0) { $search = array('\\', '[', ']', '-', '$', '.', '*', '(', ')', '?', '+', '^', '{', '}', '|', '/'); $replace = array('\\\\', '\[', '\]', '\-', '\$', '\.', '\*', '\(', '\)', '\?', '\+', '\^', '\{', '\}', '\|', '\/'); $regExp .= str_replace($search, $replace, $limitExtraChars); } if ( (strlen($regExp) > 0) && (strlen($value) > 0) ){ if (preg_match('/[^' . $regExp . ']/', $value)) { return false; } } if ( (strlen($value) == 0) && ($optional === kOptional) ) { return true; } elseif ( (strlen($value) >= $low) && ($mode == kStringRangeFrom) ) { return true; } elseif ( (strlen($value) <= $high) && ($mode == kStringRangeTo) ) { return true; } elseif ( (strlen($value) >= $low) && (strlen($value) <= $high) && ($mode == kStringRangeBetween) ) { return true; } else { return false; } } function CheckEmail($email, $optional) { if ( (strlen($email) == 0) && ($optional === kOptional) ) { return true; } elseif ( preg_match("/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i", $email) == 1 ) { return true; } else { return false; } } function CheckFTGCaptcha($accessCode) { $captchaDir = '../accesscode'; if ( !is_dir( $captchaDir ) ) { echo 'ErrorAccess Code Validation Error: directory "../accesscode/" not found. Script will quit now.'; exit; } $handle = opendir( $captchaDir ); $fileAccessCode = substr( md5( $accessCode ), 0, 12 ); while ( $captchaFile = readdir( $handle ) ) { if ( substr( $captchaFile, 0, 1 ) != '.' ) { if ( $fileAccessCode == $captchaFile ) { return true; } } } return false; } function DeleteCaptcha($accessCode) { $captchaDir = '../accesscode'; if ( !is_dir( $captchaDir ) ) { echo 'ErrorAccess Code Validation Error: directory "../accesscode/" not found. Script will quit now.'; exit; } $handle = opendir( $captchaDir ); $fileAccessCode = substr( md5( $accessCode ), 0, 12 ); while ( $captchaFile = readdir( $handle ) ) { if ( ( substr( $captchaFile, 0, 1 ) != '.' ) && ( substr( $captchaFile, 0, 1 ) != '_' ) && ( !is_dir( '../accesscode' . '/' . $captchaFile ) ) ) { if ( $fileAccessCode == $captchaFile ) { unlink( '../accesscode' . '/' . $captchaFile ); return; } } } } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $clientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $clientIP = $_SERVER['REMOTE_ADDR']; } if ( isset($_GET['formstogoimgflt']) ) { CaptchaGenerator(); exit; } $FTGclienti_nome = DoStripSlashes( $_POST['clienti_nome'] ); $FTGclienti_cognome = DoStripSlashes( $_POST['clienti_cognome'] ); $FTGclienti_ditta = DoStripSlashes( $_POST['clienti_ditta'] ); $FTGclienti_partitaiva = DoStripSlashes( $_POST['clienti_partitaiva'] ); $FTGclienti_attivita = DoStripSlashes( $_POST['clienti_attivita'] ); $FTGclienti_via = DoStripSlashes( $_POST['clienti_via'] ); $FTGprovincia = DoStripSlashes( $_POST['provincia'] ); $FTGclienti_citta = DoStripSlashes( $_POST['clienti_citta'] ); $FTGclienti_cap = DoStripSlashes( $_POST['clienti_cap'] ); $FTGclienti_telefono = DoStripSlashes( $_POST['clienti_telefono'] ); $FTGclienti_fax = DoStripSlashes( $_POST['clienti_fax'] ); $FTGclienti_web = DoStripSlashes( $_POST['clienti_web'] ); $FTGclienti_email = DoStripSlashes( $_POST['clienti_email'] ); $FTGclienti_password = DoStripSlashes( $_POST['clienti_password'] ); $FTGaccesscode = DoStripSlashes( $_POST['accesscode'] ); $FTGprivacy = DoStripSlashes( $_POST['privacy'] ); $FTGclienti_nome = strip_tags($FTGclienti_nome); $FTGclienti_cognome = strip_tags($FTGclienti_cognome); $FTGclienti_ditta = strip_tags($FTGclienti_ditta); $FTGclienti_partitaiva = strip_tags($FTGclienti_partitaiva); $FTGclienti_attivita = strip_tags($FTGclienti_attivita); $FTGclienti_via = strip_tags($FTGclienti_via); $FTGprovincia = strip_tags($FTGprovincia); $FTGclienti_citta = strip_tags($FTGclienti_citta); $FTGclienti_cap = strip_tags($FTGclienti_cap); $FTGclienti_telefono = strip_tags($FTGclienti_telefono); $FTGclienti_fax = strip_tags($FTGclienti_fax); $FTGclienti_web = strip_tags($FTGclienti_web); $FTGclienti_email = strip_tags($FTGclienti_email); $FTGclienti_password = strip_tags($FTGclienti_password); $FTGaccesscode = strip_tags($FTGaccesscode); $FTGprivacy = strip_tags($FTGprivacy); $validationFailed = false; # Fields Validations if (!CheckString($FTGclienti_nome, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } if (!CheckString($FTGclienti_cognome, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } if (!CheckString($FTGclienti_ditta, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } if (!CheckString($FTGclienti_partitaiva, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } if (!CheckString($FTGclienti_attivita, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } if (!CheckString($FTGprovincia, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } if (!CheckEmail($FTGclienti_email, kMandatory)) { $validationFailed = true; } if (!CheckString($FTGclienti_password, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } if (!CheckFTGCaptcha($FTGaccesscode)) { $validationFailed = true; } if (!CheckString($FTGprivacy, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $validationFailed = true; } # Redirect user to the error page if ($validationFailed === true) { header("Location: https://www.schermiluminosi.com/index.php?a=reguser&do=nok"); } if ( $validationFailed === false ) { # Email to Form Owner $emailSubject = FilterCChars("Il Cliente $FTGclienti_ditta si è registrato su sito"); $emailBody = chunk_split( base64_encode( "\n" . "\n" . "\n" . "\n" . "\n" . "Il cliente $FTGclienti_ditta si รจ registrato sul sito schermiluminosi.com
\n" . "Nome : $FTGclienti_nome
\n" . "Cognome : $FTGclienti_cognome
\n" . "Azienda : $FTGclienti_ditta
\n" . "Partita IVA : $FTGclienti_partitaiva
\n" . "Attivita : $FTGclienti_attivita
\n" . "Via : $FTGclienti_via
\n" . "Provincia : $FTGprovincia
\n" . "Citta : $FTGclienti_citta
\n" . "CAP : $FTGclienti_cap
\n" . "Telefono : $FTGclienti_telefono
\n" . "Fax : $FTGclienti_fax
\n" . "Sito web : $FTGclienti_web
\n" . "Email : $FTGclienti_email
\n" . "Privacy : $FTGprivacy
\n" . "\n" . "\n" . "" ) ) . "\n"; $emailTo = 'info@schermiluminosi.com'; $emailFrom = FilterCChars("$FTGclienti_email"); $emailHeader = "From: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" . "Content-Transfer-Encoding: base64\n" . "\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Confirmation Email to User $confEmailTo = FilterCChars($FTGclienti_email); $confEmailSubject = FilterCChars("Grazie per esserti registrato su Schermiluminosi.com"); $confEmailHeader = "From: info@schermiluminosi.com\n" . "MIME-Version: 1.0\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" . "Content-Transfer-Encoding: base64\n" . "\n"; $confEmailBody = chunk_split( base64_encode( "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "
\n" . "
\n" . "\n" . "\n" . "\n" . "\n" . "

Gentile $FTGclienti_nome $FTGclienti_cognome
la ringraziamo per aver effettuato la registrazione sul nostro sito schermiluminosi.com.
Con i sui dati qui sotto riportati, potrà accedere all'area riservata e scaricare cataloghi e listini.

\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "

I suoi dati di accesso

USERNAME/EMAIL

$FTGclienti_email

PASSWORD

$FTGclienti_password

Conservi questa email in un luogo sicuro. Potrebbe servirle nel caso dimenticasse i dati di accesso a www.schermiluminosi.com

\n" . "\n" . "" ) ) . "\n"; mail($confEmailTo, $confEmailSubject, $confEmailBody, $confEmailHeader); #==================================================== # Dump field values to a MySQL table = #==================================================== $mysqlLink = @mysql_connect("www.schermiluminosi.com", "sche227f_salaric", "26GIRINI1963"); if (mysql_errno() > 0) { echo 'ErrorMySQL error # ' . mysql_errno() . ' : ' . mysql_error() . ''; exit; } if (mysql_errno() == 0) { @mysql_select_db("sche227f_main", $mysqlLink); if (mysql_errno() > 0) { echo 'ErrorMySQL error # ' . mysql_errno() . ' : ' . mysql_error() . ''; exit; } } if (mysql_errno() == 0) { $sqlCmd = sprintf("INSERT INTO `n_05_clienti`(`clienti_nome`, `clienti_cognome`, `clienti_ditta`, `clienti_partitaiva`, `clienti_attivita`, `clienti_via`, `provincia`, `clienti_citta`, `clienti_cap`, `clienti_telefono`, `clienti_fax`, `clienti_web`, `clienti_email`, `clienti_password`, `privacy`, `saved`) VALUES('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", mysql_real_escape_string($FTGclienti_nome, $mysqlLink), mysql_real_escape_string($FTGclienti_cognome, $mysqlLink), mysql_real_escape_string($FTGclienti_ditta, $mysqlLink), mysql_real_escape_string($FTGclienti_partitaiva, $mysqlLink), mysql_real_escape_string($FTGclienti_attivita, $mysqlLink), mysql_real_escape_string($FTGclienti_via, $mysqlLink), mysql_real_escape_string($FTGprovincia, $mysqlLink), mysql_real_escape_string($FTGclienti_citta, $mysqlLink), mysql_real_escape_string($FTGclienti_cap, $mysqlLink), mysql_real_escape_string($FTGclienti_telefono, $mysqlLink), mysql_real_escape_string($FTGclienti_fax, $mysqlLink), mysql_real_escape_string($FTGclienti_web, $mysqlLink), mysql_real_escape_string($FTGclienti_email, $mysqlLink), mysql_real_escape_string($FTGclienti_password, $mysqlLink), mysql_real_escape_string($FTGprivacy, $mysqlLink), mysql_real_escape_string(date('Y-m-d H:i:s'), $mysqlLink)); @mysql_query($sqlCmd, $mysqlLink); if (mysql_errno() > 0) { echo 'ErrorMySQL error # ' . mysql_errno() . ' : ' . mysql_error() . ''; exit; } } DeleteCaptcha($FTGaccesscode); # Redirect user to success page header("Location: https://www.schermiluminosi.com/index.php?a=reguser&do=ok"); } ?>