the page
Here you have the full code:
<?php require_once('Connections/foto.php'); ?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("webassist/file_manipulation/helperphp.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$maxRows_WADADynListtblAlbums = 1000;
$pageNum_WADADynListtblAlbums = 0;
if (isset($_GET['pageNum_WADADynListtblAlbums'])) {
$pageNum_WADADynListtblAlbums = $_GET['pageNum_WADADynListtblAlbums'];
}
$startRow_WADADynListtblAlbums = $pageNum_WADADynListtblAlbums * $maxRows_WADADynListtblAlbums;
mysql_select_db($database_foto, $foto);
$query_WADADynListtblAlbums = "SELECT albumID, albumTitolo FROM tblAlbums";
$query_limit_WADADynListtblAlbums = sprintf("%s LIMIT %d, %d", $query_WADADynListtblAlbums, $startRow_WADADynListtblAlbums, $maxRows_WADADynListtblAlbums);
$WADADynListtblAlbums = mysql_query($query_limit_WADADynListtblAlbums, $foto) or die(mysql_error());
$row_WADADynListtblAlbums = mysql_fetch_assoc($WADADynListtblAlbums);
if (isset($_GET['totalRows_WADADynListtblAlbums'])) {
$totalRows_WADADynListtblAlbums = $_GET['totalRows_WADADynListtblAlbums'];
} else {
$all_WADADynListtblAlbums = mysql_query($query_WADADynListtblAlbums);
$totalRows_WADADynListtblAlbums = mysql_num_rows($all_WADADynListtblAlbums);
}
$totalPages_WADADynListtblAlbums = ceil($totalRows_WADADynListtblAlbums/$maxRows_WADADynListtblAlbums)-1;?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "foto/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "foto/thumb/",
'FileName' => "[FileName]_thumb",
'DefaultFileName' => "",
'ResizeType' => "4",
'ResizeWidth' => "100",
'ResizeHeight' => "100",
'ResizeFillColor' => "" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "photoLocation", "0", "", "true", $WA_UploadResult1_Params);
}
?>
<?php
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $foto;
$WA_table = "tblPhotos";
$WA_sessionName = "WADA_Insert_tblPhotos";
$WA_redirectURL = "tblPhotos_Detail.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "photoID";
$WA_fieldNamesStr = "photoTitolo|photoTitle|photoDescr|photoDesceng|photoLocation|photoThum|albumID";
$WA_fieldValuesStr = "".((isset($_POST["photoTitolo"]))?$_POST["photoTitolo"]:"") ."" . "|" . "".((isset($_POST["photoTitle"]))?$_POST["photoTitle"]:"") ."" . "|" . "".((isset($_POST["photoDescr"]))?$_POST["photoDescr"]:"") ."" . "|" . "".((isset($_POST["photoDesceng"]))?$_POST["photoDesceng"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".((isset($_POST["photoThum"]))?$_POST["photoThum"]:"") ."" . "|" . "".((isset($_POST["albumID"]))?$_POST["albumID"]:"") ."";
$WA_columnTypesStr = "none,none,NULL";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_foto;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert tblPhotos</title>
<link href="WA_DataAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="WADAInsertContainer">
<form action="tblPhotos_Insert.php" method="post" enctype="multipart/form-data" name="WADAInsertForm" id="WADAInsertForm">
<div class="WADAHeader">Insert Record</div>
<div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">photoID:</th>
<td class="WADADataTableCell"></td>
</tr>
<tr>
<th class="WADADataTableHeader">photoTitolo:</th>
<td class="WADADataTableCell"><input type="text" name="photoTitolo" id="photoTitolo" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">photoTitle:</th>
<td class="WADADataTableCell"><input type="text" name="photoTitle" id="photoTitle" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">photoDescr:</th>
<td class="WADADataTableCell"><input type="text" name="photoDescr" id="photoDescr" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">photoDesceng:</th>
<td class="WADADataTableCell"><input type="text" name="photoDesceng" id="photoDesceng" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">photoLocation:</th>
<td class="WADADataTableCell"><input type="file" name="photoLocation" id="photoLocation" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">photoThum:</th>
<td class="WADADataTableCell"><input type="text" name="photoThum" id="photoThum" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">albumID:</th>
<td class="WADADataTableCell">
<select name="albumID" id="albumID">
<option value="">seleziona l'album</option>
<?php
do {
?>
<option value="<?php echo $row_WADADynListtblAlbums['albumID']?>"><?php echo $row_WADADynListtblAlbums['albumTitolo']?></option>
<?php
} while ($row_WADADynListtblAlbums = mysql_fetch_assoc($WADADynListtblAlbums));
$rows = mysql_num_rows($WADADynListtblAlbums);
if($rows > 0) {
mysql_data_seek($WADADynListtblAlbums, 0);
$row_WADADynListtblAlbums = mysql_fetch_assoc($WADADynListtblAlbums);
}
?>
</select>
</td>
</tr>
</table>
<div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Insert" id="Insert" value="Insert" alt="Insert" src="WA_DataAssist/images/Pacifica/Refined_insert.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="tblPhotos_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="WA_DataAssist/images/Pacifica/Refined_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
</div>
</form>
</div>
</body>
</html>
<?php
mysql_free_result($WADADynListtblAlbums);
?>