Location: PHPKode > scripts > Linker IMG > linker-img/manage/edit_coment.php
<?php

//=====================================
// LINKER Category Engine
//=====================================
// Filename : edit_comment.php
// Path  : Manage directory
// last update : 2002/03/13
// Desc : Edit Comment
//=====================================

//=====================================
// File include part
//=====================================

include ("./authen.php");
include ("../function/$Sdb_type.php"); 
include ("../function/main_func.php"); 
include ("../$Slang/m_common.php"); 


if (!$update) errmsg($l_error1);
$db = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);

//=====================================
// Print comment edit form
//=====================================
 

if (!$switch) {

$db->query("select * from LINKER_COM where sid='$update'");
$row = $db->nrecord();

for ($i=1; $i<=10 ; $i++) {

	if ($i == $row[vote]) 
	$vote_op .= "<option selected>$i</option>\n";
	else 
	$vote_op .= "<option>$i</option>\n";

}

while(list($key , $val) = each ($row))
$row[$key] =  htmlspecialchars(stripslashes(trim($val)));



print <<<EOF

<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>

<body bgcolor="#E9E9E9">
 <form action='edit_coment.php' method='post'>
 <input type='hidden' name='switch' value='up'>
 <input type='hidden' name='update' value='$update'>

<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td colspan=2>

<table width="100%" border="1"><tr><td bgcolor="#000066" align="center">
<b><font color="white" size="2">$row[title] $l_com_info</font></b>
</td></tr></table>

</td>	</tr>

<tr><td colspan=2>&nbsp;</td>	</tr>

<tr>
<td bgcolor='#E0E0E0' colspan=2 height=24 align=center width=500>
<font size='2'>&nbsp; $l_com_head </font></td>
</tr>


<tr>
<td width='100' height='24' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_sid</font></td>
<td width='423' bgcolor='#FFFFFF' height='24'><font size='2'>&nbsp;$row[sid]</font></td>
</tr>

<tr>
<td width='100' height='24' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_name</font></td>
<td width='423' bgcolor='#FFFFFF' height='24'><font size='2'><input type="text" name="name" value="$row[name]"></font></td>
</tr>

<tr>
<td width='100' height='24' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_pass</font></td>
<td width='423' bgcolor='#FFFFFF' height='24'><font size='2'><input type="password" name="passwd" value="$row[passwd]"></font></td>
</tr>

<tr>
<td width='100' height='24' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_vote_score</font></td>
<td width='423' bgcolor='#FFFFFF' height='24'><font size='2'><select name="vote">$vote_op</select></font></td>
</tr>

<tr>
<td width='100' height='24' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_content</font></td>
<td width='423' bgcolor='#FFFFFF' height='24'><font size='2'><textarea cols =30 rows=3 name=content  style="width:350px">$row[content]</textarea></font></td>
</tr>

<tr><td colspan=2 bgcolor='#E0E0E0' align=center><font size='2'><input type='submit' value=' $l_edit ' class=cinput>&nbsp;
<input type='reset' value=' $l_reset ' class=cinput></font>
</td></tr>
</table>
</form>

EOF;
exit;
 }

//=====================================
// Edit part
//=====================================

while(list($key,$val) = each($HTTP_POST_VARS))
$$key = trim($val);

// sql query
$edit_sql="
update LINKER_COM set 
name='$name',
passwd='$passwd',
vote='$vote',
content='$content'
 where sid = '$update'
";

$db->query($edit_sql);




//=====================================
// Print Result
//=====================================


print <<<EOF

<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
<meta http-equiv='refresh' content='2; url=./view_coment.php?$switch=search&type=update'>
</head>

<body bgcolor="#E9E9E9">
<table width="500" border="1"><tr><td bgcolor="#000066" align="center">
<font color="white" size="2"><b>$update $l_comment_result</b></font>
</td></tr></table>

</body></html>

EOF;

?>
Return current item: Linker IMG