$start_month *= 1;
 $start_day *= 1;
 $start_hour *= 1;
 $start_minute *= 1;
 $expires_year *= 1;
 $expires_month *= 1;
 $expires_day *= 1;
 $expires_hour *= 1;
 $expires_minute *= 1;
 $width *= 1;
 $height *= 1;
 // Name
 if ($name == '') {
     // Name empty
     $errortext[] = $l->g('banner_name_empty_error');
 } elseif ($banner->_db_getList('id', 'name LIKE ' . $name, 1)) {
     // Banner with this name already exists
     $errortext[] = $l->g('banner_name_already_exists');
     $banner->_db_freeList();
 }
 //  Position
 if ($display_position != 'p' && $display_position != 'm' && $display_position != 't' && $display_position != 'b') {
     $display_position = 't';
 }
 // Validate start date
 if (!@checkdate($start_month, $start_day, $start_year) || $start_hour > 60 || $start_hour < 0 || $start_minute > 60 || $start_minute < 0) {
     $errortext[] = $l->g('start_date_invalid');
 }
 // Validate expiration date
 if (empty($expires_never) && (!@checkdate($expires_month, $expires_day, $expires_year) || $expires_hour > 60 || $expires_hour < 0 || $expires_minute > 60 || $expires_minute < 0)) {
     $errortext[] = $l->g('expiration_date_invalid');
 *    "PCPIN Chat 6" is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
if (!is_object($session)) {
    die('Access denied');
}
_pcpin_loadClass('banner');
$banner = new PCPIN_Banner($session);
if (empty($banner_id)) {
    $banner_data = $banner->getRandomBanner($load_banner);
} elseif ($banner->_db_getList('id = ' . $banner_id, 1)) {
    $banner_data = $banner->_db_list[0];
}
if (empty($banner_data)) {
    // No banners loaded
    header('Location: dummy.html');
} else {
    switch ($banner_data['source_type']) {
        case 'u':
            header('Location: ' . PCPIN_FORMLINK . '?external_url=' . urlencode($banner_data['source']));
            die;
            break;
        case 'c':
            header('Content-Type: text/html; charset=UTF-8');
            header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
            if (PCPIN_CLIENT_AGENT_NAME == 'IE') {
}
if (!isset($expires_minute)) {
    $start_minute = 0;
}
if (!isset($width)) {
    $width = 0;
}
if (!isset($height)) {
    $height = 0;
}
$errortext = array();
if (is_object($session) && !empty($current_user->id) && $current_user->is_admin === 'y') {
    $xmlwriter->setHeaderMessage('OK');
    $xmlwriter->setHeaderStatus(0);
    $banner_id *= 1;
    if ($banner->_db_getList('id', 'id = ' . $banner_id, 1)) {
        $name = trim($name);
        $active = trim($active);
        $source_type = trim($source_type);
        $source = trim($source);
        $display_position = trim($display_position);
        $max_views *= 1;
        $start_year *= 1;
        $start_month *= 1;
        $start_day *= 1;
        $start_hour *= 1;
        $start_minute *= 1;
        $expires_year *= 1;
        $expires_month *= 1;
        $expires_day *= 1;
        $expires_hour *= 1;