<?php
	include ("inc.all.php");
	
	$q=new Cdb;
	$url = get_setting("site_full_url");

	FFileRead("templates/template.ad.htm",$main);

	$member_id=$_GET['mid'];
	$main=str_replace("{id}",$_GET['id'],$main);
//	$main=str_replace("{id2}",$id2,$main);
	$main=str_replace("{mid}",$member_id,$main);
	
	$q->query("SELECT number_of_friends, member_id, mandatory_number_of_friends, name FROM campaigns WHERE member_id=$member_id AND id='$id'");
	$q->next_record();

	$window_height = 400;
	for ($i=1; $i<=$q->f("number_of_friends");$i++){
		$window_height += 32;
	}
	$main=str_replace("{w_height}", $window_height, $main);
	$main=str_replace("{url}", $url, $main);
	
	if  ($id != 0)
	{
		$query="select id from members where id='$id'";
		$q->query($query);
		$q->next_record();
		$title=$q->f("id");
	}
	
	echo $main;
?>