<?php
session_start();
$user_ID=$_SESSION[user_ID];
if (!$user_ID || $user_ID=='0')
{
header('location: index.php');
die('Login failed');
}
require("util.php");
$sql = new MySQL_class;
$sql->Create("generator");
$esql = new MySQL_class;
$esql->Create("generator");
$table=$_SESSION[var_table];
$project=$_SESSION[var_project];
$field=$_SESSION[var_field];
?>
<?php
$intern=quote($_POST['intern']);
$title=quote($_POST['title']);
$Name=quote($_POST['Name']);
$SessionVar=quote($_POST['SessionVar']);
$Type=quote($_POST['Type']);
$width=quote($_POST['width']);
$height=quote($_POST['height']);
$List=quote($_POST['List']);
$Record=quote($_POST['Record']);
$add=quote($_POST['add']);
$edit=quote($_POST['edit']);
$link_table=quote($_POST['link_table']);
$link_field=quote($_POST['link_field']);
$link_display=quote($_POST['link_display']);
$Default=quote($_POST['Default']);
$Order=quote($_POST['Order']);
if ($order<>'' && $order<>'\'\'') {
$sql->Query("UPDATE `field` SET `order`=`order`+1 WHERE `order`>=$order AND `field`.`table`='$table'");
} else {
$sql->QueryItem("SELECT `order`+1 as next FROM `field` WHERE `field`.`table`='$table' ORDER BY `order` DESC LIMIT 1");
if (!$sql->data[next]) {
$order=1;
} else {
$order=$sql->data[next];
}
}
$sql->Insert("INSERT INTO `field`
(
`sql`,
`table`,
`title`,
`name`,
`sessionvar`,
`type`,
`width`,
`height`,
`List`,
`Record`,
`Add`,
`Edit`,
`link_table`,
`link_field`,
`link_display`,
`default`,
`order`
)
VALUES (
$intern,
'$table',
$title,
$Name,
$SessionVar,
$Type,
$width,
$height,
$List,
$Record,
$add,
$edit,
$link_table,
$link_field,
$link_display,
$Default,
$Order
)");
$affected_rows = $sql->a_rows;
echo "<P><FONT FACE=\"Verdana, sans-serif\"><FONT SIZE=1 STYLE=\"font-size: 8pt\">";
echo "Er is/zijn $affected_rows records toegevoegd<BR>";
echo "$field<BR>";
echo "$intern<BR>";
echo "$title<BR>";
echo "$Name<BR>";
echo "$SessionVar<BR>";
echo "$Type<BR>";
echo "$width<BR>";
echo "$height<BR>";
echo "$List<BR>";
echo "$Record<BR>";
echo "$add<BR>";
echo "$edit<BR>";
echo "$link_table<BR>";
echo "$link_field<BR>";
echo "$link_display<BR>";
echo "$Default<BR>";
echo "</P>";
if ($affected_rows>0) {
echo "<script>window.opener.location.reload(true)</script>";
echo "<script>window.close(self)</script>";
}
$_SESSION[last_63]=$field;
;
?>
<INPUT TYPE=BUTTON VALUE="Close" onClick="window.opener.location.reload(true);self.close()">