Пример #1
0
function getTopics($showId)
{
    require 'config.php';
    $postArray = array();
    $sql = $connect->query("SELECT `topics` . `id` FROM `topics` WHERE `topics` . `parentShow_Id` = '{$showId}'");
    while ($row = $sql->fetch_object()) {
        $topics = new topic($row->id);
        array_push($postArray, array("threadId" => $topics->getThreadId(), "title" => $topics->getTitle(), "description" => $topics->getDescription(), "dateTime" => $topics->getDateCreated(), "by" => $topics->getCreator(), "count" => $topics->getPostCount()));
    }
    return $postArray;
}
Пример #2
0
<?php

date_default_timezone_set("Asia/Manila");
$date = date('Y-m-d H:i:s');
if (isset($_POST['btnpost'])) {
    include_once "post.php";
    $param = array("postTitle" => $_POST["title"], "postDesc" => $_POST["desc"], "userID" => $_SESSION['id'], "topicID" => $_GET['topicid'], "datePosted" => $date, "postStatus" => 1, "postLevel" => $_SESSION['level']);
    $query = new post();
    $query->create("tblpost", $param);
}
if (isset($_POST['btntopic'])) {
    include_once "topic.php";
    $param = array("topicTitle" => $_POST["title"], "topicDesc" => $_POST["content"], "dateCreated" => $date, "forumCatID" => $_POST["cbocategory"], "topicStatus" => 1);
    $query = new topic();
    $query->create("tbltopic", $param);
}
if (isset($_POST['btnreply'])) {
    include_once "post.php";
    $param = array("replyContent" => $_POST["message"], "postID" => $_GET["postid"], "userID" => $_SESSION["id"], "datePosted" => $date, "replyLevel" => $_SESSION["level"], "replyStatus" => 1);
    $query = new post();
    $query->add("tblreply", $param);
}
    function _submit(&$sync)
    {
        global $config, $db, $auth, $user;
        if ($sync === false) {
            //submit() was called directly so we need to sync after it
            $sync = new syncer();
            $exec_sync = true;
        } else {
            //submit() was called by topic->submit(), sync there when everything is done
            $exec_sync = false;
        }
        if (!$this->post_id) {
            //new post, set some default values if not set yet
            if (!$this->poster_id) {
                $this->poster_id = $user->data['user_id'];
            }
            if (!$this->poster_ip) {
                $this->poster_ip = $user->ip;
            }
            if (!$this->post_time) {
                $this->post_time = time();
            }
        }
        $this->post_subject = truncate_string($this->post_subject);
        $sql_data = array('poster_id' => $this->poster_id, 'poster_ip' => $this->poster_ip, 'topic_id' => $this->topic_id, 'forum_id' => $this->forum_id, 'post_username' => $this->post_username, 'icon_id' => $this->icon_id, 'post_time' => $this->post_time, 'post_postcount' => $this->post_postcount ? 1 : 0, 'post_visibility' => $this->post_visibility, 'post_reported' => $this->post_reported ? 1 : 0, 'enable_bbcode' => $this->enable_bbcode ? 1 : 0, 'enable_smilies' => $this->enable_smilies ? 1 : 0, 'enable_magic_url' => $this->enable_magic_url ? 1 : 0, 'enable_sig' => $this->enable_sig ? 1 : 0, 'post_subject' => $this->post_subject, 'bbcode_bitfield' => 0, 'bbcode_uid' => '', 'post_text' => $this->post_text, 'post_checksum' => md5($this->post_text), 'post_edit_time' => $this->post_edit_time, 'post_edit_reason' => $this->post_edit_reason, 'post_edit_user' => $this->post_edit_user, 'post_edit_count' => $this->post_edit_count, 'post_edit_locked' => $this->post_edit_locked, 'post_delete_time' => $this->post_delete_time, 'post_delete_reason' => $this->post_delete_reason, 'post_delete_user' => $this->post_delete_user);
        $flags = '';
        generate_text_for_storage($sql_data['post_text'], $sql_data['bbcode_uid'], $sql_data['bbcode_bitfield'], $flags, $this->enable_bbcode, $this->enable_magic_url, $this->enable_smilies);
        if ($this->post_id && $this->topic_id) {
            //edit
            $sql = "SELECT p.*, t.topic_first_post_id, t.topic_last_post_id, t.topic_approved, t.topic_replies\n\t\t\t\t\tFROM " . POSTS_TABLE . " p\n\t\t\t\t\tLEFT JOIN " . TOPICS_TABLE . " t ON (t.topic_id = p.topic_id)\n\t\t\t\t\tWHERE p.post_id=" . intval($this->post_id);
            //$sql = "SELECT * FROM " . POSTS_TABLE . " WHERE post_id=" . intval($this->post_id);
            $result = $db->sql_query($sql);
            $post_data = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$post_data) {
                trigger_error("post_id={$this->post_id}, but that post does not exist", E_USER_ERROR);
            }
            //check first/last post
            $is_first_post = $post_data['post_id'] == $post_data['topic_first_post_id'];
            $is_last_post = $post_data['post_id'] == $post_data['topic_last_post_id'];
            $db->sql_transaction('begin');
            $sql = "UPDATE " . POSTS_TABLE . " SET " . $db->sql_build_array('UPDATE', $sql_data) . " WHERE post_id=" . $this->post_id;
            $db->sql_query($sql);
            if ($this->topic_id != $post_data['topic_id']) {
                //merge into new topic
                //get new topic's forum id and first/last post time
                $sql = "SELECT forum_id, topic_time, topic_last_post_time\n\t\t\t\t\t\tFROM " . TOPICS_TABLE . "\n\t\t\t\t\t\tWHERE topic_id = {$this->topic_id}";
                $result = $db->sql_query($sql);
                $new_topic_data = $db->sql_fetchrow($result);
                if (!$new_topic_data) {
                    trigger_error("attempted to merge post {$this->post_id} into topic {$this->topic_id}, but that topic does not exist", E_USER_ERROR);
                }
                //sync forum_posts
                //TODO
                if ($new_topic_data['forum_id'] != $post_data['forum_id']) {
                    $sync->add('forum', $post_data['forum_id'], 'forum_posts', $this->post_approved ? -1 : 0);
                    $sync->add('forum', $new_topic_data['forum_id'], 'forum_posts', $this->post_approved ? 1 : 0);
                    if ($this->forum_id != $new_topic_data['forum_id']) {
                        //user changed topic_id but not forum_id, so we saved the wrong one above. correct it via sync
                        $this->forum_id = $new_topic_data['forum_id'];
                        $sync->set('post', $this->post_id, 'forum_id', $this->forum_id);
                    }
                }
                //sync old topic
                $sync->add('topic', $post_data['topic_id'], 'topic_replies', $this->post_approved ? -1 : 0);
                $sync->add('topic', $post_data['topic_id'], 'topic_replies_real', -1);
                $sync->check_topic_empty($post_data['topic_id']);
                //sync new topic
                $sync->add('topic', $this->topic_id, 'topic_replies', $this->post_approved ? 1 : 0);
                $sync->add('topic', $this->topic_id, 'topic_replies_real', 1);
                //sync topic_reported and topic_attachment if applicable
                if ($post_data['post_reported']) {
                    $sync->topic_reported($post_data['topic_id']);
                }
                if ($post_data['post_attachment']) {
                    $sync->topic_attachment($post_data['topic_id']);
                }
                if ($this->post_reported) {
                    $sync->topic_reported($this->topic_id);
                }
                if ($this->post_attachment) {
                    $sync->topic_attachment($this->topic_id);
                }
                if ($is_first_post) {
                    //this was the first post in the old topic, sync it
                    $sync->topic_first_post($post_data['topic_id']);
                    $is_first_post = false;
                    //unset since we dont know status for new topic yet
                }
                if ($is_last_post) {
                    //this was the last post in the old topic, sync it
                    $sync->topic_last_post($post_data['topic_id']);
                    $sync->forum_last_post($post_data['forum_id']);
                    $is_last_post = false;
                    //unset since we dont know status for new topic yet
                }
                if ($this->post_time <= $new_topic_data['topic_time']) {
                    //this will be the first post in the new topic, sync it
                    $sync->topic_first_post($this->topic_id);
                    $is_first_post = true;
                }
                if ($this->post_time >= $new_topic_data['topic_last_post_time']) {
                    //this will be the last post in the new topic, sync it
                    $sync->topic_last_post($this->topic_id);
                    $sync->forum_last_post($this->topic_id);
                    $is_last_post = true;
                }
            } elseif ($is_first_post) {
                $sync->set('topic', $this->topic_id, array('icon_id' => $this->icon_id, 'topic_approved' => $this->post_approved, 'topic_title' => $this->post_subject, 'topic_poster' => $this->poster_id, 'topic_time' => $this->post_time));
            }
            //check if some statistics relevant flags have been changed
            if ($this->post_approved != $post_data['post_approved']) {
                //if topic_id was changed, we've already updated it above.
                if ($this->topic_id == $post_data['topic_id']) {
                    if ($is_first_post) {
                        //first post -> approve/disapprove whole topic if not yet done (should only happen when directly storing the post)
                        if ($this->post_approved != $post_data['topic_approved']) {
                            $sync->add('forum', $this->forum_id, 'forum_topics', $this->post_approved ? 1 : -1);
                            $sync->add('forum', $this->forum_id, 'forum_posts', $this->post_approved ? 1 + $post_data['topic_replies'] : -(1 + $post_data['topic_replies']));
                            $sync->forum_last_post($this->forum_id);
                            //and the total topics+posts
                            set_config('num_topics', $this->post_approved ? $config['num_topics'] + 1 : $config['num_topics'] - 1, true);
                            set_config('num_posts', $this->post_approved ? $config['num_posts'] + (1 + $post_data['topic_replies']) : $config['num_posts'] - (1 + $post_data['topic_replies']), true);
                        }
                    } else {
                        //reply
                        $sync->add('topic', $this->topic_id, 'topic_replies', $this->post_approved ? 1 : -1);
                        $sync->add('forum', $this->forum_id, 'forum_posts', $this->post_approved ? 1 : -1);
                    }
                }
                //update total posts
                if (!$is_first_post) {
                    set_config('num_posts', $this->post_approved ? $config['num_posts'] + 1 : $config['num_posts'] - 1, true);
                }
            }
            /*if($this->post_postcount != $post_data['post_postcount'] && $this->poster_id != ANONYMOUS)
            		{
            			//increase or decrease user_posts
            			$sync->add('user', $this->poster_id, 'user_posts', $this->post_approved ? 1 : -1);
            		}*/
            if ($this->poster_id != $post_data['poster_id'] || $this->post_postcount != $post_data['post_postcount']) {
                if ($post_data['post_postcount'] && $post_data['poster_id'] != ANONYMOUS) {
                    $sync->add('user', $post_data['poster_id'], 'user_posts', -1);
                }
                if ($this->post_postcount && $this->poster_id != ANONYMOUS) {
                    $sync->add('user', $this->poster_id, 'user_posts', 1);
                }
            }
            if ($is_first_post) {
                $sync->topic_first_post($this->topic_id);
            }
            if ($is_last_post) {
                $sync->topic_last_post($this->topic_id);
                $sync->forum_last_post($this->forum_id);
            }
            reindex('edit', $this->post_id, $sql_data['post_text'], $this->post_subject, $this->poster_id, $this->forum_id);
            $db->sql_transaction('commit');
        } elseif ($this->topic_id) {
            //reply
            $sql = "SELECT t.*, f.forum_name\n\t\t\t\t\tFROM " . TOPICS_TABLE . " t\n\t\t\t\t\tLEFT JOIN " . FORUMS_TABLE . " f ON (f.forum_id = t.forum_id)\n\t\t\t\t\tWHERE t.topic_id=" . intval($this->topic_id);
            $result = $db->sql_query($sql);
            $topic_data = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$topic_data) {
                trigger_error("topic_id={$this->topic_id}, but that topic does not exist", E_USER_ERROR);
            }
            //we need topic_id and forum_id
            $this->forum_id = $topic_data['forum_id'];
            $sql_data['forum_id'] = $this->forum_id;
            $sql_data['topic_id'] = $this->topic_id;
            //make sure we have a post_subject (empty subjects are bad for e.g. approving)
            if ($this->post_subject == '') {
                $this->post_subject = 'Re: ' . $topic_data['topic_title'];
            }
            $db->sql_transaction('begin');
            //insert post
            $sql = "INSERT INTO " . POSTS_TABLE . " " . $db->sql_build_array('INSERT', $sql_data);
            $db->sql_query($sql);
            $this->post_id = $db->sql_nextid();
            //update topic
            if (!$sync->new_topic_flag) {
                $sync->add('topic', $this->topic_id, 'topic_replies', $this->post_approved ? 1 : 0);
                $sync->add('topic', $this->topic_id, 'topic_replies_real', 1);
                $sync->set('topic', $this->topic_id, 'topic_bumped', 0);
                $sync->set('topic', $this->topic_id, 'topic_bumper', 0);
            } else {
                $sync->topic_first_post($this->topic_id);
                $sync->new_topic_flag = false;
            }
            $sync->topic_last_post($this->topic_id);
            //update forum
            if ($this->forum_id != 0) {
                $sync->add('forum', $this->forum_id, 'forum_posts', $this->post_approved ? 1 : 0);
                $sync->forum_last_post($this->forum_id);
            }
            if ($this->post_postcount) {
                //increase user_posts...
                $sync->add('user', $this->poster_id, 'user_posts', 1);
            }
            if ($this->post_approved) {
                //...and total posts
                set_config('num_posts', $config['num_posts'] + 1, true);
            }
            reindex('reply', $this->post_id, $sql_data['post_text'], $this->post_subject, $this->poster_id, $this->forum_id);
            $db->sql_transaction('commit');
            // Mark this topic as posted to
            markread('post', $this->forum_id, $this->topic_id, $this->post_time, $this->poster_id);
            // Mark this topic as read
            // We do not use post_time here, this is intended (post_time can have a date in the past if editing a message)
            markread('topic', $this->forum_id, $this->topic_id, time());
            //
            if ($config['load_db_lastread'] && $user->data['is_registered']) {
                $sql = 'SELECT mark_time
					FROM ' . FORUMS_TRACK_TABLE . '
					WHERE user_id = ' . $user->data['user_id'] . '
						AND forum_id = ' . $this->forum_id;
                $result = $db->sql_query($sql);
                $f_mark_time = (int) $db->sql_fetchfield('mark_time');
                $db->sql_freeresult($result);
            } else {
                if ($config['load_anon_lastread'] || $user->data['is_registered']) {
                    $f_mark_time = false;
                }
            }
            if ($config['load_db_lastread'] && $user->data['is_registered'] || $config['load_anon_lastread'] || $user->data['is_registered']) {
                // Update forum info
                $sql = 'SELECT forum_last_post_time
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . $this->forum_id;
                $result = $db->sql_query($sql);
                $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
                $db->sql_freeresult($result);
                update_forum_tracking_info($this->forum_id, $forum_last_post_time, $f_mark_time, false);
            }
            // Send Notifications
            user_notification('reply', $this->post_subject, $topic_data['topic_title'], $topic_data['forum_name'], $this->forum_id, $this->topic_id, $this->post_id);
        } else {
            //new topic
            $this->_topic = topic::from_post($this);
            $this->_topic->submit(true);
            //PHP4 Compatibility:
            if (version_compare(PHP_VERSION, '5.0.0', '<')) {
                $this->topic_id = $this->_topic->topic_id;
                $this->post_id = $this->_topic->topic_first_post_id;
            }
            $exec_sync = false;
        }
        foreach ($this->attachments as $attachment) {
            $attachment->post_msg_id = $this->post_id;
            $attachment->topic_id = $this->topic_id;
            $attachment->poster_id = $this->poster_id;
            $attachment->in_message = 0;
            $attachment->is_orphan = 0;
            $attachment->submit();
        }
        if ($exec_sync) {
            $sync->execute();
        }
        /*if($sync_topic)
        		{
        			if($this->_topic)
        			{
        				$this->_topic->sync();
        			}
        			else
        			{
        				sync('topic', 'topic_id', $this->topic_id);
        			}
        		}*/
    }
