Location: PHPKode > projects > Electronic Design Automation - Index > eda-index-1.0MLH/web/edititem.php
<?php
require("config.inc.php");
require("top.inc.php");

#########################################################################
# Electronic Design Automation - Index (EDA - Index)			#
#########################################################################
#									#
# Copyright (c) 2003 by Bruno Thomsen (hide@address.com)	#
# My Homepage: http://www.spacecave.dk/					#
# Project Homepage: http://eda-index.sourceforge.net/			#
# Project @ SourceForge.net: http://sourceforge.net/projects/eda-index/	#
# Project @ Freshmeat.net: http://freshmeat.net/projects/eda-index/	#
# Project Demo: http://eda-index.sourceforge.net/demo/			#
#									#
# This program is free software; you can redistribute it and/or modify	#
# it under the terms of the GNU General Public License as published by	#
# the Free Software Foundation; either version 2 of the License, or	#
# (at your option) any later version.					#
#									#
# This program is distributed in the hope that it will be useful,	#
# but WITHOUT ANY WARRANTY; without even the implied warranty of	#
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the		#
# GNU General Public License for more details.				#
#									#
#########################################################################

?>

<?php
if ($pw == $aepassword){

opendb($dbhost,$dbuser,$dbpass,$dbname);

if ($type == 1) {
mysql_query("UPDATE `$tabels[1]` SET idref='$idref', nr='$inr', rev='$irev', description='$idescription', pcbref='$ref1', pcbrevref='$revref1', fpref='$ref2', fprevref='$revref2', name='$iname', date='$idate', note='$inote', cad='$icad' WHERE id='$id' LIMIT 1");
} elseif ($type == 2) {
mysql_query("UPDATE `$tabels[2]` SET idref='$idref', nr='$inr', rev='$irev', description='$idescription', schref='$ref1', schrevref='$revref1', fpref='$ref2', fprevref='$revref2', name='$iname', date='$idate', note='$inote', cad='$icad' WHERE id='$id' LIMIT 1");
} elseif ($type == 3) {
mysql_query("UPDATE `$tabels[3]` SET idref='$idref', nr='$inr', rev='$irev', description='$idescription', schref='$ref1', schrevref='$revref1', pcbref='$ref2', pcbrevref='$revref2', name='$iname', date='$idate', note='$inote', cad='$icad' WHERE id='$id' LIMIT 1");
} elseif ($type == 4) {
mysql_query("UPDATE `$tabels[4]` SET idref='$idref', nr='$inr', rev='$irev', description='$idescription', schref='$ref1', schrevref='$revref1', pcbref='$ref2', pcbrevref='$revref2', name='$iname', date='$idate', note='$inote', cad='$icad', type='$ipldtype' WHERE id='$id' LIMIT 1");
}

$link = "$path". "viewsingleproject.php?pid=". "$idref";
?>

<script language=javascript>
<!--
window.location.replace('<?php echo $link; ?>');
// -->
</script>

<?php
closedb();
} else {
?>

<?php
opendb($dbhost,$dbuser,$dbpass,$dbname);
$sql = "SELECT * FROM `$tabels[$type]` WHERE id='$id'";
$result = getdata($sql);
while ($data = mysql_fetch_array($result)) {
?>

<center><font size="4"><?php echo "$edit $datatype1[$type]"; ?></font><br/><br/>
<font size="3"><map id="add"><form method="post" action="<?php echo $PHP_SELF; ?>?type=<?php echo $type; ?>&amp;idref=<?php echo $data[1]; ?>&amp;id=<?php echo $id; ?>">

<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr><td><?php echo $password; ?>:</td></tr>
<tr><td><input type="password" size="20" name="pw"/></td></tr>
<tr><td><?php echo $date; ?>: (YYYY-MM-DD)</td></tr>
<tr><td><input type="text" value="<?php echo $data[10]; ?>" size="20" name="idate"/></td></tr>
<tr><td><?php echo $designer; ?>:</td></tr>
<tr><td><input type="text" value="<?php echo $data[9]; ?>" size="20" name="iname"/></td></tr>
<tr><td><?php echo "$datatype1[0] $ref"; ?>:</td></tr>
<tr><td><input type="text" value="<?php echo $data[1]; ?>" size="20" name="idref"/></td></tr>
<?php if ($type == 4) { ?>
<tr><td><?php echo $pldtype; ?>:</td></tr>
<tr><td><input type="text" value="<?php echo $data[13]; ?>" size="20" name="ipldtype"/></td></tr>
<?php } else { } ?>
<tr><td><?php echo $cad; ?>:</td></tr>
<tr><td><input type="text" value="<?php echo $data[12]; ?>" size="40" name="icad"/></td></tr>
<tr><td><?php echo $description; ?>:</td></tr>
<tr><td><input type="text" value="<?php echo $data[4]; ?>" size="40" name="idescription"/></td></tr>
<tr><td><?php echo $note; ?>:<br/></td></tr>
<tr><td><textarea name="inote" cols="40" rows="10"><?php echo $data[11]; ?></textarea><br/></td></tr>
</table>

<table width="350" border="0" cellspacing="0" cellpadding="0">
<tr><td>
<?php echo "$datatype3[$type] $nr"; ?>:<br/>
<input type="text" value="<?php echo $data[2]; ?>" size="10" name="inr"/><br/>
<?php echo "$datatype3[$type] $rev"; ?>:<br/>
<input type="text" value="<?php echo $data[3]; ?>" size="5" name="irev"/>
</td><td>
<?php if ($type == 1) { ?>
<?php echo "$datatype3[2] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[5]; ?>" size="10" name="ref1"/><br/>
<?php echo "$datatype3[2] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[6]; ?>" size="5" name="revref1"/>
</td><td>
<?php echo "$datatype3[3] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[7]; ?>" size="10" name="ref2"/><br/>
<?php echo "$datatype3[3] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[8]; ?>" size="5" name="revref2"/>
</td></tr>
<?php } elseif ($type == 2) { ?>
<?php echo "$datatype3[1] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[5]; ?>" size="10" name="ref1"/><br/>
<?php echo "$datatype3[1] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[6]; ?>" size="5" name="revref1"/>
</td><td>
<?php echo "$datatype3[3] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[7]; ?>" size="10" name="ref2"/><br/>
<?php echo "$datatype3[3] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[8]; ?>" size="5" name="revref2"/>
</td></tr>
<?php } elseif ($type == 3) { ?>
<?php echo "$datatype3[1] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[5]; ?>" size="10" name="ref1"/><br/>
<?php echo "$datatype3[1] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[6]; ?>" size="5" name="revref1"/>
</td><td>
<?php echo "$datatype3[2] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[7]; ?>" size="10" name="ref2"/><br/>
<?php echo "$datatype3[2] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[8]; ?>" size="5" name="revref2"/>
</td></tr>
<?php } elseif ($type == 4) { ?>
<?php echo "$datatype3[1] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[5]; ?>" size="10" name="ref1"/><br/>
<?php echo "$datatype3[1] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[6]; ?>" size="5" name="revref1"/>
</td><td>
<?php echo "$datatype3[2] $nr $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[7]; ?>" size="10" name="ref2"/><br/>
<?php echo "$datatype3[2] $rev $ref"; ?>:<br/>
<input type="text" value="<?php echo $data[8]; ?>" size="5" name="revref2"/>
</td></tr>
<?php } ?>
</table><br/>

<input type="submit" value="<?php echo $update; ?>"/>
</form></map></font></center>

<?php } closedb(); } ?>

<?php
require("bottom.inc.php");
?>
Return current item: Electronic Design Automation - Index