<?php 
ob_start();
session_start();
require_once("../dbconnect.php");
 $action = isset($_GET['action']) ? $_GET['action'] : '';

switch ($action) {
	

   case 'delete' :
	     deleteCategory();
         break;
		

		
   case 'adminsettings' :
	     adminsettings();
         break; 
		 
		 
		 
   case 'password' :
	     chapasswoed();
         break; 		 
		 
     case 'pay' :
	     paypal();
         break; 
		 	  case 'cusedit' :
	     cusedit();
         break; 		
   case 'addtestmon' :
	     addtestmon();
         break; 	
		 
		   case 'edittest' :
	     edittest();
         break; 
	
	   case 'testdelete' :
	     testdelete();
         break; 
	
	 case 'teststatus' :
	     teststatus();
         break; 

		  		 
	
	
		default :
        // if action is not defined or unknown
        // move to main category page
        header('Location: addcategory.php');
		
		}
		
		


/*
   Delete Category
*/


function deleteCategory()
{

  $userid=$_POST['userid'];




      $sql3 = "DELETE FROM register WHERE  u_id=".$userid;
	      mysql_query($sql3);	



 header('Location: customers.php');  


 }

//* admin settings *//
function adminsettings()
{
 echo $query="update mec_admin set  mec_username='".$_POST['username']."',mec_email='".$_POST['email']."' where mec_admin_id =".$_POST['admid'];
	
	
	$exe=mysql_query($query);

header("location:adminsettings.php?up=up");

	
	
}
//change password/////////
	
function chapasswoed()
{


 echo $query="update mec_admin set mec_password='".$_POST['new_password']."' where mec_admin_id=".$_POST['admid'];

$query1=mysql_query($query);

header("location:adminsettings.php?cp=cp");

}

function paypal()
{

 $query="update admin set paypalid='".$_POST['paypalid']."' where admin_id=".$_POST['admid'];

$query1=mysql_query($query);

header("location:modules.php?up=up");

}
function addtestmon()
{
	
	
	
	
	

echo $sql= "INSERT INTO `testimonals` (`name_test`, `email`, `comment`, `status`) VALUES ('".$_POST['name']."', '".$_POST['email']."', '".$_POST['comment']."', '1');";
    $result = mysql_query($sql) or die('Cannot add category' . mysql_error());
	
	header("location:testimonials.php");

} 

function edittest()
{

echo  $query="update testimonals set name_test='".$_POST['name']."', email='".$_POST['email']."', comment='".$_POST['comment']."'  where id_test=".$_POST['tid'];


$query1=mysql_query($query);
header("location:testimonials.php");

} 

function testdelete()
{

  $sql3 = "DELETE FROM testimonals WHERE  id_test=".$_POST['tid'];
	      mysql_query($sql3);	
		  header("location:testimonials.php");
} 
function teststatus()
{
	
	//echo "UpDATE testimonals SET status=".$_GET['status']." where id_test=".$_GET['id_test']; exit;
	
	 $sql3 = "UPDATE testimonals SET status=".$_GET['status']." where id_test=".$_GET['id_test'];
	      mysql_query($sql3);	
		  header("location:testimonials.php");
}



?>
