<?php
session_start();
include("./functions.php");
include("./header.php");

echo "<script type=\"text/javascript\">
function CSB(){
if (document.mform.all.checked){
xxx = true;
} else {
xxx = false;
}
for (i = 0; i < document.forms['mform'].length; i++) {
document.forms['mform'].elements[i].checked = xxx
}
}
</script>\n";

if($_REQUEST['submit'] == "Update") {
	if($_REQUEST['profile_name'] == ""){
		$_REQUEST['profile_name'] = "Unknown";
	}

	mysql_query("Update autoposter_meta_profiles SET profile_name='".$_REQUEST['profile_name']."', meta_keywords='".$_REQUEST['meta_keywords']."', meta_description='".$_REQUEST['meta_description']."', mt_keywords='".$_REQUEST['mt_keywords']."' where id='".$_REQUEST['id']."'");

	echo "<big><b>Profile Updated!</b></big><br /><br />";
}

//echo("<script src=\"pop.js\" type=\"text/javascript\" language=\"javascript\"></script><table width=\"100%\"><tr><td align=\"right\"><a href=\"javascript:OpenWin('pop_help/manage_wp_projects.html', 'help', 380, 400);\"><img src=\"images/q.gif\" width=\"16\" height=\"16\" border=0 hspace=\"4\"><small>Help</small></a>&nbsp;&nbsp;</td></tr></table><br>");

echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"5\" border=\"0\" bordercolor=\"#000000\" align=\"center\">";
echo "<tr><td colspan=\"2\" bgcolor=\"#C0C0C0\" align=\"center\"><font face=verdana, arial>Edit Meta Elements (Tags, Keywords & Description)</td></tr>";
echo "</table><br />";

$res = mysql_query("select * from autoposter_meta_profiles where id='".$_REQUEST['id']."'");
$id = mysql_result($res, 0, "id");
$profile_name = mysql_result($res, 0, "profile_name");
$metakeywords = mysql_result($res, 0, "meta_keywords");
$metadescription = mysql_result($res, 0, "meta_description");
$tags = mysql_result($res, 0, "mt_keywords");

echo '<table bgcolor="#c0c0c0" cellpadding="5" cellspacing="1" border=0 align=center>
<form NAME=mform action="edit_meta.php" method="post"><input name="id" type="hidden" value="'.$id.'"><font face=verdana, arial>

<tr><td bgcolor="#eeeeee">Profile Name:</td><td bgcolor="#eeeeee"><input name="profile_name" type="text" value="'.$profile_name.'"></td></tr>
<tr><td bgcolor="#eeeeee">Meta Keywords (separate with commas):</td><td bgcolor="#eeeeee"><input name="meta_keywords" type="text" size="75" value="'.$metakeywords.'"></td></tr>
<tr><td bgcolor="#eeeeee">Meta Description:</td><td bgcolor="#eeeeee"><textarea name="meta_description" rows="2" cols="75" wrap="on" class="mceNoEditor">'.$metadescription.'</textarea></td></tr>
<tr><td bgcolor="#eeeeee">Tags<br>(separate with commas, must use space after comma)<br />i.e tag1, tag2:</td><td bgcolor="#eeeeee"><input name="mt_keywords" type="text" size="75" value="'.$tags.'"></td></tr>
<tr><td bgcolor="#eeeeee">&nbsp;</td><td bgcolor="#eeeeee"><input type="submit" name="submit" value="Update"></td></tr>
</form></table>
<br />
<br />
<a href="manage_meta.php">Go Back</a>
';

include("./footer.php");
?>