<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');

if($_POST[action]=="Update"){
	@extract($_POST);
	updateTable("admin_details"," name='$name', email='$email', cc='$cc', subject='$subject', website='$website', address='$address',address2='$address2',address3='$address3', companyName='$companyName', phone='$phone', mobile='$mobile', city='$city', state='$state', country='$country', analitic='$googleanalitic', chat='$live_chat', faxaa='$faxbb', facebook='$facebook', instagram='$instagram', twitter='$twitter', youtube='$youtube',linkedin='$linkedin' where user_type='admin'");
	$_SESSION[session_message]="Admin details have been updated successfully";
	//header("Location:".SITE_ADMIN_URL."/myaccount.php");
  $redirect_url = SITE_ADMIN_URL."/myaccount.php";
  echo "<script>window.location.href='$redirect_url';</script>";

	exit;
}

$res=getResult("admin_details"," where user_type='admin'");
admin_header();
?>
<form name="form1" method="post" action="" onsubmit="return validate(this);">
<h5 align="center">Manage Admin Details</h5>
<table width="39%"  border="0" cellpadding="2" cellspacing="2" class="lightBorder" align="center">
 <?php
 if($_SESSION[session_message]!=""){
	 ?>
	 <tr><td colspan=3 class="lightGrayBg"><?php print_message();?></td></tr>
	 <?php
 }
 ?>
 <tr>
  <td width="120" align="left" class="lightGrayBg"><span class="red">*</span> Your Name</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="name" type="text" class="txtfieldadmin" value="<?=$res[name];?>" size="50" id="NOBLANK~Enter Your Name~DM~ALPHA~Please enter only  alphabatical value~DM~"></td>
  </tr>
 <tr>
  <td width="120" align="left" class="lightGrayBg"><span class="red">*</span> Company Name</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="companyName" type="text" class="txtfieldadmin" value="<?=$res[companyName];?>" size="50" id="NOBLANK~Enter Your Company Name~DM~"></td>
  </tr>
 <tr>
  <td width="120" align="left" class="lightGrayBg" valign="top"><span class="red">*</span> Company Address</td>
  <td colspan="2" align="center" valign="top" class="lightGrayBg">:
    <textarea name="address" class="txtfieldadmin" cols="50" rows="3"><?=$res[address];?>
    </textarea></td>
  </tr>

  <tr>
  <td width="120" align="left" class="lightGrayBg" valign="top"><span class="red">*</span> Branch Address</td>
  <td colspan="2" align="center" valign="top" class="lightGrayBg">:
    <textarea name="address2" class="txtfieldadmin" cols="50" rows="3"><?=$res[address2];?>
    </textarea></td>
  </tr>

  <tr>
  <td width="120" align="left" class="lightGrayBg" valign="top"><span class="red">*</span> Third Address</td>
  <td colspan="2" align="center" valign="top" class="lightGrayBg">:
    <textarea name="address3" class="txtfieldadmin" cols="50" rows="3"><?=$res[address3];?>
    </textarea></td>
  </tr>

 <tr>
  <td width="120" align="left" class="lightGrayBg"><span class="red">*</span> Company Email</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="email" type="text" class="txtfieldadmin" value="<?=$res[email];?>" size="50" id="NOBLANK~Enter Your Email-Id~DM~EMAIL~Enter Correct Email-Id~DM~"></td>
  </tr>
 <tr>
  <td width="120" align="left" class="lightGrayBg"><span class="red">*</span>CC</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="cc" type="text" class="txtfieldadmin" value="<?=$res[cc];?>" size="50" id="NOBLANK~Enter Your Email-Id~DM~EMAIL~Enter Correct Email-Id~DM~"></td>
  </tr>
 <tr>
  <td width="120" align="left" class="lightGrayBg">Subject</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="subject" type="text" class="txtfieldadmin" value="<?=$res[subject];?>" size="50"></td>
  </tr>
 <tr>
  <td width="120" align="left" class="lightGrayBg"><span class="red">*</span> Company Website</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="website" type="text" class="txtfieldadmin" value="<?=$res[website];?>" size="50" ></td>
  </tr>
 <tr>
  <td width="120" align="left" class="lightGrayBg">&nbsp;&nbsp; Company Phone </td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="phone" type="text" class="txtfieldadmin" value="<?=$res[phone];?>" size="50"></td>
  </tr>
  
  
  
  
  
  <tr>
  <td width="120" align="left" class="lightGrayBg">&nbsp;&nbsp; Mobile Number</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="mobile" type="text" class="txtfieldadmin" value="<?=$res[mobile];?>" size="50"></td>
  </tr>
  
  <tr>
  <td width="120" align="left" class="lightGrayBg">&nbsp;&nbsp; City</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="city" type="text" class="txtfieldadmin" value="<?=$res[city];?>" size="50"></td>
  </tr>
  
  <tr>
  <td width="120" align="left" class="lightGrayBg">&nbsp;&nbsp; State</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="state" type="text" class="txtfieldadmin" value="<?=$res[state];?>" size="50"></td>
  </tr>
  <tr>
  <td width="120" align="left" class="lightGrayBg">&nbsp;&nbsp; Country</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="country" type="text" class="txtfieldadmin" value="<?=$res[country];?>" size="50"></td>
  </tr>
 <tr>
  <td class="brdrbtm"><span class="lightGrayBg">Google Analytics Code</span></td>
  <td width="444" class="brdrbtm"><textarea name="googleanalitic"  rows="10" cols="70" class="txtfieldadmin" ><?=$res[analitic];?></textarea></td>
 </tr>

  
 <tr>
  <td class="brdrbtm"><span class="lightGrayBg">Live Chat</span></td>
  <td class="brdrbtm"><textarea name="live_chat"  rows="10" cols="70" class="txtfieldadmin" ><?=$res[chat];?></textarea></td>
 </tr>

 <tr>

  <td class="brdrbtm"><span class="lightGrayBg">Facebook</span></td>
  <td class="brdrbtm"><input type="text" size="50" name="facebook" class="txtfieldadmin" value="<?=$res[facebook];?>"></td>
 </tr>

 <tr>

  <td class="brdrbtm"><span class="lightGrayBg">Instagram</span></td>
  <td class="brdrbtm"><input type="text" size="50" name="instagram" class="txtfieldadmin" value="<?=$res[instagram];?>"></td>
 </tr>

 <tr>

  <td class="brdrbtm"><span class="lightGrayBg">Twitter</span></td>
  <td class="brdrbtm"><input type="text" name="twitter" size="50" class="txtfieldadmin" value="<?=$res[twitter];?>"></td>
 </tr>

 <tr>

  <td class="brdrbtm"><span class="lightGrayBg">Youtube</span></td>
  <td class="brdrbtm"><input type="text" name="youtube" size="50" class="txtfieldadmin" value="<?=$res[youtube];?>"></td>
 </tr>

 <tr>

  <td class="brdrbtm"><span class="lightGrayBg">LinkedIn</span></td>
  <td class="brdrbtm"><input type="text" name="linkedin" size="50" class="txtfieldadmin" value="<?=$res[linkedin];?>"></td>
 </tr>

 <tr>
  <td width="120" align="left" class="lightGrayBg">&nbsp;&nbsp; Company Fax</td>
  <td colspan="2" align="center" class="lightGrayBg">:
    <input name="faxbb" type="text" class="txtfieldadmin" value="<?=$res[faxaa];?>" size="50"></td>
  </tr>
 <tr>
  <td align="right" class="lightGrayBg">&nbsp;</td>
  <td align="center" class="lightGrayBg">&nbsp;</td>
  <td align="left" class="lightGrayBg">
   <input type="hidden" name="action" value="Update">
   <input name="f2" type="submit" class="button" value="Submit">  </td>
 </tr>
</table>		
</form>
<?php
admin_footer();
exit;
?>