<?php session_start();  //Developed by ITechScripts?>
>
<? require 'include/header.php';
if(isset($_POST['add']))
{
/*
$currrency=$_POST[txtCurr];
$eq_val=$_POST[txtValue];
if(!empty($currrency))
{
$in_sql="insert into site_currencies(currency,eq_value)values('$currrency',$eq_val)";
$in_res=mysql_query($in_sql);
if($in_res) echo 'Currency added Successfully';
else echo 'Currency not added';
}
else
{*/
?>
<table border="0" align="center" cellpadding="0" cellspacing="0" width="70%" class="ft">
<form name="frm1" method="post">
<tr class="ct" height="25"><td colspan="2" width="100%"  height="40">&nbsp;&nbsp;&nbsp;<strong>Add Currency </strong></td></tr>
<tr  ><td width="50%" height="40">&nbsp;&nbsp;&nbsp;Currency</td><td><input type="text" class="bluetext"name="txtCurr"></td></tr>
<tr  ><td width="50%" height="40">&nbsp;&nbsp;&nbsp;Please Enter Equal Value of Dollar </td><td><input type="text" class="bluetext"name="txtValue"></td></tr>
<tr   >
<td  colspan="2" align="center" height="40"><input type="submit" class="button"   name="addnew" value=" Add " ></td></tr>
</table>
<?
//}
}
else
{
 ?>

<?
if(isset($_POST['addnew']))
{
$currrency=$_POST[txtCurr];
$eq_val=$_POST[txtValue];
if(!empty($currrency))
{
$in_sql="insert into site_currencies(currency,eq_value)values('$currrency',$eq_val)";
$in_res=mysql_query($in_sql);
if($in_res) echo '<div align=center> <font color=red size=+1>Currency added Successfully</font></div>';
else echo '<div align=center><font color=red>Currency not added</font></div>';
}
}

?>
<form name="frm" method="post">
<table border="0" align="center" cellpadding="0" cellspacing="0" width="70%" class="ft">

<tr><td align="center">
<table border="0" align="center" cellpadding="5" cellspacing="2" width="100%">
            <tr class="ct" height="25"> 
              <td height="24" colspan="3">Currency Manager</td>
            </tr>
<tr>
  <td colspan="3">You can Enable or Disable the Currency </td>
  </tr>
<tr >
  <td width="40%"><strong>Currency</strong></td>
  <td width="30%" align="center"><strong>Select</strong><br>Show&nbsp;&nbsp;&nbsp;&nbsp;Hide</td>
  <td  width="30%" align="center"><strong>Equal value of Dollar</strong></td>
</tr>
<?
	//$status=$_GET['status'];
	require 'include/configurations.php'; // ITECHBIDS Configuration File
	
	/*$type=$_GET['type'];
	$s=$_GET['s'];
	if($type==c) {
		$id=$_GET['id'];
		if($s=='on') {
			$sql="update payment_process set status='off' where payment_id=$id";
			$result=mysql_query($sql);
		}
		if($s=='off') {
			$sql="update payment_process set status='on' where payment_id=$id";
			$result=mysql_query($sql);
		}
	}
	if(!$status) $status='on';*/
	
if(isset($_POST['submit']))
{
$co_res=mysql_query("select * from site_currencies");
$count=mysql_num_rows($co_res);
$selsql="update site_currencies set statuss='show',eq_value='1' where currency_id=1";
$selres=mysql_query($selsql);

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

$j=$i+1;
$rdval='rdVal'.$j;
$txtval='txtVal'.$j;

$arr=$_POST[$rdval];
$arr1=$_POST[$txtval];

$selsql="update site_currencies set statuss='$arr',eq_value='$arr1' where currency_id=$j";
$selres=mysql_query($selsql);
}
}
if($selres)
{
?>
<tr ><td align="center" colspan="3"><font size=+1 color="red">Updated Successfully!</font></td></tr>
<?
}
	$sql="select * from site_currencies";
	$result=mysql_query($sql);
	$i=1;
	while($row=mysql_fetch_array($result)) 
	{
?>

<tr >
  <td><?=$row['currency'];?></td>
  <? if($i==1)
  {
  ?>
   <td align="center">
   <?php 
  if($row['statuss']=='show')
   {
   ?>
  <input type="radio" name="rdVal<?=$i; ?>" value="show" checked>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <?php
   } 
   ?>
   </td>
  <td align="center"><input type="text" class="bluetext"name="txtVal<?=$i; ?>" value=<?=$row['eq_value'];?>   disabled="disabled"></td>
 <?
 }
 else
 {
 ?>
  <td align="center"><?php 
  if($row['statuss']=='show') { ?>
  <input type="radio" name="rdVal<?=$i; ?>" value="show" checked><?php }
   else { ?><input type="radio" name="rdVal<?=$i; ?>" value="show"><?php } ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <?php if($row['statuss']=='hide') { ?>
	<input type="radio" name="rdVal<?=$i; ?>" value="hide" checked><?php }
	 else { ?><input type="radio" name="rdVal<?=$i; ?>" value="hide"><?php } ?></td>
  <td align="center"><input type="text" class="bluetext"name="txtVal<?=$i; ?>" value=<?=$row['eq_value'];?>  ></td>
 <?
 }
 ?>	 
</tr>
<?
$i++;
	}
?>
<tr><td colspan="3" align="center">
<input type="hidden" name="ival" value="<?=$i?>" />
<input type="submit" class="button"   value=" Add " name="add" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" class="button"   name="submit" value="Update" ></td></tr>
</table></td>
</tr>
</table>
</form>
<?  }require 'include/footer.php'  ?>
