Location: PHPKode > projects > PHPDug > adm/feeds_edit.php
<?php
require_once("../includes/config.php");
require_once("../includes/functions/func.global.php");
require_once("../includes/functions/loggincheck.php");
require_once('../includes/lang/admin/lang_'.$config['lang'].'.php');
require_once("class.menu.php");

// Connect to database
db_connect($config);

if(isset($_POST['Submit']))
{
	foreach ($_POST['id'] as $value) 
	{
		$user_id = mysql_fetch_row(mysql_query("SELECT user_id FROM `".$config['db']['pre']."users` WHERE username='".addslashes($_POST['username'][$value])."' LIMIT 1"));
	
		mysql_query("UPDATE `".$config['db']['pre']."feeds` SET `feed_url` = '" . addslashes($_POST['url'][$value]) . "',`feed_cat` = '" . addslashes($_POST['cat'][$value]) . "',`feed_period` = '" . addslashes($_POST['period'][$value]) . "',`feed_user` = '" . addslashes($user_id[0]) . "' WHERE `feed_id` = '" . $value . "' LIMIT 1 ;");
	}
	
	header("Location: feeds_view.php");
	exit;
}

if(isset($_GET['id']))
{
	$_POST['list'][] = $_GET['id'];
}

$obj = new Menu();
$nav = $obj->get_js_menu(0,$config,$lang);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>PHPDug Admin - Edit RSS Feeds</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="images/style.css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/JSCookMenu.js"></SCRIPT>
<LINK REL="stylesheet" HREF="menu/themes/Office/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/themes/Office/theme.js"></SCRIPT>
<LINK REL="stylesheet" HREF="menu/themes/Office/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/themes/Office/theme.js"></SCRIPT>
<script language="JavaScript"><!--
function checkBox(theBox){
  var aBox = theBox.form["list[]"];
  var selAll = false;
  var i;
  for(i=0;i<aBox.length;i++){
    if(aBox[i].checked==false) selAll=true;
  }
  if(theBox.name=="selall"){
    for(i=0;i<aBox.length;i++){
      aBox[i].checked = selAll;
    }
    selAll = !selAll;
  }
  //theBox.form.selall.checked = selAll;
}
function init(){
  var theForm = document.f1;
  var aBox = theForm["list[]"];
  var selAll = false;
  var i;
  for(i=0;i<aBox.length;i++){
    if(aBox[i].checked==false) selAll=true;
    aBox[i].onclick = function(){checkBox(this)};
  }
  //theForm.selall.checked = selAll;
}
//--></script>
</head>
<body>
<!--Start top-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" height="42" align="left" background="images/bg_top.gif"><a href="index.php"><img src="images/logo.gif" width="127" height="37" hspace="10" border="0"></a></td>
  </tr>
  <tr>
    <td><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<!--End top-->
<!--Start topmenu-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#F0F0F0" height="25" style="padding-left:20px;" id="menu"><SCRIPT language="JavaScript" type="text/javascript">
			var myMenu =
				
			// Start the menu