Пример #4
0
<?php
/*
<Orion, a web development framework for RK.>
Copyright (C) <2011>  <Orion>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program 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/>.
*/
define('IN_APP', true);
require_once('./interfase/common.php');
require_once(ROOT . 'objects/topic.php');

$user->init();
$user->setup();

$topic = new topic();
$topic->run();

page_layout($topic->get_title(), $topic->get_template());
Пример #5
0
 /**
  * Submit the post to database - contrary to naming, this will sync.
  *
  */
 function submit_without_sync($sync_not_needed = null)
 {
     global $config, $db, $auth, $user;
     if (!$this->post_id) {
         //new post, set some default values if not set yet
         if (!$this->poster_id) {
             $this->poster_id = $user->data['user_id'];
         }
         if (!$this->poster_ip) {
             $this->poster_ip = $user->ip;
         }
         if (!$this->post_time) {
             $this->post_time = time();
         }
     }
     $this->post_subject = truncate_string($this->post_subject);
     $sql_data = array('poster_id' => $this->poster_id, 'poster_ip' => $this->poster_ip, 'topic_id' => $this->topic_id, 'forum_id' => $this->forum_id, 'post_username' => $this->post_username, 'icon_id' => $this->icon_id, 'post_time' => $this->post_time, 'post_postcount' => $this->post_postcount ? 1 : 0, 'post_visibility' => $this->post_visibility, 'post_reported' => $this->post_reported ? 1 : 0, 'enable_bbcode' => $this->enable_bbcode ? 1 : 0, 'enable_smilies' => $this->enable_smilies ? 1 : 0, 'enable_magic_url' => $this->enable_magic_url ? 1 : 0, 'enable_urls' => $this->enable_urls ? 1 : 0, 'enable_sig' => $this->enable_sig ? 1 : 0, 'post_subject' => $this->post_subject, 'bbcode_bitfield' => 0, 'bbcode_uid' => '', 'post_edit_time' => $this->post_edit_time, 'post_edit_reason' => $this->post_edit_reason, 'post_edit_user' => $this->post_edit_user, 'post_edit_count' => $this->post_edit_count, 'post_edit_locked' => $this->post_edit_locked, 'post_delete_time' => $this->post_delete_time, 'post_delete_reason' => $this->post_delete_reason, 'post_delete_user' => $this->post_delete_user, 'message' => $this->post_text, 'message_md5' => md5($this->post_text), 'enable_indexing' => $this->enable_indexing, 'notify_set' => $this->notify_set, 'notify' => $this->notify, 'topic_title' => $this->post_subject);
     $flags = '';
     generate_text_for_storage($sql_data['message'], $sql_data['bbcode_uid'], $sql_data['bbcode_bitfield'], $flags, $this->enable_bbcode, $this->enable_magic_url, $this->enable_smilies);
     $topic_type = isset($this->_topic) ? $this->_topic->topic_type : POST_NORMAL;
     if ($this->topic_id && !$this->forum_id) {
         $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $this->topic_id;
         $result = $db->sql_query($sql);
         $this->forum_id = $db->sql_fetchfield('forum_id');
         $db->sql_freeresult($result);
         if (!$this->forum_id) {
             throw new \phpbb\exception\runtime_exception('TOPIC_NOT_EXIST');
         }
     } elseif (!$this->forum_id) {
         throw new \phpbb\exception\runtime_exception('Neither topic_id nor forum_id given. Post cannot be created.');
     }
     // Post:
     if ($this->post_id && $this->topic_id) {
         // Edit
         $mode = 'edit';
         $sql_data['post_id'] = $this->post_id;
         // TODO: We need more data on topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_first_post_id, topic_last_post_id
         // This is required by submit_post currently
         // Somewhere it also needs forum_name in $data for the notifications
         if ($this->_topic == null) {
             $this->_topic = topic::from_post($this);
         }
         $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . (int) $this->forum_id;
         $result = $db->sql_query($sql, 48600);
         $forum_name = $db->sql_fetchfield('forum_name', false, $result);
         $db->sql_freeresult($result);
         $sql_data = array_merge($sql_data, array('topic_posts_approved' => $this->_topic->topic_posts_approved, 'topic_posts_unapproved' => $this->_topic->topic_posts_unapproved, 'topic_posts_softdeleted' => $this->_topic->topic_posts_softdeleted, 'topic_first_post_id' => $this->_topic->topic_first_post_id, 'topic_last_post_id' => $this->_topic->topic_last_post_id, 'forum_name' => $forum_name));
     } elseif ($this->topic_id) {
         // Reply
         $mode = 'reply';
     } else {
         // New Topic
         $mode = 'post';
     }
     $poll = array();
     $post_data = $this->submit_post($mode, $this->post_subject, $this->post_username, $topic_type, $poll, $sql_data);
     // Re-Read topic_id and post_id:
     $this->topic_id = $post_data['topic_id'];
     $this->post_id = $post_data['post_id'];
     //TODO
     foreach ($this->attachments as $attachment) {
         $attachment->post_msg_id = $this->post_id;
         $attachment->topic_id = $this->topic_id;
         $attachment->poster_id = $this->poster_id;
         $attachment->in_message = 0;
         $attachment->is_orphan = 0;
         $attachment->submit();
     }
 }
