<?php

session_start();

if($HTTP_SESSION_VARS['dbName']==""){
header("location:../index.php");
}

include("config.inc.php");
include("Functions_UserAccess.php");
include("function.inc.php");
include("function2.inc.php");

		
$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($HTTP_SESSION_VARS['dbName'],$connection) or die("Could not find DB");

$mobile_id = $_POST["mobile_id"]; if ($mobile_id == ""){$mobile_id = $_GET["mobile_id"];}		
$actionmode = $_POST["actionmode"]; if ($actionmode == ""){$actionmode = $_GET["actionmode"];}		
$mobile_buildnumber = $_POST["mobile_buildnumber"]; if ($mobile_buildnumber == ""){$mobile_buildnumber = $_GET["mobile_buildnumber"];}		
$mobile_name = $_POST["mobile_name"]; if ($mobile_name == ""){$mobile_name = $_GET["mobile_name"];}		
$mobile_active = $_POST["mobile_active"]; if ($mobile_active == ""){$mobile_active = $_GET["mobile_active"];}		


if ($actionmode == 'deletemobile') {

$query = "delete from ".$config['dbName_log'].".mobile where mobile_id = '".$mobile_id."'";
$result = mysql_query($query);

 draw_mobiles($connection,$config['dbName_log']);


}

if ($actionmode == 'editmobile') {

$query = "update ".$config['dbName_log'].".mobile set mobile_buildnumber = '".$mobile_buildnumber."' , mobile_name ='".$mobile_name."',mobile_active ='".$mobile_active."'  where mobile_id = '".$mobile_id."'";

$result = mysql_query($query);

 draw_mobiles($connection,$config['dbName_log']);


}
if ($actionmode == 'editmobile2') {

$query = "update ".$config['dbName_log'].".mobile set mobile_active ='".$mobile_active."'  where mobile_id = '".$mobile_id."'";

$result = mysql_query($query);

 draw_mobiles($connection,$config['dbName_log']);


}
if ($actionmode == 'insertmobile') {

$query = "insert into ".$config['dbName_log'].".mobile (mobile_buildnumber,mobile_name,mobile_active) values ('".$mobile_buildnumber."','".$mobile_name."','".$mobile_active."')";

$result = mysql_query($query);

 draw_mobiles($connection,$config['dbName_log']);

}

if ($actionmode == 'changeactive') {

$query = "update ".$config['dbName_log'].".mobile set mobile_active ='".$mobile_active."' ";

$result = mysql_query($query);

 draw_mobiles($connection,$config['dbName_log']);


}


















?>