<?php
/* MyTickets [   by = www.phpx3.com   ]
* Faha1ad2@hotmail.com
* Writed By : Fahad S. Al-ghudaier
* All Right Reseved (C) 2010
*/
session_start();
include("Admin_Function.php");
head('rtl','','');
includes();
check_session();

if($permission['allow_options'] == 1 OR $permission['top_man'] == 1){ }else{
	show("no_permission.php");
	down();
	die();
}

## Language;
$language			= array();
$language['lang1']	= 'المعذره ... الرجاء إكمال الحقول المهمه';
$language['lang2']	= 'اسم الموقع';
$language['lang3']	= 'رابط الموقع';


if($_GET['step'] == setting){
	$Query 				= mysql_query("SELECT * FROM `option` WHERE `id`='1'");
	$rows 				= mysql_fetch_array($Query);
	querys();
	include("style/temp/options.php");
}



if($_GET['step'] == update){
	$site_name 			= trim($_POST['site_name']);
	$site_url 			= trim($_POST['site_url']);
	$meta_open 			= $_POST['meta_open'];
	$meta_desc 			= $_POST['meta_desc'];
	$main_language		= $_POST['main_language'];
	$main_group			= $_POST['main_group'];
	$main_reg_group		= $_POST['main_reg_group'];
	$allow_members_system= $_POST['allow_members_system'];
	$allow_captcha		= $_POST['allow_captcha'];
	$allow_copys		= $_POST['allow_copys'];
	$allow_rate			= $_POST['allow_rate'];
	$allow_pages		= $_POST['allow_pages'];
	$email_method		= $_POST['email_method'];
	

	if($site_name == '' OR $site_url == ''){
		echo $language['lang1'];
		print "<ul><li>".$language['lang2']."</li>
		<li>".$language['lang3']."</li>
		</ul>";
		exit;
	}



	$UPDATING_SYSTEM = mysql_query("UPDATE `option` SET `site_name`='$site_name',`site_url`='$site_url',
	`meta_open`='$meta_open',`meta_desc`='".$meta_desc."'
	,`main_language`='".$main_language."'
	,`main_reg_group`='".$main_reg_group."',`main_group`='".$main_group."',
	`open_registration`='".$open_registration."'
	,`allow_captcha`='".$allow_captcha."',`allow_copys`='".$allow_copys."'
	,`email_method`='".$email_method."',`allow_rate`='".$allow_rate."',`allow_pages`='".$allow_pages."'
	WHERE `id`='1'");
	

	if($UPDATING_SYSTEM){
		ok('options.php?step=setting',0);
	}else{
		print mysql_error();
	}

}







if($_GET['step'] == closing){
	$Query 	= mysql_query("SELECT `close`,`close_why` FROM `option` WHERE `id`='1'");
	$rows 	= mysql_fetch_array($Query);
	show("close.php");
}



if($_GET['step'] == update_close){
	$close 	= intval($_POST['close']);
	$Why 	= $_POST['why'];
	$update	= mysql_query("UPDATE `option` SET `close`='$close',`close_why`='".$Why."' WHERE `id`='1'");
	if($update){
		ok('options.php?step=closing',0);
	}else{
		print mysql_error();
	}
}

down();
?>