<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style>
<?

if($_POST["update"] =="Y")
{
$cmail				=	$_POST["cmail"];
$jmail				=	$_POST["jmail"];
$ga					=	$_POST["ga"];

$gs					=	$_POST["gs"];
$ps					=	$_POST["ps"];
$oc					=	$_POST["oc"];
$ep					=	$_POST["ep"];
$ot					=	$_POST["ot"];

$gm					=	$_POST["gm"];

function Getupdatenow($var,$val)
{
$sql="UPDATE sbs_config SET cof_value = '$val' WHERE  cof_var ='$var' LIMIT 1" ;
$update = mysql_query($sql) or die($sql);
}
Getupdatenow('cmail',$cmail);
Getupdatenow('jmail',$jmail);
Getupdatenow('ga',$ga);
Getupdatenow('gs',$gs);
Getupdatenow('ps',$ps);
Getupdatenow('oc',$oc);
Getupdatenow('ep',$ep);
Getupdatenow('ot',$ot);
Getupdatenow('gm',$gm);
jsalert("บันทึกการตั้งค่าสำเร็จ");
}

function Getvaluenow($val)
{
$sql="SELECT * FROM sbs_config where cof_var ='$val' LIMIT 0,1";
$result=mysql_query($sql) or die ($sql);
$crow=mysql_fetch_array($result);
echo $crow["cof_value"];
}

function Getvaluestr($val)
{
$sql="SELECT * FROM sbs_config where cof_var ='$val' LIMIT 0,1";
$result=mysql_query($sql) or die ($sql);
$crow=mysql_fetch_array($result);
return $crow["cof_value"];
}
?>
<form method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
        <td width="38" align="left"><img width="38" hspace="10" height="35" src="img/icon_setting.jpg"></td>
		<? 
		
		?>
        <td width="323" align="left"><span class="head">Site configuration</span></td>
        </td>
        </tr>
        </table>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td width="7" height="5" valign="top"><img src="images/border_01.jpg" width="7" height="5" /></td>
        <td background="images/border_02.jpg" style="background-repeat:repeat-x"></td>
        <td width="6" height="5" valign="top"><img src="images/border_03.jpg" width="6" height="5" /></td>
      </tr>
      <tr>
        <td background="images/border_04.jpg" style="background-repeat:repeat-y"></td>
        <td>
          <table width="100%" border="0">
<!--tr>
              <td><div align="right" class="font"><b>Get a Quote</b></div></td>
              <td>&nbsp;</td>
              <td><div align="left"></div></td>
            </tr>
			 <tr>
              <td><div align="right" class="font">Government Sector :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="gs" type="text" id="textfield4" value="<?=Getvaluenow('gs')?>" size="30" />
              </div></td>
            </tr>
			 <tr>
              <td><div align="right" class="font">Private Sector :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="ps" type="text" id="textfield4" value="<?=Getvaluenow('ps')?>" size="30" />
              </div></td>
            </tr>
				 <tr>
              <td><div align="right" class="font">Oversea Customer :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="oc" type="text" id="textfield4" value="<?=Getvaluenow('oc')?>" size="30" />
              </div></td>
            </tr>
				 <tr>
              <td><div align="right" class="font">Energy Project :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="ep" type="text" id="textfield4" value="<?=Getvaluenow('ep')?>" size="30" />
              </div></td>
            </tr>
			<tr>
              <td><div align="right" class="font">Other :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="ot" type="text" id="textfield4" value="<?=Getvaluenow('ot')?>" size="30" />
              </div></td>
            </tr>
			<tr>
              <td><div align="right" class="font">&nbsp;</div></td>
              <td>&nbsp;</td>
              <td><div align="left"></div></td>
            </tr-->
            <tr>
              <td><div align="right" class="font">Contact e-mail :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="cmail" type="text" id="textfield4" value="<?=Getvaluenow('cmail')?>" size="30" />
              </div></td>
            </tr>
			 <!--tr>
              <td><div align="right" class="font">Career e-mail :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="jmail" type="text" id="textfield4" value="<?=Getvaluenow('jmail')?>" size="30" />
              </div></td>
            </tr>
             <tr>
              <td><div align="right" class="font">Google map key :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
			  <input name="gm" type="text" id="textfield4" value="<?=Getvaluenow('gm')?>" size="30" />
              </div></td>
            </tr-->
	
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td class="font"><?if($_GET["cmd"]=="loglogin"){?>[<a href="cpt.txt" target="_blank">login log</a>]  [<a href="clog.php" target="_blank">clear log</a>]<?}?></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
			 <tr>
              <td><div align="right" class="font">Google analytics code :</div></td>
              <td>&nbsp;</td>
              <td><div align="left">
                <input name="ga" type="text" id="textfield5" value="<?=Getvaluenow('ga')?>" size="30" />
              </div></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td><input type="hidden" name="update" value="Y" /></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td><input type="submit" name="submit" id="submit" value="บันทึกการตั้งค่า" /></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
          </table>     
             
        <td background="images/border_06.jpg" style="background-repeat:repeat-y"></td>
      </tr>
      <tr>
        <td width="7" height="7" valign="top"><img src="images/border_07.jpg" width="7" height="7" /></td>
        <td background="images/border_08.jpg" style="background-repeat:repeat-x">&nbsp;</td>
        <td width="6" height="7" valign="top"><img src="images/border_09.jpg" width="6" height="7" /></td>
      </tr>
    </table>
    </form>