<?php
$f_button = "Add";
if(isset($update_status) && $update_status==1){
display_message("You must edit atleast one of the fields",1);
}
if(isset($db_error)){
display_message($db_error,2);
}
if(isset($doaction) && $doaction=='edit'){
$link = mysql_connect($db_server, $db_user, $db_pass)
or die("Could not connect to mysql server ".mysql_error());
mysql_select_db($ftpmonitor_db) or die("Could not select database");
//$selected_row = isset($_REQUEST['frows'])?$_REQUEST['frows']:0;
if(isset($_REQUEST['frows']) && is_array($_REQUEST['frows']) || isset($fid) && is_numeric($fid)){
$selected_row = isset($fid)? $fid : $_REQUEST['frows'][0];
$test_query = "SELECT COUNT(ftpid) as cnt from $ftpmonitor_tbl where ftpid='$selected_row'";
$rs = mysql_query($test_query) or die(mysql_error($link));
$test_response = mysql_fetch_assoc($rs);
if($test_response[cnt]==1){
display_message("Editing Server id = $selected_row",0);
mysql_free_result($rs);
$edit_query = "Select * from $ftpmonitor_tbl where ftpid=$selected_row";
$rs = mysql_query($edit_query) or die("Could not select server to be edited");
$get_row = mysql_fetch_assoc($rs);
$f_button = "Update";
//display_message($get_row);
}
}
}
?>
<form action=index.php method=post>
<input type=hidden value='<?php put($get_row[ftpid],$fid);?>' name='record_id'>
<table>
<tr>
<td class=header>Ftp Server Name</td>
<td ><input type=text name=fname value='<?php put($get_row[ftp_name],$fname);?>'> </td>
<td class=header>Ftp Server Url</td>
<td ><input type=text name=furl value='<?php put($get_row[ftp_url],$furl);?>'>:<input type=text size=3 name=fport value='<?php put($get_row[ftp_port],$fport);?>'></td>
</tr>
<tr>
<td class=header>Ftp UserName</td>
<td ><input type=text name=funame value='<?php put($get_row[ftp_username],$funame);?>'> </td>
<td class=header>Ftp Password</td>
<td ><input type=text name=fpass size=28 value='<?php put($get_row[ftp_password],$fpass);?>'></td>
</tr>
<tr>
<td class=header colspan=4>Ftp Comment</td>
</tr>
<tr>
<td colspan=4 align=center><textarea name=fcomment cols=64 rows=10><?php put($get_row[ftp_comment],$fcomment);?></textarea></td>
</tr>
<tr>
<td colspan=3>
<?php
if($f_button=="Add"){
echo("Add Another server <input type=radio value=1 name=direct>");
echo("View Updated Server List <input type=radio value=2 name=direct checked=true>");
}
?>
</td>
<td align=right>
<input type=button value=reset>
<input type=submit Value='<?php put($f_button);?>' name='ae_submit'></td>
</tr>
</table>
</form>