Location: PHPKode > projects > texTPress > setting_contact.php
<?php
// (c)2011 by Muhammad Fauzan Sholihin 		www.tetuku.com		Paypal donation: hide@address.com		LR donation: U1462159 (Iyin payment gateway)		Bank : BCA 0372344006 SwiftCode=CENA IDJA
// Your donation will keep development process of this web apps. Thanks for your kindness
// You may use, modify, redistribute my apps for free as long as keep the origin copywrite
session_start ();
include_once('functions.inc.php');

if ($_POST['send'] == 'OK') {
$site_setting[1] = "SiteContact" ;
$site_setting[2] = $_POST['address'] ;
$site_setting[3] = $_POST['phone'] ;
$site_setting[4] = $_POST['email'] ;

if ($_POST['key'] == '') {add_db('files/setting.txt',$site_setting) ;} else if ($_POST['key'] != '') {$site_setting[0] = $_POST['key'] ; edit_db('files/setting.txt',$site_setting) ;}

$_SESSION['note'] = "Your data successfully saved !";
redirect($_SESSION['prev'], 0.1); die();
}

$position = "Contact setting" ;
include "restrict.inc.php" ;
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><? echo $position; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include("meta.inc.php"); ?>
 <script language="javascript" type="text/javascript">
<!--
function tambahBaris(){
            var holder = document.getElementById('tab_location');
            var row    = document.createElement('div');holder.appendChild(row);
            var field  = document.createElement('div');row.appendChild(field);
                field.innerHTML = '<tr valign="baseline"><td nowrap align="right"><input name="data_name[]" type="text" id="data_name[]" size="20"> : </td><td><input name="data_value[]" type="text" id="data_value[]" value="" size="40"></td></tr>';
        }

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.id; 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>

</head>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<? if (!file_exists('files/header.inc.php')) { include ("header.inc.php"); } else if (file_exists('files/header.inc.php')) {include ("files/header.inc.php");} ?>
<TABLE width="100%"  border="0" cellpadding="2" cellspacing="0">
  <TR align="left" valign="middle">
    <TD width="1%" class="tabeljudul"><IMG src="images/icon_setting.gif" alt="#" width="28" height="28" border="0"></TD>
    <TD width="99%" class="tabeljudul">CONTACT ADDRESS </TD>
  </TR>
  <TR align="left" valign="top">
    <TD colspan="2"><form action="<?php echo $formAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1" onSubmit="MM_validateForm('email','','NisEmail');return document.MM_returnValue">
      <table  border="0" cellpadding="2" cellspacing="0">
        <tr>
          <td width="130" align="right" valign="top">        Address:</td>
          <td align="left" valign="top"><input name="address" type="text" id="Address" value="<? echo $setting[SiteContact][2] ;?>" size="40">
              </td>
        </tr>
        <tr>
          <td align="right" valign="top">          Phone:</td>
          <td align="left" valign="top"><input name="phone" type="text" id="Phone" value="<? echo $setting[SiteContact][3] ;?>" size="40">
              </td>
        </tr>
        <tr>
          <td align="right" valign="top">    Email:</td>
          <td align="left" valign="top"><input name="email" type="text" id="Email" value="<? echo $setting[SiteContact][4] ;?>" size="40">            </td>
        </tr>
        <tr>
          <td align="right" valign="top"><input name="key" type="hidden" id="key" value="<? echo $setting[SiteContact][0] ;?>"></td>
          <td align="left" valign="top">
        <input name="Submit" type="submit" id="Submit" value="Save">
        <input name="send" type="hidden" id="send" value="OK">
		  &nbsp;</td>
        </tr>
      </table>
    </form></TD>
  </TR>
</TABLE>
<? if (!file_exists('files/footer.inc.php')) { include ("footer.inc.php"); } else if (file_exists('files/footer.inc.php')) {include ("files/footer.inc.php");} ?>
</body>
</html>
Return current item: texTPress