Location: PHPKode > projects > Gashash > action.php
<?php
		include ('config.inc.php');
		include ('language/ar.php');
		$id = $_GET['id'];
		$no = $_GET['no'];		
		
		$query1 = "SELECT project_name FROM emails WHERE id = '$id'";
     	$result1 = mysql_query($query1);
		$row = mysql_fetch_array($result1);
		
		$project_name = $row['project_name'];
		$site_name = $row['site_name'];
		
		if ($_GET['do'] == "doc") {

		$query2 = "SELECT email_address FROM emails WHERE project_name = '$project_name'";
     	$result2 = mysql_query($query2);

		$f = fopen($id.".doc","w+");
		while ($row = mysql_fetch_array($result2)) {
		//$id = $row['id'];
		$email_address = $row['email_address'];		
		$write = fputs($f, $email_address."\r\n");
		}
		fclose($f);
		?>
		<table width="100%" border="0">
  			<tr>
			    <td><b><a href="<?php echo $id.".doc";?>"><?php echo _DL_DOC."</a>"; ?></b></td>
			    <td><img border="0" src="images/doc.gif" /></td>
		  	</tr>
		</table>
		<?
		} 
		elseif ($_GET['do'] == "xl") {

		$query2 = "SELECT email_address FROM emails WHERE project_name = '$project_name'";
     	$result2 = mysql_query($query2);

		$f = fopen($id.".csv","w+");
		while ($row = mysql_fetch_array($result2)) {
		//$id = $row['id'];
		$email_address = $row['email_address'];		
		$write = fputs($f, $email_address."\r\n");
		}
		fclose($f);
		?>
		<table width="100%" border="0">
  			<tr>
			    <td ><a href="<?php echo $id.".csv";?>"><b><?php echo _DL_XL."</a>"; ?></b></td>
			    <td><img border="0" src="images/xl.gif" /></td>
		  	</tr>
		</table>
		<?
		}
		elseif ($_GET['do'] == "del") {
		//$query3 = "DELETE from emails WHERE project_name = '$project_name' ";
		//$result3 = mysql_query($query3);

		for($i=0; $i<$no; $i++){
		$sql1 = "DELETE FROM emails WHERE project_name = '$project_name'";
		$result1 = mysql_query($sql1);
		//---------
		$sql2 = "DELETE FROM check_emails WHERE project_name = '$project_name'";
		$result2 = mysql_query($sql2);
			}

		}

?>
Return current item: Gashash