<?php session_start();
 if( !isset($_SESSION['ps_user']) )
 {
	include('login.php');
	    die();
}
 
include('includes/config.php');
if($lang == 'en'){include('languages/en.php');}else if($lang == 'ar'){include('languages/ar.php');}
mysql_connect("$host", "$user", "$pass")or die("cannot connect");
mysql_select_db("$db")or die("cannot select DB");
$now = $_SESSION['ps_user'];
$sql="SELECT * FROM users WHERE Username = '$now'";
$result=mysql_query($sql);
while($row = mysql_fetch_array($result))
{
	$usern = $row['type'];
}
if($usern != 1 ){echo "<script>location='devices.php'</script>";}
$id = $_GET['id']; 
              $id=$_GET['id'];			
			
		 
 
			  ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title><?echo $lang_279;?></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="<?echo $lang_1;?>">
	<meta name="author" content="Ahmed Saleh">

	<!-- The styles -->
			<? include 'includes/css.php';?>

		<script type="text/javascript">
// Popup window code
function newPopup(url) {
	popupWindow = window.open(
	url,'popUpWindow','height=300,width=300,left=10,top=10,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=yes')
	popupWindow.focus();

}
</script>
<script type="text/javascript">
// Popup window code
function newPopup2(url) {
	popupWindow = window.open(
	url,'popUpWindow','height=700,width=300,left=10,top=10,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=yes')
	popupWindow.focus();
}
</script>
</head>

<body>
<!-- topbar starts -->
<?include('includes/navbar.php');?>
<!-- topbar ends -->
		<div class="container-fluid">
		<div class="row-fluid">
				
<!-- left menu starts -->
<?include('includes/menu.php');?>
<!-- left menu ends -->
			
			<noscript>
				<div class="alert alert-block span10">
					<h4 class="alert-heading">Warning!</h4>
					<p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a> enabled to use this site.</p>
				</div>
			</noscript>
				 <?
								$id = $_GET['id'];
include('includes/config.php');
// To connect to the database
mysql_connect("$host", "$user", "$pass")or die("cannot connect");
mysql_select_db("$db")or die("cannot select DB");
$result = mysql_query("SELECT * FROM `devices` Where ID = '$id'");
			 while($row = mysql_fetch_array($result))
  {
	  $thename = $row['Device Name'];
  ?>
 			<div id="content" class="span10">
			<div style="border-style:solid;border-width:1px;padding:15px;margin-right: 50px;">
			<a href="control.php"><span>لوحة التحكم</span></a> / <span><a href="control_ps.php">التحكم في الأجهزة</span></a> / <?echo $thename;?><span></span>
			</div>
			<br/>
			<!-- content starts -->
			 
			 <?
			  $success = $_GET['success'];
			 			 if($success == 'edited'){

 ?>
 <div class="alert alert-success">
							<button type="button" class="close" data-dismiss="alert">x</button>
							<strong><?echo $lang_25;?>!</strong> تعديل بيانات الجهاز
						</div> 
						 <?}?>
		
  
  
			 
			 
			 
			 
			 
 <center> 			 
<form action="actions/ps/edit.php" method="POST" >
<input type ="hidden" name = "idddd" value="<? echo $id;?>" >
   <h2><font color="red" ><?echo $lang_62;?>: </font><? echo $row['Device Name'] ?></h2>
  
   </br>
  </br>
 <h3><?echo $lang_194;?></h3>
  </br>
  <?echo $lang_21;?>:<br><input type="text" name="new_ps_name" value="<? echo $row['Device Name'] ?>"required><br>
  <?echo $lang_63;?>:<br>
   <select name="new_ps_type">
   <option value="<? echo $row['ps_version'] ?>"><?echo $lang_200;?></option>
   <option value="2"><?echo $lang_64;?></option>
   <option value="3"><?echo $lang_65;?></option>
   <option value="4"><?echo $lang_66;?></option>
   <option value="5"><?echo $lang_67;?></option>
   <option value="6"><?echo $lang_68;?></option>
   <option value="7">Bein Sports</option>
   <option value="8">VR</option>
   <option value="9">Wii</option>
   <option value="10">xbox</option>
   <option value="11">Cafe</option>
   </select> 
 <br>
  <?echo $lang_69;?>:</br><input type="number" min="0" step="0.1" name="new_single_price" value="<? echo $row['single'] ?>"required></br>
  <?echo $lang_70;?>:</br><input type="number" min="0" step="0.1" name="new_multi_price" value="<? echo $row['multi'] ?>"required></br>
  <?echo $lang_71;?> :</br><input type="number" min="0" step="0.1" name="new_multi5_price" value="<? echo $row['multi5'] ?>"required></br>
  <?echo $lang_72;?> :</br><input type="number" min="0" step="0.1" name="new_multi6_price" value="<? echo $row['multi6'] ?>"required></br>
  <?echo $lang_73;?> :</br><input type="number" min="0" step="0.1" name="new_multi7_price" value="<? echo $row['multi7'] ?>"required></br> 
  <?echo $lang_360;?> :</br><input type="number" min="0" step="0.1" name="ps_order" value="<? echo $row['orderby'] ?>"></br>
  <?echo $lang_415;?> :</br><textarea name="al3ab"><? echo $row['Paused'] ?></textarea></br>
 	 ip :</br><input type="text"  name="ip" value="<? echo $row['ip'] ?>"></br>
 Port :</br><input type="text"  name="port" value="<? echo $row['port'] ?>"></br>
 Open :</br><input type="text"  name="open" value="<? echo $row['openword'] ?>"></br>
 Close :</br><input type="text"  name="close" value="<? echo $row['closeword'] ?>"></br>
 										  
 								<button type="submit" class="btn btn-primary"><?echo $lang_232;?></button>
								</form> 
								<a href="control_ps_delete.php?id=<? echo $row['ID'];?>" ><button class="btn btn-danger"><?echo $lang_280;?></button></a>
</center>
    			




<? } ?>
  
					<!-- content ends -->
			</div><!--/#content.span10-->
				</div><!--/fluid-row-->
				
		<hr>

		<div class="modal hide fade" id="myModal">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">�</button>
				<h3>Settings</h3>
			</div>
			<div class="modal-body">
				<p>Here settings can be configured...</p>
			</div>
			<div class="modal-footer">
				<a href="#" class="btn" data-dismiss="modal">Close</a>
				<a href="#" class="btn btn-primary">Save changes</a>
			</div>
		</div>

		<footer>
			<p class="pull-left">&copy; <a href="http://www.gesture-sys.com/playstation" target="_blank">Gesture For Playstation</a> <?$Year = idate('Y');   echo $Year;?></p>
			
		</footer>
		
	</div><!--/.fluid-container-->

	<? include 'includes/js.php';?>

		
</body>
</html>