[
<?php echo $nav; ?>
];				

			// Output the menu
			cmDraw ('menu', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice');
			</SCRIPT></td>
  </tr>
  <tr>
    <td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<br>

<!--End topmenu-->
<!--Start heading page-->
<table width="850" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td class="heading"><img src="images/icons/icon_editrule.gif" width="21" height="22" alt="" align="absmiddle" hspace="5">Edit RSS Feeds</td>
</tr>
<tr>
<td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
</tr>
</table>
<!--End heading page-->
<!--Start form-->
<br>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #CCCCCC;">
<tr>
<td align="center" bgcolor="#F6F6F6" style="padding:15px;">
  <form action="" method="post" name="f1" id="f1">
<?php
$count = 0;
$sql = "SELECT feed_id,feed_url,feed_cat,feed_period,feed_user FROM ".$config['db']['pre']."feeds ";

foreach ($_POST['list'] as $value) 
{
	IF($count == 0)
	{
		$sql.= "WHERE feed_id='" . $value . "'";
	}
	ELSE
	{
		$sql.= " OR feed_id='" . $value . "'";
	}
	
	$count++;
} 
$sql.= " LIMIT " . count($_POST['list']);


$query_result = mysql_query($sql);
while ($info = @mysql_fetch_array($query_result))
{
	$feed_username = mysql_fetch_row(mysql_query("SELECT username FROM `".$config['db']['pre']."users` WHERE user_id='".addslashes($info['feed_user'])."' LIMIT 1"));
?>
<table width="70%" cellpadding="0" cellspacing="2" border="0">
  <tr>
    <td width="35%"><strong>Feed ID</strong></td>
    <td>:
        <input name="id[<? echo $info['feed_id']; ?>]" type="Text" class="textbox" style="width:316px" value="<? echo $info['feed_id']; ?>" disabled>
        <input name="id[<? echo $info['feed_id']; ?>]" type="hidden" class="textbox" style="width:316px" value="<? echo $info['feed_id']; ?>"></td>
  </tr>
  <tr>
    <td width="35%"><strong>Feed URL</strong></td>
    <td>:
        <input name="url[<? echo $info['feed_id']; ?>]" type="Text" class="textbox" style="width:316px" value="<? echo $info['feed_url']; ?>"></td>
  </tr>
          <tr>
            <td width="25%"><strong>Feed Cat </strong></td>
            <td width="55%">:
                <select name="cat[<? echo $info['feed_id']; ?>]" class="textbox" style="width:316px">
                  <?php
$query2 = "SELECT cat_id,cat_title FROM ".$config['db']['pre']."cats ORDER BY cat_title ASC";
$query_result2 = mysql_query($query2);
while ($info2 = @mysql_fetch_array($query_result2))
{
?>
                  <option value="<?=$info2['cat_id'];?>" <? if($info['feed_cat'] == $info2['cat_id']){ echo 'selected'; } ?>><?=stripslashes($info2['cat_title']);?></option>
                  <?php
}
?>
                </select></td>
          </tr>
          <tr>
            <td width="25%"><strong>Feed Period</strong></td>
            <td width="55%">:
                <select name="period[<? echo $info['feed_id']; ?>]" class="textbox" style="width:316px">
				<option value="3600" <? if($info['feed_period'] == '3600'){ echo 'selected'; } ?>>1 Hour</option>
				 <option value="21600" <? if($info['feed_period'] == '21600'){ echo 'selected'; } ?>>6 Hours</option>
				 <option value="43200" <? if($info['feed_period'] == '43200'){ echo 'selected'; } ?>>12 Hours</option>
                  <option value="86400" <? if($info['feed_period'] == '86400'){ echo 'selected'; } ?>>24 Hours</option>
                </select></td>
          </tr>
          <tr>
            <td width="25%"><strong>Username (Valid User)</strong></td>
            <td width="55%">:
                <input name="username[<? echo $info['feed_id']; ?>]" type="text" class="textbox" id="username[<? echo $info['feed_id']; ?>]" style="width:316px" value="<?=$feed_username[0];?>"></td>
          </tr>
</table>
<br><br>
<?php
}
?>
<br>
<br>
<table width="70%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="35%">&nbsp;</td>
    <td>&nbsp;
      <input name="Submit" type="submit" class="button" value="<?php echo $lang['SUBMIT']; ?>">
&nbsp;
<input name="Reset" type="reset" class="button" value="<?php echo $lang['RESET']; ?>"></td>
  </tr>
</table>
<br>
  </form>
</td>
</tr>
</table>
<!--End form-->
<br><br>
<!--Start bottom-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td style="padding:15px;" align="center">
<span class="copyright">Copyright &copy; 2008 <a href="http://www.kubelabs.com/phpdug/" class="copyright" target="_blank">Kubelabs.com</a> All Rights Reserved.</span></td>
</tr>
</table>
<!--End bottom-->
</body>
</html>
Return current item: PHPDug