$val) { if (substr($key,0,6) == 'domain') { $dom = (int)substr($key,6); $sql = 'SELECT domain_name, user_id FROM domains WHERE domain_id = '.$dom; $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql); $row = mysql_fetch_array($res); if ($row['user_id'] != UID && !defined('ADMIN')) { $errors[] = 'You do not control the domain \''.$row['domain_name'].'\''; continue; } $sql = 'SELECT * FROM records WHERE record_type = \'UTD\' AND domain_id = '.$dom; $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql); if (mysql_num_rows($res) > 0) { $errors[] = 'The domain \''.$row['domain_name'].'\' is already associated with another site.'; continue; } $sql = 'INSERT INTO records (domain_id, record_type, record_value) VALUES ('.$dom.', \'UTD\', \''.$_POST['site'].'\')'; mysql_query($sql) or mf(__FILE__, __LINE__, $sql); } } $sql = 'INSERT INTO actions (user_id, action_type, action_value) VALUES ('; $sql .= UID . ', \'updateconf\', \'bind\')'; mysql_query($sql) or mf(__FILE__, __LINE__, $sql); } elseif ($_POST['task'] == 'webserver') { $update = false; $sql = 'SELECT site_php, site_index, site_htaccess FROM sites'; $sql .= ' WHERE site_id = ' . $_POST['site']; $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql); $row = mysql_fetch_assoc($res); if ($row['site_php'] != $_POST['phpversion']) { $update = true; $sql = 'UPDATE sites SET site_php = \''. m($_POST['phpversion']); $sql .= '\' WHERE site_id = ' . $_POST['site']; mysql_query($sql) or mf(__FILE__, __LINE__, $sql); } $index = isset($_POST['index']) ? '1' : '0'; $htaccess = isset($_POST['htaccess']) ? '1': '0'; if ($row['site_index'] != $index || $row['site_htaccess'] != $htaccess) { $update = true; $sql = 'UPDATE sites SET site_index = '.$index.', site_htaccess = '; $sql .= $htaccess.' WHERE site_id = '.$_POST['site']; mysql_query($sql) or mf(__FILE__, __LINE__, $sql); } if ($update) { $sql = 'INSERT INTO actions (user_id, action_type, action_value) '; $sql .= 'VALUES (' . UID . ', \'updateconf\', \'apache\')'; mysql_query($sql) or mf(__FILE__, __LINE__, $sql); } } else { return; } } } foo(); if (count($errors) > 0) { $error = 'The following errors were encountered: