Location: PHPKode > projects > Opensheet > opensheet/settings.php
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
session_start();
require('functions/base.functions.php');
require('classes/global.class.php');


	set_lang($_SESSION['lang']);
	$login_type = new Users();
		if ($_SESSION['permissions']['admin'] !== "1"){
		Header("Location: timesheet.php");
					exit();

		}



if (isset($_POST['action']) == 'add') {
    db_connect();
    if($_POST['use_ldap'] == "Y") {
    $ldap_enable = isset($_POST['use_ldap']) ? $_POST['use_ldap'] : null;
    $ldap_dc = isset($_POST['ldap_dc']) ? $_POST['ldap_dc'] : null;
    $ldap_host = isset($_POST['ldap_host']) ? $_POST['ldap_host'] : null;
    $ldap_passwd = isset($_POST['ldap_passwd']) ? $_POST['ldap_passwd'] : null;
    $ldap_user = isset($_POST['ldap_user']) ? $_POST['ldap_user'] : null;
    $ldap_domain = isset($_POST['ldap_domain']) ? $_POST['ldap_domain'] : null;
   # $company_name = isset($_POST['company_name']) ? $_POST['company_name'] : null;
   # $prefix = isset($_POST['prefix']) ? $_POST['prefix'] : null;
    
    
    $sql_ldap_host = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$ldap_host."' WHERE  `settings`.`setting_name` =  'ldap_host'";
    $sql_ldap_enable = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$ldap_enable."' WHERE  `settings`.`setting_name` =  'ldap_enable'";
    $sql_ldap_dc = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$ldap_dc."' WHERE  `settings`.`setting_name` =  'ldap_dc'";
    $sql_ldap_passwd = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$ldap_passwd."' WHERE  `settings`.`setting_name` =  'ldap_passwd'";
    $sql_ldap_user = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$ldap_user."' WHERE  `settings`.`setting_name` =  'ldap_user'";
    $sql_ldap_domain = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$ldap_domain."' WHERE  `settings`.`setting_name` =  'ldap_domain'";
   # $sql_company_name = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$company_name."' WHERE  `settings`.`setting_name` =  'company_name'";
    
    
    
    $result = mysql_query($sql_ldap_host) or die("Invalid query: " . mysql_error());
    $result = mysql_query($sql_ldap_enable) or die("Invalid query: " . mysql_error());
    $result = mysql_query($sql_ldap_dc) or die("Invalid query: " . mysql_error());
    $result = mysql_query($sql_ldap_passwd) or die("Invalid query: " . mysql_error());
    $result = mysql_query($sql_ldap_user) or die("Invalid query: " . mysql_error());
    $result = mysql_query($sql_ldap_domain) or die("Invalid query: " . mysql_error());
   # $addres = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	#	header('Location: '.$addres);
	#exit();		
    
    }
    
  if(isSet($_POST['company_name'])) {
    $company_name = isset($_POST['company_name']) ? $_POST['company_name'] : null;
    $sql_company_name = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$company_name."' WHERE  `settings`.`setting_name` =  'company_name'";
    $result = mysql_query($sql_company_name) or die("Invalid query: " . mysql_error());
    
    }
    
if(isSet($_POST['prefix'])) {
    $prefix = isset($_POST['prefix']) ? $_POST['prefix'] : null;
    $prefix = "UPDATE  `timesheet`.`settings` SET  `setting_value` =  '".$prefix."' WHERE  `settings`.`setting_name` =  'prefix'";
    $result = mysql_query($prefix) or die("Invalid query: " . mysql_error());
    
    }
    
    
   	$addres = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	header('Location: '.$addres);
	exit();		
	}
	
	
?><!-- Headers -->
	
<!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" xml:lang="en-us">
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/jqueryslidemenu.css" />
<link rel="stylesheet" href="js/addons/pager/jquery.tablesorter.pager.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="css/themes/blue/style.css" type="text/css" media="print, projection, screen" />

<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="js/jqueryslidemenu.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.pager.js"></script>
<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->



<script type="text/javascript">
$(document).ready(function() { 
	    $(".tablesorter") 
	    .tablesorter({widthFixed: true, widgets: ['zebra']}) 
	  	}); 
</script>


<title>General Settings</title>


</head>
<body>
<?php
include ('include/menu.settings.inc.html');	

$settings = new getSetting;
?>
				<form action="" method="POST" name="Settings">
				<table class="tablesorter" cellspacing="1" style="width:80%;margin:5%;">
				<thead>
					<tr>
						<th style="width:50%;"><?php echo gettext('Setting name');?></th>
						<th style="width:50%;"><?php echo gettext('Setting value');?></th>
					</tr>
				</thead>
			<tbody>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('Company Name');?></td><td><input type='text' name='company_name' size='48' value='<?php echo $settings->getValue('company_name');?>'></input></td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('Prefix');?></td><td><input type='text' name='prefix' size='48' value='<?php echo $settings->getValue('prefix');?>'></input></td></tr>

<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('Management Mode');?></td><td>Simple/Full</td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('Use Groups');?></td><td>Yes/No</td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('Allow Export xls');?></td><td>Yes/No</td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('Use LDAP');?></td><td><select name="use_ldap" size="1"><option value="Y" selected>enable</option><option value="N">disable</option></select></td></tr>

<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('LDAP host');?></td><td><input type='text' name='ldap_host' size='48' value='<?php echo $settings->getValue('ldap_host');?>'></input></td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('LDAP bind user');?></td><td><input type='text' name='ldap_user' size='48' value='<?php echo $settings->getValue('ldap_user');?>'></input></td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('LDAP bind passwd');?></td><td><input type='password' name='ldap_passwd' size='48' value='<?php echo $settings->getValue('ldap_passwd');?>'></input></td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('LDAP dc');?></td><td><input type='text' name='ldap_dc' size='48' value='<?php echo $settings->getValue('ldap_dc');?>'></input></td></tr>
<tr style="height: 30px;"><td class='cell_name'><?php echo gettext('LDAP domain name');?></td><td><input type='text' name='ldap_domain' size='48' value='<?php echo $settings->getValue('ldap_domain');?>'></input></td></tr>

</tbody>
</table>
<input type="hidden" name="action" value="add">
<center><input type="submit" value="<?php echo gettext('GO');?>" /></center>
Return current item: Opensheet