<?
require("../clases/rsptaforo.class.php");
$obj = new rsptaforo();
$t = $_REQUEST["text"];
if($t=="R"){	
		echo $if = $_REQUEST["idforo"];	
		echo $f = date("Y-m-d");	
		echo $rspta = $_REQUEST["rspta"];	
		echo $usu= $_REQUEST["usuario"];	
		 	
		if($obj->Crear($if,$f,$rspta,$usu)){		
					echo "<script languaje=javascript>\n"; 
	 				echo "location.href ='../manrsptaforo.php?id=$if';";					
	 				echo "</script>"; 
							
		}else{
		       echo "no pasa nada";
		     }
}

if($t=="A"){	
		 $if = $_REQUEST["idforo"];	
		 $f = date("Y-m-d");
		 $responde = $_REQUEST["responde"];
		 if($responde==""){
		   $rspta = $_REQUEST["rspta"];	
		 }else{
		      $rspta = "mi respuesta a: <br><code><font face=verdana size=2 color=#006699>".trim($_REQUEST["responde"])."</font></code> es: ".$_REQUEST["rspta"];
		     }
		 $usu= $_REQUEST["usuario"];	
		 	
		if($obj->Crear($if,$f,$rspta,$usu)){		
					echo "<script languaje=javascript>\n"; 
	 				echo "location.href ='../rsptaforo.php?id=$if';";					
	 				echo "</script>"; 
							
		}else{
		       echo "no pasa nada";
		     }
}

if($t=="e"){
 $id = $_REQUEST["coddoc"]; //parametro de idforo
 $cod = $_REQUEST["id"]; //idrsptaforo
   if($obj->Eliminar($cod)){
   
       echo "<script languaje=javascript>\n"; 
	 	echo "location.href ='../manrsptaforo.php?id=$id';";					
	 	echo "</script>";		
   }
   else
   {
    echo "no pasa nada";
	}

}
?>
