Location: PHPKode > scripts > Create Your Own Directory > cms/admin/cntrev.php
<?php
include "authheader.php";
if($block != true)
{
?>
<!-- Welcome to the scripts database of HIOX INDIA      -->
<!-- This tool is developed and a copyright             -->
<!-- product of HIOX INDIA.				        -->
<!-- For more information visit http://www.hscripts.com -->
<html>
<head>
</head>
<body style="margin: 0px;">
<?php include "heade.php" ?>

<table border=0 width=700 height=100% cellpadding=0 cellspacing=0 align=center>
<tr><td align=center>
<tr height=90%><td class=maintext valign=top>
<html>
<br>
<table align=center border=0 bgcolor=#f8f8ff  width=80%>
<?php
$tid=$_GET['tid'];
$cntid=$_GET['cntid'];
$cnt=$_POST['nam'];
$sub=$_GET['sub'];
$update=$_POST['update'];
$title=$_POST['title'];
$select1=$_POST['select1'];
$select2=$_POST['select2'];
$select3=$_POST['select3'];
$select4=$_POST['select4'];
$check=$_POST['mybox'];
$id=$_GET['id'];
$usrid=$_POST['usrid'];
$status=$_POST['status'];
$email=$_POST['email'];
//$cnt=count($check);
$frm='true';
$sel="";
if($select1==0)
{
}else if($select2 ==0)
{
	$tid=$select1;
}else if($select3==0)
{
	$tid=$select2;
}else if($select4==0)
{
	$tid=$select3;
}else
{
	$tid=$select4;
}

$tidd="";

$qry="select * from cnt where cntid=$cntid";
//echo"$qry";
    $result=mysql_query($qry,$link);
    if($line = @mysql_fetch_array($result, MYSQL_ASSOC))
    {
        $contents=$line['contents'];
	  $cntid=$line['cntid'];
	  $tidd=$line['tid'];
	  $usrid=$line['usrid'];
	 $arr=split('####',$contents);
}


if($update=='update')
{

$qryy="select mandatory from cntfields where catid=$tid";
//echo"$qryy";
  $res=mysql_query($qryy);
$k=0;
$i=0;
$stt="";

$k=0;
$i=0;
$stt="";
     while($ros = @mysql_fetch_array($res, MYSQL_ASSOC))
    {
             $vall=$ros['mandatory'];
             if($vall==1)
              {
               $stt[$i]=$k;
			$i=$i+1;
              }
        	$k=$k+1;
        	
              
    }

	for($i=0;$i<count($cnt);$i=$i+1)
		{
			$st=$st.$cnt[$i]."####";
		}

      $process="update";
	for($i=0;$i<count($stt);$i++){
              $vval=$stt[$i];

              if($cnt[$vval]=="")
                   {
                     $process="noupdate";
                    }

     }



    if($process=="update" )
    {
      $qry="update cnt set contents='$st',upddate=sysdate(),status='REV' where cntid=$cntid";
//echo"$qry";
      $result=mysql_query($qry);
	if($result)
	{
       $block=true;
	

	include "../class.phpmailer.php";
	$mail = new PHPMailer();
	$mail->From     = "$umail";
	$mail->FromName = "$userdomain";
	$mail->IsMail();
      $umail="$email";
	$mail->Subject = "updation of resource added in $userdomain";
      $mail->Body    = "your resource titled <font color=red>$title </font> added at freephpcms.com on <font color=red>$adddate </font>sis successfuly updated after admin review";
	$mail->AddAddress("$umail", "");
	if(!$mail->Send())
	{
  	      echo "<div align=center>There has been a mail error sending to " . $email . "</div><br>";
		// Clear all addresses for next loop
	   $mail->ClearAddresses();
       }

      $frm='false';
      echo"<div align=center>your review is successfully updated</div>";


	}
    }else
    {
       echo"<div align=center style='color:red;'>Enter proper values for mandatory fields</div>" ;
    }
  
 
}



   



if($sub=='yes')
{
    $qry="select cntid,UserId, tid,usrid,contents,cnt.status as status,email from cnt,user where cntid=$cntid1 and cnt.usrid=user.UserId";
	//echo"$qry";
    $result=mysql_query($qry,$link);
    if($line = @mysql_fetch_array($result, MYSQL_ASSOC))
    {
	  $cntid=$line['cntid'];
	  $tid=$line['tid'];
	  $usrid=$line['usrid'];
	  $contents=$line['contents'];
	  $arr=split('####',$contents);
        $title=$arr[0];
	  $status=$line['status'];
        $email=$line['email'];
		
	     }
}
?>
<?php
	echo"<SCRIPT LANGUAGE='JavaScript'>";
	echo"var cat = new Array();";
	$query="select * from type";
	$result=mysql_query($query,$link);
	$j=0;
	while($line = @mysql_fetch_array($result, MYSQL_ASSOC))
	{
	$id=$line['id'];
	$parentid=$line['parentid'];
	$name=$line['name'];
	//echo"---$id--$parentid--$name";
	echo"cat[$j] = new Array($id, $parentid, '$name');";
	$j=$j+1;
	}
	echo"</script>";
?>
<SCRIPT LANGUAGE='JavaScript'>
var check = true;
var val ="<?php echo($tid);?>";
var arr = new Array;
var jj=0;
while(check)
{
    for(var ff=0; ff<cat.length; ff++)
	{
      	if(cat[ff][0]==val)
		{
			val = cat[ff][1];
			tthis = cat[ff][2];
			arr[jj]=cat[ff][0];
			jj=jj+1;
			//alert("THis -"+tthis+"-- Parent-- "+val);
		}
	}
    if(val == 0)
    check = false;
}
function second(now,next)
{	
	var tt=0;
      var from = eval("document.fun.select"+now);
	var dd = from.selectedIndex;
	var res = from[dd].value;
      var ss = eval("document.fun.select"+(next));
	var ss1 = eval("document.fun.select"+(next+1));
	var ss2 = eval("document.fun.select"+(next+2));
	if(now==1)
	{
	ss1.style.visibility="hidden";
	ss2.style.visibility="hidden";
 	}
	for(var ff=0; ff<cat.length; ff++)
	{
      	if(cat[ff][1]==res)
		{
			ss.style.visibility="visible";
			var tt=1;
		}
	}
	if(tt==0)
	{
	    ss.style.visibility="hidden";
	}
	ss.options.length = 0;
	var cc = gg = 0;	
	for(var ff=0; ff<cat.length; ff++)
	{
	    var val = cat[ff];
	    if(val[1] == res)
		{
		  var tobeadded = val[2];
		  var tobeadded2 = val[0];
		  ss.options[gg] = new Option(tobeadded,tobeadded2);
	      gg = gg+1;
     	}
	}
}
</script>
<?php
if($frm=='true')
{

$str="select * from cntfields where catid=$tid";
$strr="select * from cnt where cntid=$cntid";
//echo"$strr";
$re=mysql_query($str);
$ree=mysql_query($strr);
while($rowss=mysql_fetch_array($ree,MYSQL_ASSOC))
{ 
$contents=$rowss['contents'];
$status=$rowss['status'];
 $cnts=split('####',$contents);

}

echo"<form name=fun method=POST action='cntrev.php?tid=$tid&cntid=$cntid'>
<tr><td width=20% class=head1><strong>Title</strong> </td><td width=90%>
<input type=text name=title value='$cnts[0]'></input></td></tr>
<tr><td width=20% class=head1><strong>Category<strong></td><td width=90%>
	<select name=select1 size=10 onclick=\"second(1,2)\">
	<script language=javascript>
	for(var d=0; d<cat.length; d++)
	{
		if(cat[d][1] == 0)
		document.write(\"<option value=\"+cat[d][0]+\">\"+cat[d][2]+\"</option>\");
	}
	</script>
	</select>
  	<select style='visibility: hidden;' name=select2 size=10 onclick=\"second(2,3)\">
	</select>
   	<select style='visibility: hidden;' name=select3 size=10 onclick=\"second(3,4)\">
	</select>
	<select style='visibility: hidden;' name=select4 size=10 onclick=\"second(4,5)\">
	</select>
	<select style='visibility: hidden;' name=select5 size=10 onclick=\"second(5,6)\">
	</select>
</td></tr>";
$i=0;
$present=no;
while($rows=mysql_fetch_array($re,MYSQL_ASSOC))
{ 
	$catid=$rows['catid'];
	$fname=$rows['fname'];
	$inputtype=$rows['inputtype'];
	$defaultval=$rows['defaultval'];
      $present='yes';

echo"<tr><td width=10%>";

echo"<strong>$fname</strong></td><td width=90%>";
if($inputtype=='selectbox')
{
	$val=explode(',',$defaultval);
	$ct=count($val);
	echo"<select name=nam[$i]>";
	$tmp="";
	for($k=0;$k<=$ct;$k++)
	{
            if($cnts[$i]==$val[$k])
            {
		echo"<option value=$val[$k] selected>$val[$k]</option>";
            }else
            {
		echo"<option value=$val[$k]>$val[$k]</option>";

             }

	}
	
	echo"</select></td></tr>";
}else if($inputtype=='textbox'){

echo"<input type=$inputtype id=id$i name=nam[$i]  value='$cnts[$i]'></td></tr>";

}else if($inputtype=='textarea'){

echo"<textarea id=id$i name=nam[$i] >$cnts[$i]</textarea></td></tr>";

}
$i=$i+1;
}


echo"<tr><td width=20% class=head1><strong>Status<strong></td><td>";
if($status=='REV'){
$sel1='selected';
}else{
$sel2='selected';
}

echo"<select name=status>
<option name=one value=\"REV\" $sel1 > REV</option>
<option name=two value=\"TBR\" $sel2> TBR </option>

</select>
</td></tr>
	<input type=hidden name=usrid value=$id>
	<input type=hidden name=email value=$email>
	<input type=hidden name=update value='update'></input>
	<input type=hidden name=cntid value=$cntid></input>
<tr><td colspan=4><div align=center><input type=submit name=update value=update></input></div></td></tr>
<tr><td height=20></td></tr>
</form>";
}


?>

<script language=javascript>
var coun=1;
for(i=arr.length-1;i>=0;i--)
{
	var xx = eval("document.fun.select"+coun);
	var dd = xx.options.length;
	for(var fg=0; fg<dd; fg++){
		if(xx[fg].value == arr[i])
			xx[fg].selected = true;
	}
	second(coun,(coun+1));
	coun=coun+1;
}
</script>
</td></tr>
</table>
<tr><td height=20 bgcolor=white>
</td></tr></table>

</body>
</html>
<!-- Welcome to the scripts database of HIOX INDIA      -->
<!-- This tool is developed and a copyright             -->
<!-- product of HIOX INDIA.				        -->
<!-- For more information visit http://www.hscripts.com -->

<?php
}
?>


Return current item: Create Your Own Directory