<?php require('../license_top.php'); ?>
<?php require_once('../application_top.php'); ?>
<?php require_once('../check_login.php'); ?>
<?php
$Name = "";
$tablename = "";
$error = "";
$mode = "";
$recordID = (isset($_REQUEST['recordID']) && is_numeric($_REQUEST['recordID'])) ? $_REQUEST['recordID'] : 0;
$mode= (isset($_REQUEST['mode']) && $_REQUEST['mode']=="edit" ) ? $_REQUEST['mode'] : "";
$gid = (isset($_REQUEST['gid']) && is_numeric($_REQUEST['gid'])) ? $_REQUEST['gid'] : 0;
$query= tep_db_query("select * from t_user where iUserID = '$recordID'");
while($row=tep_db_fetch_array($query))
{
$vcUserName = tep_parse_output_data($row["vcUserName"]);
$vcPassword = tep_parse_output_data($row["vcPassword"]);
$dDateFirstLogin = tep_parse_output_data($row["dDateFirstLogin"]);
$dDateLastLogin = tep_parse_output_data($row["dDateLastLogin"]);
}
$query= tep_db_query("select t_solisentity.Name,t_company.SolisID from t_company,t_solisentity where t_company.AccountNumber = '$recordID' and t_solisentity.EntityID=t_company.EntityID");
while($row=tep_db_fetch_array($query))
{
$Name = tep_parse_output_data($row["Name"]);
}
if(isset($_POST['Submit'])) {
$count=count($_POST);
$tablename = strtolower(tep_parse_input_data($_POST['tablename']));
$table = strtolower(tep_parse_input_data($_POST['table']));
$recordID = tep_parse_input_data($_POST['recordID']);
$gid = tep_parse_input_data($_POST['gid']);
$query = "SELECT * FROM " . $table."";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
foreach ($row as $key => $val) {
if (in_array($key, array('ID', 'HID', 'ID_Reader_Number', 'AccountNumber'))) {
$keyvalue=$key;
}
}
}
for($i=0;$i<$count;$i++){
$query2= tep_db_query("select FieldName,FieldDataType from t_soliscustomfield where GroupID='$gid' order by DisplayOrder");
while($row=tep_db_fetch_array($query2))
{
$FieldName = tep_parse_output_data($row['FieldName']);
$FieldDataType = tep_parse_output_data($row['FieldDataType']);
if($FieldDataType==3)
{
if(isset($_POST[$FieldName]))
{
$fieldname_new = "true";
}
else
{
$fieldname_new = "false";
}
}
else
{
$fieldname_new = tep_parse_input_data($_POST[$FieldName]);
}
$query1=tep_db_query("select * from ".$table." where " . $keyvalue . " ='{$recordID}'");
if(tep_db_num_rows($query1)>=1) {
$query2 = tep_db_query("SELECT * FROM " . $table ."");
while ($row2 = tep_db_fetch_assoc($query2)) {
foreach ($row2 as $key => $val) {
if($key==$FieldName) {
$sql1="UPDATE ".$table." SET ".$FieldName." = '$fieldname_new' where " . $keyvalue . " ='$recordID'";
}
}
}
}
else
{
$sql1="INSERT INTO ".$table." SET " . $keyvalue ." ='$recordID'";
}
$query=tep_db_query($sql1);
}
}
}
?>
<!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>Updating</title>
<link rel="stylesheet" type="text/css" href="../css/theme.css" />
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<script src="../js/jquery.js" type="text/javascript"></script>
<script src="../js/jquery.cookie.js" type="text/javascript"></script>
<script src="../js/jquery.validate.js" type="text/javascript"></script>
<script src="../js/additional-methods.js" type="text/javascript"></script>
<script src="../js/jquery.dimensions.js" type="text/javascript"></script>
<script src="../js/jquery.dateinput.js" type="text/javascript"></script>
<script src="../js/functions.js" type="text/javascript"></script>
<script src="../js/ajax-waiting.js" type="text/javascript"></script>
<script src="../js/swfobject.js" type="text/javascript"></script>
<script>
var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
document.writeln('<link rel="stylesheet" type="text/css" href="../css/' + StyleFile + '">');
</script>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
<![endif]-->
</head>
<body>
<div id="container">
<div id="header">
<a href="home.php" class="logo"><img src="../images/atp-logo.jpg"/></a>
<div id="topmenu">
<ul>
<li><a href="../home.php">Home</a></li>
<li><a href="../usergroup.php">Manage Users</a></li>
<li class="current"><a href="search.php">Database Search</a></li>
<li><a href="../databasesetup/setup.php">Database Configuration</a></li>
<li><a href="../logout.php">Logout</a></li>
</ul>
</div>
</div>
<div id="top-panel">
<div id="panel">
<ul>
<li><a href="AddRecord.php" class="useradd">New Database Record</a></li>
</ul>
</div>
</div>
<div id="wrapper">
<div id="content">
<div id="box">
<h3>Group Information</h3>
<table width="100%">
<tbody>
<tr>
<td><font class="label">Account Number:</font> <? echo $recordID;?></td>
<td><font class="label">Entity type:</font> <? echo $Name;?></td>
</tr>
<tr>
<td><font class="label">Last updated on:</font> <? echo $dDateLastLogin;?></td>
<td><font class="label">Last updated by:</font> Username</td>
</tr>
<tr>
<td><font class="label">Username:</font> <? echo $vcUserName;?></td>
<td><font class="label">Password:</font> <? echo $vcPassword; ?></td>
</tr>
</tbody>
</table>
<? if(isset($_REQUEST['gid'])) {
$query= tep_db_query("select GroupName,GroupID from t_soliscustomfieldgroup where GroupID='$gid'");
while($row=tep_db_fetch_array($query))
{
$GroupName = tep_parse_output_data($row["GroupName"]);
$tablename1 = strtolower(str_replace(" ", "", $row["GroupName"]));
$tablename = "t_cf_".$tablename1;
}
$query= tep_db_query("select FieldName,FieldLabel,FieldID,FieldDataType from t_soliscustomfield where GroupID='$gid' order by DisplayOrder"); ?>
<form method="post" name="form" id="form" action="">
<input type="hidden" name="recordID" value="<?php echo $recordID; ?>" />
<input type="hidden" name="gid" value="<?php echo $gid; ?>" />
<input type="hidden" name="tablename" value="<?php echo $tablename; ?>" />
<input type="hidden" name="table" value="<?php echo $Name; ?>" />
<p class="notice-board"><?php echo $error; ?></p>
<fieldset id="personal">
<legend><?php echo $GroupName; ?></legend>
<?
while($row=tep_db_fetch_array($query))
{
$FieldName = tep_parse_output_data($row["FieldName"]);
$FieldLabel = tep_parse_output_data($row["FieldLabel"]);
$FieldID = tep_parse_output_data($row["FieldID"]);
$FieldDataType = tep_parse_output_data($row["FieldDataType"]);
include "../fieldvalue.php";
?>
<label for="<?php echo $FieldName; ?>"><?php echo $FieldLabel; ?>: </label>
<? if($TextType=="textarea") { ?>
<textarea name="<?php echo $FieldName; ?>" id="<?php echo $FieldName; ?>"></textarea>
<? } else if ($TextType=="valuelist") {?>
<select name="<?php echo $FieldName; ?>" id="<?php echo $FieldName; ?>">
<?
$query1= tep_db_query("select * from t_solisentity order by Name");
while($row=tep_db_fetch_array($query1))
{
$Name = $row["Name"];
$EntityID = $row["EntityID"]; ?>
<option value="<?php echo $EntityID; ?>"><?php echo $Name; ?></option>
<? } ?>
</select>
<? } else {?>
<input name="<?php echo $FieldName; ?>" id="<?php echo $FieldName; ?>" type="<?php echo $TextType; ?>" tabindex="1"/>
<? } ?>
<br />
<? } ?>
</fieldset>
<div align="center">
<input type="submit" id="button1" name="Submit" value="<?php echo ($mode=="edit") ? "Save" : "Add" ?>"/>
<input id="button2" type="reset" />
</div>
</form>
<? } ?>
</div>
</div>
<div id="sidebar">
<ul>
<li><h3><a href="#" class="folder_table">Record Links</a></h3>
<ul>
<li><a href="ViewRecord.php?recordID=<? echo $recordID; ?>" class="report">Record Detail</a></li>
<li><a href="#" class="report_seo">Related Records</a></li>
<li><a href="#" class="search">Categories</a></li>
</ul>
</li>
<!--li><h3><a href="#" class="manage">Other Links</a></h3>
<ul>
<li><a href="#" class="addorder">Back to results</a></li>
<li><a href="#" class="shipping">Print Friendly</a></li>
<li><a href="#" class="invoices">Delete Account </a></li>
</ul>
</li-->
</ul>
</div>
</div>
<div id="footer">
<div id="credits">Solis ATP v1.0 by <a href="http://www.e-fuzion.com" target="_blank">e-Fuzion</a></div>
<div id="styleswitcher">
<ul>
<li><a href="javascript: document.cookie='theme='; window.location.reload();" title="Default" id="defswitch">d</a></li>
<li><a href="javascript: document.cookie='theme=1'; window.location.reload();" title="Blue" id="blueswitch">b</a></li>
<li><a href="javascript: document.cookie='theme=2'; window.location.reload();" title="Green" id="greenswitch">g</a></li>
<li><a href="javascript: document.cookie='theme=3'; window.location.reload();" title="Brown" id="brownswitch">b</a></li>
<li><a href="javascript: document.cookie='theme=4'; window.location.reload();" title="Mix" id="mixswitch">m</a></li>
</ul>
</div><br />
</div>
</div>
</body>
</html>
<?php require('../license_bottom.php'); ?>
Bookmarks