location.href=\"index.php\"; "; } //$absdir = "d:\\worker\\cnr\\upload\\"; $absdir = "\\\\WAGNER\\wwwroot$\\cnrinfo.it\\upload\\"; //$absurl = "http://localhost/CNR/"; $absurl = "http://www.cnrinfo.it/"; $dbname="cnrinfo_it_gest"; $hn = "hostingmysql172.register.it"; $un = "RM8915_CNRINFO"; $pn = "15121971"; //$dbname="cnrinfo_it_gest"; //$hn = "localhost"; //$un = "root"; //$pn = "root"; $link=mysql_pconnect($hn,$un,$pn); mysql_select_db($dbname,$link); if ($_POST["act"]=="Salvau") { $sql= "UPDATE ".$_SESSION["table"]." SET "; foreach ($_POST as $el => $va) { if (($el!=$_SESSION["id"]) && ($el!="act")) { $sql.= $el."='".$va."', "; } } $sql = substr($sql, 0, -2) ; $sql .= " WHERE ".$_SESSION["id"]."=".$_POST[$_SESSION["id"]]; //echo $sql; mysql_query($sql,$link); } if ($_POST["act"]=="Salvai") { $sql= "INSERT INTO ".$_SESSION["table"]." ("; $val = "("; foreach ($_POST as $el => $va) { if (($el!=$_SESSION["id"]) && ($el!="act")) { $sql.= $el.", "; $val.= "'".$va."', "; } } $sql = substr($sql, 0, -2) ; $val = substr($val, 0, -2) ; $sql .= $val.")"; echo $sql; //mysql_query($sql,$link); } function clear_name ($val) { $val = str_replace("upload/", "", $val); $val = str_replace("Listino", "", $val); $val = str_replace("listino", "", $val); $val = str_replace("anagrafiche", "", $val); $val = str_replace("clienti", "", $val); $val = str_replace("articoli", "", $val); $val = str_replace("_", "", $val); $val = str_replace(".xml", "", $val); return $val; } function extract_numbers($string) { preg_match_all('/([\d]+)/', $string, $match); return $match; } function response_data ($string) { $tmp1 = explode (" ", $string); $tmp2 = explode ("-", $tmp1[0]); $fin = $tmp2[2]."/".$tmp2[1]."/".$tmp2[0]; if ($fin=="//") { $fin=""; } return $fin; } function response_valuta ($string) { $tmp = number_format( $string, 2, ',', '.'); $tmp = "€ ". $tmp; return $tmp; } function response_punti ($string) { $tmp=str_replace(",", ".", $string); $tmp=$tmp/1.35; $tmp=number_format($tmp, 0, ',', '.'); return $tmp; } function response_punti_sconto ($string, $sc) { $tmp=str_replace(",", ".", $string); $tmp=$tmp/$sc; $tmp=number_format($tmp, 0, ',', '.'); return $tmp; } function replace_all_out_spec ($testo) { if (trim(" ".$testo)<>"") { $testo = $testo." "; $var = str_replace ( "|", "'", $testo); } else { $var = "-"; } return $var; } function replace_all_in ($testo) { $var = str_replace ( "'", "|", $testo); return $var; } function replace_virgolette($testo) { $testo = str_replace ("|", "'", $testo); $testo = str_replace ("", "€", $testo); $testo = str_replace ("", "è", $testo); $testo = str_replace ("", "è", $testo); return $testo; } function replace_virgolette_in ($testo) { $testo = str_replace ("'", "|", $testo); return $testo; } function data_ins($data) { $first= split(" ", $data); $elementi = split("/", $first[0]); $nuova_data = $elementi[2]."-".$elementi[1]."-".$elementi[0]." ".$first[1]; return $nuova_data; } function data_out($data) { $first= split(" ", $data); $elementi = split("-", $first[0]); $nuova_data = $elementi[2]."/".$elementi[1]."/".$elementi[0]." ".$first[1]; return $nuova_data; } function mailAllegati ($mex, $oggetto, $aChi, $mittente, $allegato, $nomeAllegato, $bcc = "", $reply = "", $stile = "") { $filetype = mime_content_type($allegato); $filez = fopen($allegato, "r"); $contents = fread($filez, filesize($allegato)); $encoded_attach = chunk_split(base64_encode($contents)); fclose($filez); if ($reply == "") $reply = $mittente; // CREO L'INTESTAZIONE $testa = "From: $mittente\n"; if ($bcc != "") $testa .= "BCC: $bcc;\n"; $testa .= "Reply-To: $reply\n"; $testa .= "X-Mailer: Sismail Web Email Interface\n"; $testa .= "MIME-version: 1.0\n"; $testa .= "Content-type: multipart/mixed;\n"; $testa .= " boundary=\"Message-Boundary\"\n"; $testa .= "Content-transfer-encoding: 7BIT\n"; $testa .= "X-attachments: $nomeAllegato"; // CREO IL MESSAGGIO $corpo = "--Message-Boundary\n"; $corpo .= "Content-type: text/html; charset=iso-8859-1\n"; $corpo .= "Content-transfer-encoding: 7BIT\n"; $corpo .= "Content-description: Mail message body\n\n"; $corpo .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; $corpo .= "<HTML><HEAD>"; $corpo .= "<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">"; $corpo .= $stile; $corpo .= "</HEAD>"; $corpo .= "<BODY>"; $corpo .= $mex; $corpo .= "</BODY></HTML>"; $corpo .= "\n\n--Message-Boundary\n"; $corpo .= "Content-type: $filetype; name=\"$nomeAllegato\"\n"; $corpo .= "Content-Transfer-Encoding: BASE64\n"; $corpo .= "Content-disposition: attachment; filename=\"$nomeAllegato\"\n\n"; $corpo .= "$encoded_attach\n"; $corpo .= "--Message-Boundary--\n"; if(@mail($aChi, $oggetto, $corpo, $testa)) return true; else return false; }?> LineaCredit