<?php
session_start();

include("connect.php");


$username = $_SESSION['username'];
$rolemaster_id = $_SESSION['rolemaster_id'];

$alldata=$_REQUEST['alldata'];
//echo $alldata.'#####';

$splitthedata=explode('**',$alldata);

$posterid=$splitthedata[0];
$commanderid=$splitthedata[1];
$commands=$splitthedata[2];



if ($posterid!='' && $commanderid!='' && $commands!='') {
	
   

    // Use prepared statements to prevent SQL injection
    $insertQuery = $con->query("INSERT INTO `posters_commads`(`id`, `posterid`, `commander_id`, `commands`, `created_on`) VALUES ('NULL','$posterid','$rolemaster_id','$commands',now())");
	//echo "UPDATE `posters` SET `likestatus` = '$likeStatus' WHERE `id` = '$postId'";
    
  if($insertQuery)
  {
	  echo 1;
	 // echo "<scrip>alert('Commanduploded Successfully....')</script>";
	  //echo "<scrip>wondow.location.href='/rythm/homee.php'</script>";  
  }
  else
  {
	  echo 0;
	//echo "<scrip>alert('SomethingWent WRong!....')</script>";
	//echo "<scrip>wondow.location.href='/rythm/homee.php'</script>";
  }
   
}
 else {
	 
	 echo 0;
    //echo "<scrip>alert('Please Fill the All Requirements!....')</script>";
	//echo "<scrip>wondow.location.href='/rythm/homee.php'</script>";
}
?>
