I'm trying to create an email into DirectAdmin by API but my codes give back a syntax error on line 10 but i don't see anything wrong with that line.
<?php
include('../da_api');
$sock = new HTTPSocket;
$sock->connect('mijndomein',2222);
$sock->set_login('mijndomein','mijn 1337 ww');
if(!empty($_POST['user']) && !empty($_POST['passwd']) is_numeric($_POST['quota'])) {
$sock->query('/CMD_API_POP','domain=mijndomein"a='.$_POST['quota'].'&action=create&user='.$_POST['user'].'&passwd='.$_POST['passwd'].'');
echo $sock->result;
if(eregi('error=0', $sock->result)){
echo '<p>Email adress is aan gemaakt<br />
username: '.$_POST['user'].'@mijndomein.nl<br />
password: '.$_POST['passwd'].'<br />
Quota: '.$_POST['quota'].'<br />
POP3 server: mail.mijndoemin.nl<br />
SMTP server: mail.mijndomein.nl*</p>';
}
}
?>
You missed logical operator within if
statement
if(!empty($_POST['user']) && !empty($_POST['passwd']) is_numeric($_POST['quota'])){
^^^
should be
if(!empty($_POST['user']) && !empty($_POST['passwd']) && is_numeric($_POST['quota'])){
^^^
Wrong syntax for if
. Missing operator &&
or ||
before is_numeric()
. It should be -
if(!empty($_POST['user']) && !empty($_POST['passwd']) && is_numeric($_POST['quota'])){
You missed the logical operator at this line most probabaly you were indenting to write: ||
or &&
operator there, before the is_numeric($_POST['quota'])
in the if condition, it should be like
if(!empty($_POST['user']) && !empty($_POST['passwd']) && is_numeric($_POST['quota']))
or
if(!empty($_POST['user']) && !empty($_POST['passwd']) || is_numeric($_POST['quota']))