<? 
include("../includes/site_config.php");
include('../session_handler.inc');

include("../languages/english_admin.php");
include("include/header.php");
include("../includes/tab_functions.js");

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

$del=mysql_query("update sms set title='".$_REQUEST['title']."', address='".$_REQUEST['address']."' where sms_id='".$_REQUEST['sms_id']."'");
}

if(isset($_REQUEST['del_id'])){

$del=mysql_query("delete from sms where sms_id='".$_REQUEST['del_id']."'");
}

if(isset($_REQUEST['sm_id'])){

$sel=mysql_query("SELECT * from sms where sms_id='".$_REQUEST['sm_id']."'");
$edit=mysql_fetch_object($sel);
}

if(isset($_REQUEST['add'])){
$count=mysql_num_rows(mysql_query("SELECT title from sms where title='".$_REQUEST['title']."'"));
if($count==0){
$ins=mysql_query("INSERT into sms set title='".$_REQUEST['title']."', address='".$_REQUEST['address']."'");
}
}

$get=mysql_query("SELECT * from sms");
?>
<? include("admin_tabs.php");?>
<div class="mainwidth">
<div class="admin-page-header"><div class="admin-page-heading">&nbsp;&nbsp;SMS Settings</div></div>
<div class="clear"></div>
<div class="admin-page">
<form action="<?=$_SERVER['PHP_SELF']?>" name="sms" method="post">
<table width="315" align="<?php print("$CONST_TABLE_ALIGN"); ?>" border="0" cellspacing="<?php print("$CONST_TABLE_CELLSPACING"); ?>" cellpadding="<?php print("$CONST_TABLE_CELLPADDING"); ?>">
<? while($sms=mysql_fetch_object($get)){?>
<tr>
<td width="35%" align="left" class="normal"><?=$sms->title?></td>
<? if($DEMO==false){?><td width="24%"><a href="<?=$_SERVER['PHP_SELF']?>?sm_id=<?=$sms->sms_id?>">Edit</a></td><? } else{?>
<td width="24%">Demo</td><? }?>
<? if($DEMO==false){?><td width="41%"><a href="<?=$_SERVER['PHP_SELF']?>?del_id=<?=$sms->sms_id?>">Delete</a></td><? } else{?>
<td width="41%">Demo</td><? }?>
</tr>
<? }?>
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
</table>
  <table width="<?php print("$CONST_TABLE_WIDTH"); ?>" align="<?php print("$CONST_TABLE_ALIGN"); ?>" border="0" cellspacing="<?php print("$CONST_TABLE_CELLSPACING"); ?>" cellpadding="<?php print("$CONST_TABLE_CELLPADDING"); ?>">
  
  <tr>
  <td class="normal" width="25%" align="right"> Title</td>
  <td class="inputl" width="75%"><input type="text" name="title" size="50" value="<?=$edit->title?>"/></td>
  </tr>
  
  <tr>
  <td class="normal" align="right">Address</td>
  <td class="input1"><input type="text" name="address" size="50" value="<?=$edit->address?>"/></td>
  </tr><input type="hidden" name="sms_id" value="<?=$edit->sms_id?>" />
  <tr>
  <td>&nbsp;</td>
  </tr>
  <? if($DEMO==false){?>
  <tr>
  <td>&nbsp;</td>
  <? if(isset($_REQUEST['sm_id'])){?>
  <td class="inputl" align="right"><input type="submit" name="edit" value="Update" class="button"/></td>
  <? }else{ ?>
  <td class="inputl" align="right"><input type="submit" name="add" value="Add" class="button"/></td>
  <? }?>
  </tr>
  <? }else{?>
  <tr>
  <td>&nbsp;</td>
  <td class="inputl" align="right"><input type="button" name="demo" value="ADD" class="button"/></td>
  </tr>
  <? }?>
  </table>


  <p><a href="http://en.wikipedia.org/wiki/List_of_carriers_providing_Email_or_Web_to_SMS">See the complete list of Global SMS Providers</a></p>
  </form>


</div><div class="admin-page-bottom"></div></div>
<?php include("include/footer.php"); ?>