Пример #6
0
 /**
  *
  * @param array $post
  * @return boolean|\Gn36\OoPostingApi\topic
  */
 static function from_post(post $post)
 {
     if ($post->topic_id != NULL) {
         return topic::get($post->topic_id);
     }
     $topic = new topic();
     $topic->topic_id = $post->topic_id;
     $topic->forum_id = $post->forum_id;
     $topic->topic_title = $post->post_subject;
     $topic->topic_poster = $post->poster_id;
     $topic->topic_time = $post->post_time;
     $topic->icon_id = $post->icon_id;
     $topic->topic_attachment = $post->post_attachment;
     $topic->topic_posts_approved = $post->post_visibility == ITEM_APPROVED ? 1 : 0;
     $topic->topic_posts_unapproved = $post->post_visibility == ITEM_UNAPPROVED ? 1 : 0;
     $topic->topic_posts_softdeleted = $post->post_visibility == ITEM_DELETED ? 1 : 0;
     $topic->topic_delete_user = $post->post_delete_user;
     $topic->topic_delete_reason = $post->post_delete_reason;
     $topic->topic_delete_time = $post->post_delete_time;
     $topic->topic_reported = $post->post_reported;
     $topic->topic_first_post_id = $post->post_id;
     $topic->topic_first_poster_colour = '';
     $topic->topic_first_poster_name = '';
     $topic->topic_last_post_subject = $post->post_subject;
     $topic->topic_last_post_time = $post->post_time;
     $topic->topic_last_poster_colour = '';
     $topic->topic_last_poster_id = $post->poster_id;
     $topic->topic_last_poster_name = '';
     $topic->topic_last_view_time = time();
     $topic->posts[] =& $post;
     return $topic;
 }
Пример #7
0
     $facebookPage = $_POST['facebookPage'];
 }
 //
 if ($channel != "-1" && !empty($name) && !empty($twitter_id) && !empty($handle)) {
     if (!checkForNameDuplicate($name)) {
         $sql = $connect->query("INSERT INTO `shows` VALUES('', '{$name}', '{$channel}', '{$handle}', '{$twitter_id}', '{$dayOfWeek}', '{$time}', '{$runTime}', '{$newEpisodes}', '{$inSyndication}', '{$afterbuzz}', '{$showPageNetworkLink}', '{$seasonCode}', '{$youtubePageLink}', '{$facebookPageLink}', '')");
         if ($sql) {
             echo "{$name}  was added successfully";
         } else {
             echo "Error Occured";
         }
     } else {
         //add to other table if passes validation
         if (!checkSecondaryTable($name, $channel)) {
             require 'classes.php';
             $classes = new topic();
             $mainChannel = $classes->getChannelIdFromShowName($name);
             if ($mainChannel != $channel) {
                 $sql = $connect->query("INSERT INTO `secondaryChannels` VALUES('', '{$name}', '{$mainChannel}', '{$channel}')");
                 if ($sql) {
                     echo "success";
                 } else {
                     echo "error occured";
                 }
             } else {
                 echo "Show already exists on this channel";
             }
         } else {
             echo "show already exists on this channel";
         }
     }