<?php
include('header.php');
if($xg10 != 1){
echo $h;
echo $LANGAUGE_CP[626];
echo $f;
exit;
}
echo $h;

$flashnumber = 5;

$action = $_GET['action'];
if(!isset($action)) $action = "add";

IF ($action=="add"){
?>
<form name="vbform" method="post" action="flash_cp.php?action=insert" enctype="multipart/form-data">

<table class='xtable' width="100%" id="AutoNumber1">
     <tr>
      <td width="100%" colspan="2" class='xtt' align="center"><?php echo $LANGAUGE_CP[261]; ?></td>
    </tr>
    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[156]; ?></td>
      <td width="80%" class='xtd'><input size="70" name="name_cat" /></td>
    </tr>
<!--
    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[88]; ?></td>
      <td width="80%" class='xtd'><input dir="ltr" size="30" name="im" /> <?php echo $LANGAUGE_CP[89]; ?><br />
<input dir="ltr" size="30" name="image" type="file" /> <?php echo $LANGAUGE_CP[90]; ?></td>
    </tr>
    -->
    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[91]; ?></td>
      <td width="80%" class='xtd'><textarea name="keywords" rows="3" cols="70"></textarea></td>
    </tr>
    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[92]; ?></td>
      <td width="80%" class='xtd'><textarea name="description" rows="3" cols="70"></textarea></td>
    </tr>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[94]; ?></td>
      <td width="80%" class='xtd'><input size="10" name="order_cat" /></td>
    </tr>

<tr>
<td width='20%' class='xtr'><?php echo $LANGAUGE_CP[95]; ?></td>
<td width='80%' class='xtd'>
<select  size='1' name='sub'>
<OPTION value='0' selected="selected"><?php echo $LANGAUGE_CP[96]; ?></OPTION>
<?php
$sql = mysql_query ("SELECT * FROM  flash_cat where sub=0");
while($cat=mysql_fetch_array($sql))
{
echo "<OPTION value='".$cat['id']."'>".$cat['name_cat']."</OPTION>";
}
?>
</select>
</td>
</tr>

     <tr>
      <td width="100%" colspan="2" class='xtr' align="center">
<input type="submit" value=" <?php echo $LANGAUGE_CP[18]; ?> " name="cmdAdd" /></td>
    </tr>
  </table>

</form>
<?php

$queryx = mysql_query("SELECT * FROM flash_cat order by id desc");
$xx = mysql_num_rows($queryx);
if($xx == 0){
echo "";
}else{

echo "<table class='xtable' width='100%' id='AutoNum4ber15'>
  <tr>
<td width='100%' colspan='4' class='xtx' align='center'>".$LANGAUGE_CP[97]."</td>
</tr>
  <tr>
      <td width='79%' align='center' class='xtr'>".$LANGAUGE_CP[158]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[28]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[26]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[27]."</td>
    </tr>";
while($p = mysql_fetch_array($queryx))
{
$p['name_cat'] = stripslashes($p['name_cat']);
$p['name_cat'] = htmlspecialchars($p['name_cat']);

if($p['active'] == 1){
$im = "images/on.gif";
$li = "flash_cp.php?action=actxcat&id=$p[id]&act=0";
$te = $LANGAUGE_CP[72];
}else{
$im = "images/off.gif";
$li = "flash_cp.php?action=actxcat&id=$p[id]&act=1";
$te = $LANGAUGE_CP[73];
}

echo "<tr>
      <td width='79%' class='xtd'>» ".$p['name_cat']."</td>
      <td width='7%' align='center' class='xtd'><a href='$li'><img border='0' src='$im' alt='$te ".$p['name_cat']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='flash_cp.php?action=edit&id=$p[id]'><img border='0' src='images/edit.gif' alt='".$p['name_cat']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='flash_cp.php?action=delete&id=$p[id]'><img border='0' src='images/delete.gif' alt='".$p['name_cat']."' /></a></td>
    </tr>";
}
echo "</table>";
}

}ELSEIF ($action=="insert"){

$title = addslashes($_POST['name_cat']);
$title = trim($title);

$order_cat = $_POST['order_cat'];
$sub = $_POST['sub'];

$keywords = addslashes($_POST['keywords']);
$keywords = trim($keywords);

$description = addslashes($_POST['description']);
$description = trim($description);

if($description==""){
$xm1 = $title;
}else{
$xm1 = $description;
}

if($keywords==""){
$m2x = str_replace(" ",",",$title);
$xm2 = $m2x;
}else{
$xm2 = $keywords;
}

$im = addslashes($_POST['im']);
if($im==""){
$ima = uploadfile("image","upload","../upload/");
}else{
$ima = $im;
}

if (empty($title)){
echo $LANGAUGE_CP[159];
}else{
$query =  mysql_query ("INSERT INTO flash_cat (name_cat,order_cat,sub,description,keywords,active,image) VALUES ('$title','$order_cat','$sub','$xm1','$xm2','1','".$ima."')") or die ("error");
print $LANGAUGE_CP[21];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=flash_cp.php?action=add' />";
}


}ELSEIF ($action=="edit"){
$id = intval($_GET['id']);
$query = mysql_query("SELECT * FROM flash_cat where id='$id'");
$p = mysql_fetch_array($query);

$p['name_cat'] = stripslashes($p['name_cat']);
$p['name_cat'] = htmlspecialchars($p['name_cat']);

$p['keywords'] = stripslashes($p['keywords']);
$p['keywords'] = htmlspecialchars($p['keywords']);

$p['description'] = stripslashes($p['description']);
$p['description'] = htmlspecialchars($p['description']);

$p['image'] = stripslashes($p['image']);
$p['image'] = htmlspecialchars($p['image']);

echo "<form name='vbform' method='POST' action='flash_cp.php?action=editok'>
<input type='hidden' name='id' value='$p[id]' />

<table class='xtable' width='100%' id='AutoNumbe4r15'>

<tr>
<td width='100%' colspan='2' class='xtx' align='center'>".$LANGAUGE_CP[32]."</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[156]."</td>
<td width='80%' class='xtd'><input name='name_cat' size='70' value='".$p['name_cat']."' /></td>
</tr>
<!--
<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[88]."</td>
<td width='80%' class='xtd'><input dir='ltr' name='image' size='70' value='".$p['image']."' /></td>
</tr>
-->
<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[91]."</td>
<td width='80%' class='xtd'><textarea name='keywords' rows='3' cols='70'>".$p['keywords']."</textarea>
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[92]."</td>
<td width='80%' class='xtd'><textarea name='description' rows='3' cols='70'>".$p['description']."</textarea>
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[94]."</td>
<td width='80%' class='xtd'><input name='order_cat' size='10' value='".$p['order_cat']."' /></td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[95]."</td>
<td width='80%' class='xtd'>
<select size='1' name='cat'>";
echo "<option value='0'>".$LANGAUGE_CP[96]."</option>";
$sql = mysql_query ("SELECT * FROM flash_cat where sub=0 AND id != '$id'") or die ("error");
while($sub = mysql_fetch_array($sql))
{
if($sub['id'] ==  $p['sub']){
echo "<option value='$sub[id]' selected='selected'>$sub[name_cat]</option>";
}else{
echo "<option value='$sub[id]'>$sub[name_cat]</option>";
}

}
echo "</select>
</td>
</tr>

<tr>
<td width='100%' colspan='2' align='center' class='xtr'><input type='submit' value=' ".$LANGAUGE_CP[33]." ' name='B1' /></td>
</tr>

</table>
</form>";

}ELSEIF ($action=="editok"){

$id    = intval($_POST['id']);
$title = addslashes($_POST['name_cat']);
$title = trim($title);

$order_cat = intval($_POST['order_cat']);
$cat = intval($_POST['cat']);

$image = addslashes($_POST['image']);

$keywords = addslashes($_POST['keywords']);
$keywords = trim($keywords);

$description = addslashes($_POST['description']);
$description = trim($description);

if($description==""){
$xm1 = $title;
}else{
$xm1 = $description;
}

if($keywords==""){
$m2x = str_replace(" ",",",$title);
$xm2 = $m2x;
}else{
$xm2 = $keywords;
}

if (empty($title)){
echo $LANGAUGE_CP[159];
}else{
$query =  mysql_query("UPDATE flash_cat SET name_cat='$title',order_cat='$order_cat',sub='$cat', description='$xm1', keywords='$xm2',image='$image' where id='$id'");
echo $LANGAUGE_CP[34];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=add' />";
}

}ELSEIF ($action=="delete"){
$id = intval($_GET['id']);
$query =  mysql_query("DELETE FROM flash_cat WHERE id='$id'");
echo $LANGAUGE_CP[35];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=add' />";

}ELSEIF ($action=="actxcat"){
$id = intval($_GET['id']);
$act = intval($_GET['act']);
if ($act == 0){
$query =  mysql_query("UPDATE flash_cat SET active='$act' where id='$id'");
echo $LANGAUGE_CP[61];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=add' />";
}ELSEif ($act == 1){
$query =  mysql_query("UPDATE flash_cat SET active='$act' where id='$id'");
echo $LANGAUGE_CP[62];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=add' />";
}else{
echo $LANGAUGE_CP[63];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=add' />";
}

}ELSEIF ($action=="addt"){
if(isset($_GET['num']) AND $_GET['num'] != 0){
$number = intval($_GET['num']);
$xcatss = intval($_GET['xcat']);
}else{
$number = 1;
}
?>
<table class='xtable' width='100%' id='AutoNumber15'>
     <tr>
      <td width="100%" colspan="2" class='xtx' align="center"><?php echo $LANGAUGE_CP[262]; ?></td>
    </tr>

     <tr>
      <td width="100%" colspan="2" class='xtr' align="center">
<form name="vbform" method="GET" action="">
<input name="action" type="hidden" value="addt" />
<div align="center"><?php echo $LANGAUGE_CP[101]; ?> <input name="num" type="text" size="10" value="<?php echo $number; ?>" /> <?php echo $LANGAUGE_CP[237]; ?> <select size="1" name="xcat">
<?php
$query = mysql_query("SELECT * FROM flash_cat order by id desc");
while($cat = mysql_fetch_array($query))
{
if(isset($_GET['xcat']) AND $_GET['xcat'] == $cat['id']){
echo "<OPTION value='".$cat['id']."' selected='selected'>".$cat['name_cat']."</OPTION>";
}else{
echo "<OPTION value='".$cat['id']."'>".$cat['name_cat']."</OPTION>";
}

}
?>
</select> <input type="submit" value=" <?php echo $LANGAUGE_CP[18]; ?> " class='addsubmit' /></div>
</form>
      </td>
    </tr>



<form name="vbform" method="post" action="flash_cp.php?action=insertt">
<?php
$ii = 0;
for($i=0;$i<$number;$i++){
$ii++;
?>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[263]; ?></td>
      <td width="80%" class='xtd'><input size="80" name="name_flash[]" /></td>
    </tr>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[264]; ?></td>
      <td width="80%" class='xtd'><input size="80" name="desin_flash[]" /></td>
    </tr>

     <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[92]; ?></td>
      <td width="80%" class='xtd'><textarea name="metadescription[]" rows="3" cols="80"></textarea></td>
    </tr>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[91]; ?></td>
      <td width="80%" class='xtd'><textarea name="metakeywords[]" rows='3' cols='80'></textarea></td>
    </tr>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[265]; ?></td>
      <td width="80%" class='xtd'><input dir="ltr" size="80" name='url_flash[]' /></td>
    </tr>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[266]; ?></td>
      <td width="80%" class='xtd'><input dir="ltr" size="80" name='download_flash[]' /></td>
    </tr>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[267]; ?></td>
      <td width="80%" class='xtd'><?php echo $LANGAUGE_CP[268]; ?> <input size='5'  name='w_flash[]' /> <?php echo $LANGAUGE_CP[269]; ?> <input size='5'  name='h_flash[]' /> <?php echo $LANGAUGE_CP[270]; ?> <select size='1' name='autosize[]'>
<option value='1' selected='selected'><?php echo $LANGAUGE_CP[271]; ?></option>
<option value='0'><?php echo $LANGAUGE_CP[272]; ?></option>
</select></td>
    </tr>

    <tr>
      <td width="20%" class='xtr'><?php echo $LANGAUGE_CP[95]; ?></td>
      <td width="80%" class='xtd'>
<select size="1" name="cat[]">
<?php
$query = mysql_query("SELECT * FROM flash_cat order by id desc");
while($cat = mysql_fetch_array($query))
{
if(isset($_GET['xcat']) AND $_GET['xcat'] == $cat['id']){
echo "<OPTION value='".$cat['id']."' selected='selected'>".$cat['name_cat']."</OPTION>";
}else{
echo "<OPTION value='".$cat['id']."'>".$cat['name_cat']."</OPTION>";
}

}
?>
</select>
      </td>
    </tr>

<?php
if($ii != $number){
echo '<tr>
<td width="100%" colspan="2" class="xtr" align="center">- - - - - - - -</td>
</tr>';
}

}
?>

     <tr>
      <td width="100%" colspan="2" class='xtr' align="center"><input type="submit" value=" <?php echo $LANGAUGE_CP[18]; ?> " name="cmdAdd" /></td>
    </tr>
  </table>

</form>

<?php
if($_GET["s"] == 1){
$hh = "checked='checked'";
}elseif($_GET["s"] == 0){
$hh = "";
}else{
$hh = "";
}

$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
$page = ($page == 0 ? 1 : $page);
$perpage = 20;
$startpoint = ($page * $perpage) - $perpage;

$queryx = mysql_query("SELECT * FROM flash order by id desc LIMIT $startpoint,$perpage");
$xx = mysql_num_rows($queryx);
if($xx == 0){
echo "";
}else{

$i = 0;
echo "<form name='xxx' action='flash_cp.php?action=op' method='post'>
<div id='flash'>
<table class='xtable' width='100%' id='AutoNumber415'>
<tr>
<td width='100%' colspan='7' class='xtt' align='center'>".$LANGAUGE_CP[97]."</td>
</tr>
<tr>
      <td width='2%' align='center' class='xtr'>#</td>
      <td width='40%' align='center' class='xtr'>".$LANGAUGE_CP[105]."</td>
      <td width='30%' align='center' class='xtr'>".$LANGAUGE_CP[237]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[106]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[28]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[26]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[27]."</td>
    </tr>";
while($p = mysql_fetch_array($queryx))
{
$i++;
$p['name_flash'] = stripslashes($p['name_flash']);
$p['name_flash'] = htmlspecialchars($p['name_flash']);

$d = date("j/n/Y",$p['date']);

$queryxc = mysql_query("SELECT * FROM flash_cat where id='".$p['cat']."'");
$pc = mysql_fetch_array($queryxc);
$pc['name_cat'] = stripslashes($pc['name_cat']);
$pc['name_cat'] = htmlspecialchars($pc['name_cat']);

if($p['active'] == 1){
$im = "images/on.gif";
$li = "flash_cp.php?action=actx&id=$p[id]&act=0";
$te = $LANGAUGE_CP[72];
}else{
$im = "images/off.gif";
$li = "flash_cp.php?action=actx&id=$p[id]&act=1";
$te = $LANGAUGE_CP[73];
}

$s = "<div align='left'>".$LANGAUGE_CP[237]." : ".$pc['name_cat']." - ".$LANGAUGE_CP[106]." : [".$p['vis']."] - ".$LANGAUGE_CP[57]." : $d</div>";

echo "<tr>
      <td align='center' width='2%' class='xtd'><input id='sound".$p['id']."' ".$hh." type='checkbox' name='del[$i]' value='".$p['id']."' /></td>
      <td width='40%' class='xtd'><label for='sound".$p['id']."'>» ".$p['name_flash']."</label></td>
      <td width='30%' class='xtd' align='center'>".$pc['name_cat']."</td>
      <td width='7%' class='xtd' align='center'>".$p['vis']."</td>
      <td width='7%' align='center' class='xtd'><a href='$li'><img border='0' src='$im' alt='$te ".$p['name_flash']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='flash_cp.php?action=editt&id=$p[id]'><img border='0' src='images/edit.gif' alt='".$p['name_flash']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='flash_cp.php?action=deletet&id=$p[id]'><img border='0' src='images/delete.gif' alt='".$p['name_flash']."' /></a></td>
    </tr>";
}
echo "<tr>
<td colspan='7' align='center' class='xtr'><input name='activ' class='addsubmit' type='submit' value=' ".$LANGAUGE_CP[108]." ' /> <input class='addsubmit' name='noact' type='submit' value=' ".$LANGAUGE_CP[107]." ' /> <input class='addsubmit' name='edit' type='submit' value=' ".$LANGAUGE_CP[26]." ' /> <input name='delete' class='addsubmit' type='submit' id='delete' value=' ".$LANGAUGE_CP[27]." ' /><br />
<a href='flash_cp.php?action=addt&s=1&page=$page#flash'>".$LANGAUGE_CP[109]."</a> - <a href='flash_cp.php?action=addt&s=0&page=$page#flash'>".$LANGAUGE_CP[110]."</a></td>
</tr>
</table></div></form>";

$pagesnum = @ceil(mysql_num_rows(mysql_query("SELECT id FROM flash")) / $perpage);
if($pagesnum > 1){
echo "<p align='center'>";
for ($i=1; $i<=$pagesnum; $i++) {
if ($i != $page) {
$z = "[<a href='flash_cp.php?action=addt&page=$i#flash'>$i</a>] ";
} else {
$z = "[<u>$i</u>]";
}
echo "$z";
}
echo "</p>";
}
}
}ELSEIF ($action=="insertt"){

$number = count($_POST['name_flash']);

for($i=0;$i<$number;$i++){
$title = $_POST['name_flash'][$i];
$title = addslashes($title);
$title = trim($title);

$metadescription = $_POST['metadescription'][$i];
$metadescription = addslashes($metadescription);
$metadescription = trim($metadescription);

$metakeywords = $_POST['metakeywords'][$i];
$metakeywords = addslashes($metakeywords);
$metakeywords = trim($metakeywords);

if($metadescription == ""){
$xx1 = $title;
}else{
$xx1 = $metadescription;
}

if($metakeywords == ""){
$m2x = str_replace(" ",",",$title);
$xx2 = $m2x;
}else{
$xx2 = $metakeywords;
}

$desin_flash = addslashes($_POST['desin_flash'][$i]);
$desin_flash = trim($desin_flash);

$url_flash = addslashes($_POST['url_flash'][$i]);
$url_flash = trim($url_flash);

$download_flash = addslashes($_POST['download_flash'][$i]);
$download_flash = trim($download_flash);

$cat = $_POST['cat'][$i];

$w_flash = $_POST['w_flash'][$i];
$h_flash = $_POST['h_flash'][$i];
$autosize = $_POST['autosize'][$i];

$d = time();

if(!empty($title) OR !empty($url_flash)){
$query =  mysql_query ("INSERT INTO flash (name_flash,metadescription,metakeywords,active,cat,date,desin_flash,url_flash,download_flash,w_flash,h_flash,autosize) VALUES ('$title','$xx1','$xx2','1','$cat','".time()."','$desin_flash','$url_flash','$download_flash','$w_flash','$h_flash','$autosize')") or die ("error");
echo "<p>$title ....... ".$LANGAUGE_CP[111]."</p>";
}
}

echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=flash_cp.php?action=addt#flash' />";

}ELSEIF ($action=="actx"){
$id = intval($_GET['id']);
$act = intval($_GET['act']);
if ($act == 0){
$query =  mysql_query("UPDATE flash SET active='$act' where id='$id'");
echo $LANGAUGE_CP[61];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=addt#flash' />";
}elseif($act == 1){
$query =  mysql_query("UPDATE flash SET active='$act' where id='$id'");
echo $LANGAUGE_CP[62];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=addt#flash' />";
}else{
echo $LANGAUGE_CP[63];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=addt#flash' />";
}

}ELSEIF ($action=="editt"){
$id = intval($_GET['id']);
$query = mysql_query("SELECT * FROM flash where id='$id'");
$p = mysql_fetch_array($query);

$p['name_flash'] = stripslashes($p['name_flash']);
$p['name_flash'] = htmlspecialchars($p['name_flash']);

$p['url_flash'] = stripslashes($p['url_flash']);
$p['url_flash'] = htmlspecialchars($p['url_flash']);

$p['metadescription'] = stripslashes($p['metadescription']);
$p['metadescription'] = htmlspecialchars($p['metadescription']);

$p['metakeywords'] = stripslashes($p['metakeywords']);
$p['metakeywords'] = htmlspecialchars($p['metakeywords']);

$p['desin_flash'] = stripslashes($p['desin_flash']);
$p['desin_flash'] = htmlspecialchars($p['desin_flash']);

$p['download_flash'] = stripslashes($p['download_flash']);
$p['download_flash'] = htmlspecialchars($p['download_flash']);

echo "<form name='vbform' method='POST' action='flash_cp.php?action=edittok'>
<input type='hidden' name='id' value='$p[id]' />

<table class='xtable' width='100%' id='AutoNumber15'>

<tr>
<td width='100%' colspan='2' class='xtx' align='center'>".$LANGAUGE_CP[32]."</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[263]."</td>
<td width='80%' class='xtd'><input name='name_flash' size='80' value='".$p['name_flash']."' /></td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[264]."</td>
<td width='80%' class='xtd'><input name='desin_flash' size='80' value='".$p['desin_flash']."' /></td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[92]."</td>
<td width='80%' class='xtd'><textarea name='metadescription' rows='3' cols='80'>".$p['metadescription']."</textarea>
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[91]."</td>
<td width='80%' class='xtd'><textarea name='metakeywords' rows='3' cols='80'>".$p['metakeywords']."</textarea>
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[265]."</td>
<td width='80%' class='xtd'><input dir='ltr' name='url_flash' size='80' value='".$p['url_flash']."' /></td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[266]."</td>
<td width='80%' class='xtd'><input dir='ltr' name='download_flash' size='80' value='".$p['download_flash']."' /></td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[267]."</td>
<td width='80%' class='xtd'>".$LANGAUGE_CP[268]." <input name='w_flash' size='5' value='".$p['w_flash']."' /> ".$LANGAUGE_CP[269]." <input name='h_flash' size='5' value='".$p['h_flash']."' /> ".$LANGAUGE_CP[270]." ";

if($p['autosize']==1){
echo "<select size='1' name='autosize'>
  <option value='1' selected='selected'>".$LANGAUGE_CP[271]."</option>
  <option value='0'>".$LANGAUGE_CP[272]."</option>
</select>";
}else{
echo "<select size='1' name='autosize'>
  <option value='1'>".$LANGAUGE_CP[271]."</option>
  <option value='0' selected='selected'>".$LANGAUGE_CP[272]."</option>
</select>";
}


echo "</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[95]."</td>
<td width='80%' class='xtd'>
<select size='1' name='cat'>";

$sql = mysql_query ("SELECT * FROM flash_cat order by id") or die ("error");
while($sub = mysql_fetch_array($sql))
{
if($sub['id'] ==  $p['cat']){
echo "<option value='$sub[id]' selected='selected'>$sub[name_cat]</option>";
}else{
echo "<option value='$sub[id]'>$sub[name_cat]</option>";
}

}
echo "</select>
</td>
</tr>

<tr>
<td width='100%' colspan='2' align='center' class='xtr'><input type='submit' value=' ".$LANGAUGE_CP[33]." ' name='B1' /></td>
</tr>

</table>
</form>";

}ELSEIF ($action=="edittok"){

$id    = intval($_POST['id']);
$name_flash     = addslashes($_POST['name_flash']);
$desin_flash    = addslashes($_POST['desin_flash']);
$url_flash      = addslashes($_POST['url_flash']);
$download_flash = addslashes($_POST['download_flash']);
$w_flash        = addslashes($_POST['w_flash']);
$h_flash        = addslashes($_POST['h_flash']);
$cat            = $_POST['cat'];
$autosize = $_POST['autosize'];

$metadescription = addslashes($_POST['metadescription']);
$metadescription = trim($metadescription);

$metakeywords = addslashes($_POST['metakeywords']);
$metakeywords = trim($metakeywords);

if($metadescription==""){
$xm1 = $name_flash;
}else{
$xm1 = $metadescription;
}

if($metakeywords==""){
$m2x = str_replace(" ",",",$name_flash);
$xm2 = $m2x;
}else{
$xm2 = $metakeywords;
}

if (empty($name_flash)){
echo $LANGAUGE_CP[273];
}elseif (empty($url_flash)){
echo $LANGAUGE_CP[274];
}else{
$query =  mysql_query("UPDATE flash SET name_flash='$name_flash', desin_flash='$desin_flash', url_flash='$url_flash', download_flash='$download_flash', cat='$cat', w_flash='$w_flash', h_flash='$h_flash', autosize='$autosize', metadescription='$xm1',metakeywords='$xm2' where id='$id'");
echo $LANGAUGE_CP[34];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=addt#flash' />";
}

}ELSEIF ($action=="deletet"){
$id = intval($_GET['id']);
$query =  mysql_query("DELETE FROM flash WHERE id='$id'");
echo $LANGAUGE_CP[35];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=flash_cp.php?action=addt#flash' />";

}ELSEIF ($action=="op"){

if(isset($_POST['delete'])){
if(count($_POST['del']) > 0){
$del_id = join(',',$_POST['del']);
$sql = mysql_query("DELETE FROM flash WHERE id IN($del_id)");
print $LANGAUGE_CP[35];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=flash_cp.php?action=addt#flash' />";
}else{
echo $LANGAUGE_CP[63];
}
}


if(isset($_POST['noact'])){
if(count($_POST['del']) > 0){
$del_id = join(',',$_POST['del']);
$sql = mysql_query("UPDATE flash SET active='0' WHERE id IN($del_id)");
print $LANGAUGE_CP[61];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=flash_cp.php?action=addt#flash' />";
}else{
echo $LANGAUGE_CP[63];
}
}

if(isset($_POST['activ'])){
if(count($_POST['del']) > 0){
$del_id = join(',',$_POST['del']);
$sql = mysql_query("UPDATE flash SET active='1' WHERE id IN($del_id)");
print $LANGAUGE_CP[62];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=flash_cp.php?action=addt#flash' />";
}else{
echo $LANGAUGE_CP[63];
}
}

if(isset($_POST['edit'])){

if(count($_POST['del']) > 0){
$c = count($_POST['del']);

$del_id = join(',',$_POST['del']);
$queryx = mysql_query("SELECT * FROM flash where id IN($del_id) order by id desc");

echo "<form name='vbform' method='POST' action='flash_cp.php?action=editall'>
<table class='xtable' width='100%' id='AutoNumber15555'>

<tr>
      <td width='100%' colspan='2' class='xtt' align='center'>".$LANGAUGE_CP[32]."</td>
</tr>";
$ii = 0;
while($p = mysql_fetch_array($queryx))
{
++$ii;

$p['metadescription'] = stripslashes($p['metadescription']);
$p['metadescription'] = htmlspecialchars($p['metadescription']);

$p['metakeywords'] = stripslashes($p['metakeywords']);
$p['metakeywords'] = htmlspecialchars($p['metakeywords']);

$p['name_flash'] = stripslashes($p['name_flash']);
$p['name_flash'] = htmlspecialchars($p['name_flash']);

$p['url_flash'] = stripslashes($p['url_flash']);
$p['url_flash'] = htmlspecialchars($p['url_flash']);

$p['desin_flash'] = stripslashes($p['desin_flash']);
$p['desin_flash'] = htmlspecialchars($p['desin_flash']);

$p['download_flash'] = stripslashes($p['download_flash']);
$p['download_flash'] = htmlspecialchars($p['download_flash']);

echo "<input type='hidden' name='id[]' value='".$p['id']."' />
<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[263]."</td>
<td width='80%' class='xtd'><input name='name_flash[]' size='80' value='".$p['name_flash']."' /></td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[264]."</td>
<td width='80%' class='xtd'><input name='desin_flash[]' size='80' value='".$p['desin_flash']."' /></td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[92]."</td>
<td width='80%' class='xtd'><textarea name='metadescription[]' rows='3' cols='80'>".$p['metadescription']."</textarea>
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[91]."</td>
<td width='80%' class='xtd'><textarea name='metakeywords[]' rows='3' cols='80'>".$p['metakeywords']."</textarea>
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[265]."</td>
<td width='80%' class='xtd'><input dir='ltr' name='url_flash[]' size='80' value='".$p['url_flash']."' />
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[266]."</td>
<td width='80%' class='xtd'><input dir='ltr' name='download_flash[]' size='80' value='".$p['download_flash']."' />
</td>
</tr>

<tr>
<td width='20%' class='xtr'>".$LANGAUGE_CP[95]."</td>
<td width='80%' class='xtd'>
<select size='1' name='cat[]'>";
$sql = mysql_query ("SELECT * FROM flash_cat") or die ("error");
while($sub = mysql_fetch_array($sql))
{
if($sub['id'] ==  $p['cat']){
echo "<option value='".$sub['id']."' selected='selected'>".$sub['name_cat']."</option>";
}else{
echo "<option value='".$sub['id']."'>".$sub['name_cat']."</option>";
}

}
echo "</select>
</td>
</tr>

<tr>
<td width='30%' class='xtr'>".$LANGAUGE_CP[117]."</td>
<td width='70%' class='xtd'>
<select size='1' name='active[]'>";
if($p['active'] == 1){
echo "<option value='1' selected='selected'>".$LANGAUGE_CP[108]."</option>";
echo "<option value='0'>".$LANGAUGE_CP[107]."</option>";
}else{
echo "<option value='1'>".$LANGAUGE_CP[108]."</option>";
echo "<option value='0' selected='selected'>".$LANGAUGE_CP[107]."</option>";
}
echo "</select>
</td>
</tr>";

if($ii != $c){
echo "<tr>
<td width='100%' colspan='2' align='center' class='xtr'>- - - - - - - -</td>
</tr>";
}

}

echo "<tr>
<td width='100%' colspan='2' align='center' class='xtr'><input class='addsubmit' type='submit' value=' ".$LANGAUGE_CP[33]." ' name='B1' /></td>
</tr>

</table>
</form>";

}else{
echo $LANGAUGE_CP[255];
}

}

}ELSEIF ($action=="editall"){

$number = count($_POST['id']);

for($i=0;$i<$number;$i++){
$id = $_POST['id'][$i];
$id = intval($id);

$name_flash = addslashes($_POST['name_flash'][$i]);
$name_flash = trim($name_flash);

$desin_flash = addslashes($_POST['desin_flash'][$i]);
$desin_flash = trim($desin_flash);

$url_flash = addslashes($_POST['url_flash'][$i]);
$url_flash = trim($url_flash);

$download_flash = addslashes($_POST['download_flash'][$i]);
$download_flash = trim($download_flash);

$metadescription = $_POST['metadescription'][$i];
$metadescription = addslashes($metadescription);
$metadescription = trim($metadescription);

$metakeywords = $_POST['metakeywords'][$i];
$metakeywords = addslashes($metakeywords);
$metakeywords = trim($metakeywords);

if($metadescription == ""){
$xx1 = $name_flash;
}else{
$xx1 = $metadescription;
}

if($metakeywords == ""){
$m2x = str_replace(" ",",",$name_flash);
$xx2 = $m2x;
}else{
$xx2 = $metakeywords;
}

$cat = $_POST['cat'][$i];
$active = $_POST['active'][$i];

$w_flash = $_POST['w_flash'][$i];
$h_flash = $_POST['h_flash'][$i];
$autosize = $_POST['autosize'][$i];

if(!empty($name_flash) OR !empty($url_flash)){
echo "$name_flash . . . ".$LANGAUGE_CP[111]."<br />";
$query =  mysql_query("UPDATE flash SET name_flash='$name_flash', metadescription='$xx1',metakeywords='$xx2',cat='$cat',active='$active', desin_flash='$desin_flash', url_flash='$url_flash', download_flash='$download_flash', w_flash='$w_flash', h_flash='$h_flash', autosize='$autosize' where id='$id'");
}

}
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=flash_cp.php?action=addt#flash' />";

}
echo $f;
?>