setFolder("gallery/motori/"); $objDynamicThumb1->setRenameRule("{rsMotore.img_home}"); $objDynamicThumb1->setResize(300, 0, true); $objDynamicThumb1->setWatermark(false); // Trasformare resultSet in Array $labels = array(); for( $i = 0; $i < $totalRows_rsLingua; $i++ ) { // Array $labels[$row_rsLingua['labelname']] = $row_rsLingua['value_label']; // Go on $row_rsLingua = mysql_fetch_assoc($rsLingua); } function calcolaNome( $nome ) { $colname_rsLingua = "1"; if (isset($_SESSION['idLanguage'])) { $colname_rsLingua = $_SESSION['idLanguage']; } if( strpos( $nome, "/" ) == FALSE ) return $nome; // Italiano if( $colname_rsLingua == 1 ) { $position = strpos( $nome, "/" ); $nomereturned = substr( $nome, 0, $position - 1 ); } // INglese if( $colname_rsLingua == 2 ) { $position = strstr( $nome, "/" ); $nomereturned = substr( $position, 2, strlen( $position ) - 2 ); } return $nomereturned; } if( isset( $_GET['op'] ) && isset( $_GET['type'] ) && isset( $_GET['id'] ) && $_GET['op'] == "add" ) { $colname_rsCarrello = "-1"; if (isset($_SESSION['kt_login_id'])) { $colname_rsCarrello = $_SESSION['kt_login_id']; } $colname_rsCarrello1 = "-1"; if (isset($_GET['id'])) { $colname_rsCarrello1 = $_GET['id']; } mysql_select_db($database_database, $database); $query_rsCarrello = sprintf("SELECT * FROM carrello WHERE type_carrello = '".$_GET['type']."' AND utente_carrello = %s AND articolo_carrello = %s", GetSQLValueString($colname_rsCarrello, "int"), GetSQLValueString($colname_rsCarrello1, "int")); $rsCarrello = mysql_query($query_rsCarrello, $database) or die(mysql_error()); $row_rsCarrello = mysql_fetch_assoc($rsCarrello); $totalRows_rsCarrello = mysql_num_rows($rsCarrello); mysql_select_db($database_database, $database); if( $totalRows_rsCarrello == 0 ) { $query_rsCarrello1 = "INSERT INTO carrello( type_carrello, utente_carrello, articolo_carrello, quantita_carrello ) VALUES( '".$_GET['type']."', ".$_SESSION['kt_login_id'].", ".$_GET['id'].", 1 )"; $rsCarrello1 = mysql_query($query_rsCarrello1, $database) or die(mysql_error()); } else { $query_rsCarrello1 = "UPDATE carrello SET quantita_carrello = ".($row_rsCarrello['quantita_carrello'] + 1)." WHERE type_carrello = '".$_GET['type']."' AND utente_carrello = ".$_SESSION['kt_login_id']." AND articolo_carrello = ".$_GET['id']; $rsCarrello1 = mysql_query($query_rsCarrello1, $database) or die(mysql_error()); } } else if( isset( $_POST['ACTION'] ) && $_POST['ACTION'] == "upd" && isset( $_POST['type'] ) ) { // Update carrello mysql_select_db($database_database, $database); $query_rsCarrello1 = "UPDATE carrello SET quantita_carrello = ".$_POST[$_POST['type'].'_'.$_POST['ARTICOLO']]." WHERE type_carrello = '".$_POST['type']."' AND utente_carrello = ".$_SESSION['kt_login_id']." AND articolo_carrello = ".$_POST['ARTICOLO']; $rsCarrello1 = mysql_query($query_rsCarrello1, $database) or die(mysql_error()); } else if( isset( $_POST['ACTION'] ) && $_POST['ACTION'] == "del" && isset( $_POST['type'] ) ) { // Delete carrello mysql_select_db($database_database, $database); $query_rsCarrello1 = "DELETE FROM carrello WHERE type_carrello = '".$_POST['type']."' AND utente_carrello = ".$_SESSION['kt_login_id']." AND articolo_carrello = ".$_POST['ARTICOLO']; $rsCarrello1 = mysql_query($query_rsCarrello1, $database) or die(mysql_error()); } $colname_rsCarrello = "-1"; if (isset($_SESSION['kt_login_id'])) { $colname_rsCarrello = $_SESSION['kt_login_id']; } mysql_select_db($database_database, $database); $query_rsCarrello = sprintf("SELECT * FROM carrello WHERE utente_carrello = %s ORDER BY id_carrello ASC", GetSQLValueString($colname_rsCarrello, "int")); $rsCarrello = mysql_query($query_rsCarrello, $database) or die(mysql_error()); $row_rsCarrello = mysql_fetch_assoc($rsCarrello); $totalRows_rsCarrello = mysql_num_rows($rsCarrello); ?>