File: email.php

package info (click to toggle)
dtc 0.35.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,824 kB
  • sloc: php: 50,739; sh: 8,596; makefile: 572; perl: 148; xml: 25
file content (42 lines) | stat: -rw-r--r-- 1,756 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

///////////////////////////////////////////////
// Email account submition to mysql database //
///////////////////////////////////////////////
if(isset($_REQUEST["action"]) && $_REQUEST["action"] == "set_catchall_account"){
	checkLoginPassAndDomain($adm_login,$adm_pass,$edit_domain);

	if($_REQUEST["catchall_popup"] == "no-mail-account"){
		$q = "UPDATE $pro_mysql_domain_table SET catchall_email='' WHERE name='$edit_domain';";
		$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said :".mysql_error());
	}else{
		if(!isMailbox($_REQUEST["catchall_popup"])){
			$submit_err .= _("Incorect mail login format: it should consist of only lowercase letters, numbers, or the \"-\" sign.<br>\n") ;
			$commit_flag = "no";
		}else{
			// Check if mail exists...
			if($_REQUEST["catchall_popup"] != "no-mail-account"){
				$test_query = "SELECT * FROM $pro_mysql_pop_table WHERE id='".$_REQUEST["catchall_popup"]."' AND mbox_host='$edit_domain'";
				$test_result = mysql_query ($test_query)or die("Cannot execute query \"$test_query\"");
				$testnum_rows = mysql_num_rows($test_result);
				if($testnum_rows != 1){
					$submit_err .= _("Mailbox does not exist in database.<br>\n") ;
					$commit_flag = "no";
				}else{
					$catch = $_REQUEST["catchall_popup"];
					writeCatchallDotQmailFile($catch,$edit_domain);
				}
			}else{
				$catch = "";
			}
		}	
		if($commit_flag == "yes"){
			$q = "UPDATE $pro_mysql_domain_table SET catchall_email='".$_REQUEST["catchall_popup"]."' WHERE name='$edit_domain';";
			$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
			triggerMXListUpdate();
			updateUsingCron("qmail_newu='yes',gen_qmail='yes'");
		}
	}
}

?>