Location: PHPKode > projects > PHPmyEXIM > catchall_create.php
<?php
require("session.php");
?>
<?php
if (isset($_GET['domain']))
{
	$domain = $_GET['domain'];
}
else
{
	$domain = "";
}

if($_POST['action'] == "yes")
{

$taccount = $_POST['taccount'];
$domain = $_POST['domain'];

require("config.php");
$tabelle = "mail_users";

/* Connection to the Database */ 
MYSQL_CONNECT($server, $user, $passw) or die ( "<H3>unable to connect to database server</H3>");
MYSQL_SELECT_DB($datenbank) or die ( "<H3>database does not exist</H3>");
$result2=MYSQL_QUERY("select mbox_name from $tabelle where concat(mbox_name, '@', domain_name) = '$taccount' and is_alias = 'no' and alias = ''");
$row2 = mysql_fetch_row($result2);
$result1=MYSQL_QUERY("select alias from $tabelle where mbox_name = '@' and domain_name = '$domain'");
$row1 = mysql_fetch_row($result1);
if($row2[0] != '')
{
	if ($row1[0] == "")
	{
		$result=MYSQL_QUERY("insert into $tabelle values('@', '$domain', '$taccount', 'yes', 'noaccess', NULL, NULL, NULL, NULL)");
		echo"<html>
		<head>
		<title></title>
		<link rel=stylesheet type=\"text/css\" href=\"global.css\">
		</head>
		<body>
		<p>Your catch-all-account has been saved successfully.<p><p><a href=\"main.php?domain=$domain\" target=\"main\"><img src=\"images/home.gif\" border=\"0\"></a></p>
		</body>
		</html>";
	}
	else
	{
	echo"<html>
	<head>
	<title></title>
	<link rel=stylesheet type=\"text/css\" href=\"global.css\">
	</head>
	<body>
	<p>Your catch-all-account has not been created. <br>A catch-all-account already exists.<p><p><a href=\"javascript:history.back()\" target=\"main\"><img src=\"images/back.gif\" border=\"0\"></a></p>
	</body>
	</html>";
	}
	}
	else
	{
	echo"<html>
	<head>
	<title></title>
	<link rel=stylesheet type=\"text/css\" href=\"global.css\">
	</head>
	<body>
	<p>Your catch-all-account has not been created. There is no eMail-account with this name.<p><p><a href=\"javascript:history.back()\" target=\"main\">back</a></p>
	</body>
	</html>";
	}
}else
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title></title>
	<link rel=stylesheet type="text/css" href="global.css">
</head>
<body> 
<form name="create_trash" action="<?php echo $PHP_SELF; ?>" method="POST">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
	<input type="hidden" name="action" value="yes">
	<input type="hidden" name="domain" value="<?php echo $domain; ?>">
	<th class="tab">Create catch-all-account</th>
</tr>
<tr>
	<td class="tab1">Every eMail that could not be delivered directly<br>
	 to a mail-account will be send to this eMail-address.<br>
	The eMail-address you enter underneath has to be a valid eMail-account.</td>
</tr>
<tr>
	<td>
	<input type="text" size="30" name="taccount" value="<?php echo "@$domain"; ?>">
	</td>
</tr>
<tr align=center>
	<td>
	<input type="image"  src="images/create.gif" name="submit" value="create">
	</td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
?>
Return current item: PHPmyEXIM