<?
	include("head.php");
	include("../include/db.inc.php");
	include("../include/pager.php");	
 	include("../include/bit_functions.inc.php");
	$db1=new db;
    $db1->open();

	if($_SESSION['uid']=='' || $_SESSION['pwd']=='')
	{
		//header("location:login.php");
	}
	
if(isset($_POST['Submit']))
{
if($_POST['edit'] != 1) {
echo $state = $_POST['name'];
$ins="Insert into country set state='$state'";
mysql_query($ins);
header("location:addeditstate.php");
exit();
}
else
{
$state = $_POST['name'];
$id = $_POST[id];
mysql_query("Update country set state='$state' where id='$id'") or die(mysql_error());
header("location:addeditstate.php");
exit();
}
}

if(!empty($_GET['dele']))
{
$id = $_GET['dele'];
mysql_query("delete from country where id='$id'") or die(mysql_error());
header("location:addeditstate.php");
//exit();
}
if(!empty($_GET['edit']))
{
$id = $_GET['edit'];
$query = ("select id,state from country where id='$id'") or die(mysql_error());
if (!($res=@mysql_query($query))) {error(mysql_error(),__LINE__,__FILE__);}
list($id,$name) = mysql_fetch_array($res);
$edit = 1;
$text = "Edit";
}
else
{
$edit = 0;
$text = "Add";
}
if(!empty($_GET['activate'])) {
$id = $_GET['activate'];
mysql_query("Update country set status='1' where id='$id'") or die(mysql_error());
header("location:addeditstate.php");
exit();
}
if(!empty($_GET['block'])) {
$id = $_GET['block'];
mysql_query("Update country set status='0' where id='$id'") or die(mysql_error());
header("location:addeditstate.php");
exit();
}
	

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="friends networking sharing photos finding friends blogs journals blogging journaling bands,iSociety site made by Info-Tech Ltd.,music rate pics join groups forums classifieds online social networking" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="Isociety is a site like iSociety, its an exact clone of iSociety for those who want to run their own social networking site, photos, friends, groups, events, bulletin, networks, messages, pokes and much more. find and make your friends here" />
<meta name="Keywords" content="facebook clone, facebook script, exact iSociety clone, social networking site like iSociety, site for friends, networks, photos, groups, events, bulletin, myspace clone, myspace script, personal chatrooms, Info-Tech Ltd." />
<meta name="rating" content="General"/>
<meta name="copyright" content="Copyright (c) 2007 by Info-Tech Ltd." />
<meta name="classification" content="Web Development, social networking site, facebook clone, facebook script"/>
<meta name="coverage" content="Worldwide"/>
<meta name="title" content="iSociety | an exact facebook clone developed by Info-Tech Ltd."/>
<meta name="page-topic" content="products, services, technology, business, Internet, Web, friends, photos, networks, connections, events, groups, relations"/>
<meta name="audience" content="all, experts, advanced, professionals, business, youth, children, ladies, females, males"/>
<meta name="reply-to" content="helpdesk@money-auctions.com"/>

<meta name="author" content="Info-Tech Ltd. website development"/>
<title>Money-Auctions Administion Console</title>
<link href="index.css" rel="stylesheet" type="text/css" />

<script src="../include/validation.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<link rel="shortcut icon" href="<?=_BASEURL_?>/favicon.ico" /></head>

<body bgcolor="#ffffff">
<div class="admin_wrapper">
<div class="logo_show"><? include("minorlogout.php");?></div>
<div style="float:left; width:200px">
<div class="topg_links_show"><? include("left.php");	?></div>
<div class="top_links_show"><? include("belowleft1.php");	?></div></div>
<div style="float:left; width:800px">
<div class="maximum"><br />

<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::header starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->

<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border-color:#ffffff">
  <tr>
    <td><? //include("header.php");?></td>
  </tr>
</table>

<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::header ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->


<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->


<div style="margin-top:5px">
<table width="100%" border="1" cellspacing="0" cellpadding="0" height="100%" style="border-collapse:collapse; border-color:#ffffff">
  <tr height="417">     
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::left starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->   
  
		<td width="85%" bgcolor="#FFFFFF" valign="top">
         
		 <table cellpadding="0" cellspacing="0" width="98%" align="center">
		 <tr>     
		  <td valign="top" >



	  <form action="" method="post" name="form1" onSubmit="MM_validateForm('name','','R');return document.MM_returnValue">
	    <table width="80%" align="center" border="0" cellspacing="0" cellpadding="0">
          
          <tr>
            <th width="29%" scope="row" align="center"><div align="right" class="t5555513pxb">Country:</div></th>
            <td width="71%"><input name="name" type="text" class="whiteselect" id="name" value="<?=$name?>" />
            <input name="Submit" type="submit" class="inputsubmit" value="<?=$text?>" />
                <input name="id" type="hidden" id="id" value="<?=$id?>" />
                <input name="edit" type="hidden" id="edit" value="<?=$edit?>" />            </td>
          </tr>
        </table>
        </form>

<table width="80%" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border-color:#ffffff">
        <tr >
          <th width="16%" height="17" align="right" class="Whitetextsmall"  scope="col"><div align="center"><span class="style1 style5 style7">S.No </span></div></th>
          <th width="39%" align="left" class="Whitetextsmall"  scope="col"><div align="center"><span class="style1 style5 style7">Country</span></div></th>
          <th width="25%" align="left" class="Whitetextsmall"  scope="col"><div align="center"><span class="style1 style5 style7">Action</span></div></th>
		  <th width="25%" align="left" class="Whitetextsmall"  scope="col"><div align="center"><span class="style1 style5 style7">Status </span></div></th>
        </tr>
		
		<tr>
				  <td>&nbsp;</td><br/><br/>
				  <td>&nbsp;</td>
		</tr> 		  
				  
         <tr>
                  <td>&nbsp;</td>
                  
        </tr>
		
		<?php
		 $limit=20;
		$num=getStart($limit);	
		$query = mysql_query(dopaging("select id,state,status from country order by state", $limit)) or die(mysql_error());
		
		while($row= mysql_fetch_array($query)) 
		{
		$num +=1;
		
		if($num%2==0)
		echo "<tr >";
		else
		echo "<tr>";
		echo "<td align='center' class=\"t5555513px\" >$num</td>
			  <td align='left' class='t5555513px'>$row[1]</td>
			  <td align='center'>
			    <a href=\"addeditstate.php?edit=$row[0]\" class='headerlinkred'>EDIT</a> | 
				<a href=\"addeditstate.php?dele=$row[0]\" class='headerlinkred'>DELETE</a> 
			  </td>
			  <td> $row[2]</td>
			   
			  </tr>";
			 
			
			
		}
		if(rightpaging())
		
				echo "<tr><td colspan=3 align=center><br/><br/>".rightpaging()."</td></tr>";
				
		?>
		
		
      </table>
	 
	  	</td>
		 </tr>   
		 </table>
     
	 
	    <!--End Main Body-->
		</td>
  </tr>
</table>
</div>

<br/><br/>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center ends:::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</div></div>
<div class="bottom_links_show"><? include("footer.php");	?></div>
</div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</body>
</html>

