Jump to content
MakeWebGames

sorry I tried bruh


Recommended Posts

<?php
if(!isset($set)) {
   $set=array();
   $settq=$db->query("SELECT * FROM settings");
   while($r=$db->fetch_row($settq)) {
       $set[$r['conf_name']]=$r['conf_value'];
   }    
}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
   $('.chat_bar').click(function() {
       var this_ele = $(this);
       if($(this).parents('.chat_box').hasClass('hidden')) {
           $(this).parents('.hidden').animate({bottom: '0px'},500,function() { $('[name=' + this_ele.parents('.chat_box').attr('id') + ']').focus();updateShoutbox(); }).addClass('open').removeClass('hidden');
           c_name = 'chat_' + $(this).parents('.chat_box').attr('id');
           document.cookie=c_name + "=open";
       } else {
           $(this).parents('.open').animate({bottom: '-320px'},500,function() { updateShoutbox(); }).addClass('hidden').removeClass('open');    
           c_name = 'chat_' + $(this).parents('.chat_box').attr('id');
           document.cookie=c_name + "=hidden";
       }
   });
   $('.chat_contents').click(function() {
       $('[name=' + $(this).parents('.chat_box').attr('id') + ']').focus();
   });
   $('.chat_form').each(function() {
       $(this).submit(function() {
           alert('test');
       });
   });
   updateShoutbox();
});
function scrollBottom() {
   $('.chat_box').each(function() {
       $(this).children('.chat_contents').scrollTop($(this).children('.chat_contents')[0].scrollHeight);
   });    
}
function updateShoutbox() {
   $('.open').each(function() {
       var chat_box = $(this).children('.chat_contents');

       $.ajax({
           type: "POST",
           url: 'ajax_chat/chat_ajax.php',
           cache: false,
           data: "function=chat_box" + (chat_box.parents('.open').hasClass('gang') ? '&gang=' + chat_box.parents('.open').attr('id') : '&channel=' + $(this).attr('id')),
           success: function(data) {
               chat_box.html(data);
               scrollBottom();
           }
       });
   });
}
function sendChat(channel_id) {
   var chat_field = $('[name=' + channel_id + ']');
   if(chat_field.val() != '' && chat_field.val() != ' ') {
   chat_field.attr('disabled',true);
       $.ajax({
           type: "POST",
           url: 'ajax_chat/chat_ajax.php',
           cache: false,
           data: "function=send_chat" + (chat_field.parents('.open').hasClass('gang') ? '&gang=' + chat_field.parents('.open').attr('id') : '&channel=' + channel_id) + "&msg= " + chat_field.val(),
           success: function(data) {
               if(data == 1) {
                   updateShoutbox();
                   chat_field.val('');
                   chat_field.attr('disabled',false);
               } else {
                   alert('You\'re trying to post in a channel that either dosen\'t exist or your account does not have access to.');
                   chat_field.attr('disabled',false);    
               }
           }
       });
   }
}
setInterval('updateShoutbox()',<?php echo $set['refresh_time']; ?>);
</script>

<link href="http://stillarider.com/css/game.css" type="text/css" rel="stylesheet" />
<!--[if IE]>
<style type="text/css">
.chat_box chat_input {
   margin-bottom: -20px;
}
</style>
<![endif]-->
<!--[if lt IE 7]>
<style type="text/css">
.chat_box {
   display: none;
}
</style>
<![endif]-->
<?php

// Make any changes to the system that is needed for the system to work.
$fields = array('top_bar','top_bar_hover','top_bar_text','top_bar_text_hover','chat_text','main_back','input_box','input_box_text','opacity','opacity_level','round_corners','round_corners_amount','box_shadow','channel_number','refresh_time','filter_words','new_words');
$values = array('bdbdbd','afafaf','000000','000000','000000','e2e2e2','bdbdbd','000000',1,0.8,1,5,1,1,2000,'shit,cunt,fuck','****,****,****');

$count = 0;
foreach($fields as $f) {
   if(!isset($set[$f])) {
       $db->query("INSERT INTO settings (conf_name,conf_value) VALUES('".$f."','".$values[$count]."')");
       ++$changed;
   }
   ++$count;
}

$table[] = "CREATE TABLE IF NOT EXISTS `chat_box` (
 `chat_id` int(11) NOT NULL AUTO_INCREMENT,
 `chat_user` int(11) NOT NULL,
 `chat_to` int(11) NOT NULL,
 `chat_text` varchar(255) NOT NULL,
 `chat_time` int(11) NOT NULL,
 `chat_channel` int(11) NOT NULL,
 `chat_gang` int(11) NOT NULL,
 PRIMARY KEY (`chat_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;";

$table[] = "CREATE TABLE IF NOT EXISTS `chat_channels` (
 `channel_id` int(11) NOT NULL AUTO_INCREMENT,
 `channel_alias` varchar(255) NOT NULL,
 `channel_name` varchar(255) NOT NULL,
 `channel_open` int(1) NOT NULL,
 `channel_req` text NOT NULL,
 PRIMARY KEY (`channel_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;";

foreach($table as $t) {
   $db->query($t) or die('<b>MySQL Databse insertion error:</b><p>An error has occured when the system attempted to dump the various database information into the table. Please check the error below.<br />'.$db->error());    
}
if(isset($changed)) {
   header("Location: ".$_SERVER['PHP_SELF']);    
   exit;
}
// Make any changes to the system that is needed for the system to work.

$find_channels = $db->query("SELECT channel_name, channel_id, channel_alias, channel_open, channel_req FROM chat_channels");
if($db->num_rows($find_channels)) {
   $chat_count = 1;
   while($chan = $db->fetch_row($find_channels)) {
       $failed = 0;
       if($chan['channel_req']) {
           $privs = unserialize($chan['channel_req']);
           foreach($privs as $p) {
               $check_priv = $db->query("SELECT userid FROM users WHERE `".$db->escape($p[0])."` ".$db->escape($p[1])." '".$db->escape($p[2])."' AND userid = ".$userid);
               if(!$db->num_rows($check_priv)) {
                   $failed = 1;
               }
           }
       }
       if($failed < 1) {
           ?>
           <div id="<?php echo $chan['channel_alias']?>" class="chat_box <?php echo (isset($_COOKIE['chat_'.$chan['channel_alias']]) && $_COOKIE['chat_'.$chan['channel_alias']] == 'hidden' ? ' hidden' : (!isset($_COOKIE['chat_'.$chan['channel_alias']]) && $chan['channel_open'] == 1 ? ' hidden' : ' open'))?>" <?php echo ($chat_count > 1 ? 'style="right: '.((($chat_count-1)*262)+20).'px;"' : '')?>
               <div class="chat_bar">
                   <?php echo ($set['channel_number'] == 1 ? $chan['channel_id'].'.' : '')?> <?php echo $chan['channel_name']?>
               </div>
               <div class="chat_contents">

               </div>
               <div id="chat_input">
                   <form action="#" onsubmit="sendChat('<?php echo $chan['channel_alias']?>');return false;">
                       <input type="text" name="<?php echo $chan['channel_alias']?>" class="chat_msg" />
                   </form>
               </div>
           </div>
           <?php
           ++$chat_count;    
       }
   }
}
if(isset($ir['gang'])) {

   $gang_data = $db->query("SELECT gangNAME FROM gangs WHERE gangID = ".$ir['gang']);
   if($db->num_rows($gang_data)) {
       $g_data = $db->fetch_row($gang_data);
       ?>
       <div id="<?php echo $ir['gang']?>" class="chat_box gang <?php echo (isset($_COOKIE['chat_'.$ir['gang']]) && $_COOKIE['chat_'.$ir['gang']] == 'hidden' ? 'hidden' : (!isset($_COOKIE['chat_'.$ir['gang']]) && $chan['channel_open'] == 1 ? 'hidden' : 'open'))?>" <?php echo ($chat_count > 1 ? 'style="right: '.((($chat_count-1)*262)+20).'px;"' : '')?>
           <div class="chat_bar">
               <?php echo $g_data['gangNAME']?> Chat
           </div>
           <div class="chat_contents">

           </div>
           <div id="chat_input">
               <form action="#" onsubmit="sendChat('<?php echo $chan['channel_alias']?>');return false;">
                   <input type="text" name="<?php echo $chan['channel_alias']?>" class="chat_msg" />
               </form>
           </div>
       </div>
       <?php
   }
}
?>

 

All I know is error line 180

 

and [h=1]Results

Error: There is 1 more closing parenthesis ')' found[/h]

  • This count is unaware if parenthesis are inside of a string

 

Link to comment
Share on other sites

You had 2 partially opened div tags

<?php
if(!isset($set)) {
   $set = array();
   $settq = $db->query("SELECT `conf_name`, `conf_value` FROM `settings`");
   while($r = $db->fetch_row($settq))
       $set[$r['conf_name']] = $r['conf_value'];
}
?><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
   $('.chat_bar').click(function() {
       var this_ele = $(this);
       if($(this).parents('.chat_box').hasClass('hidden')) {
           $(this).parents('.hidden').animate({bottom: '0px'},500,function() {
               $('[name=' + this_ele.parents('.chat_box').attr('id') + ']').focus();
               updateShoutbox();
           }).addClass('open').removeClass('hidden');
           c_name = 'chat_' + $(this).parents('.chat_box').attr('id');
           document.cookie = c_name + "=open";
       } else {
           $(this).parents('.open').animate({bottom: '-320px'},500,function() {
               updateShoutbox();
           }).addClass('hidden').removeClass('open');
           c_name = 'chat_' + $(this).parents('.chat_box').attr('id');
           document.cookie = c_name + "=hidden";
       }
   });
   $('.chat_contents').click(function() {
       $('[name=' + $(this).parents('.chat_box').attr('id') + ']').focus();
   });
   $('.chat_form').each(function() {
       $(this).submit(function() {
           alert('test');
       });
   });
   updateShoutbox();
});
function scrollBottom() {
   $('.chat_box').each(function() {
       $(this).children('.chat_contents').scrollTop($(this).children('.chat_contents')[0].scrollHeight);
   });
}
function updateShoutbox() {
   $('.open').each(function() {
       var chat_box = $(this).children('.chat_contents');
       $.ajax({
           type: "POST",
           url: 'ajax_chat/chat_ajax.php',
           cache: false,
           data: "function=chat_box" + (
               chat_box.parents('.open').hasClass('gang')
                   ? '&gang=' + chat_box.parents('.open').attr('id')
                   : '&channel=' + $(this).attr('id')
           ),
           success: function(data) {
               chat_box.html(data);
               scrollBottom();
           }
       });
   });
}
function sendChat(channel_id) {
   var chat_field = $('[name=' + channel_id + ']');
   if(chat_field.val() != '' && chat_field.val() != ' ') {
   chat_field.attr('disabled',true);
       $.ajax({
           type: "POST",
           url: 'ajax_chat/chat_ajax.php',
           cache: false,
           data: "function=send_chat" + (
               chat_field.parents('.open').hasClass('gang')
                   ? '&gang=' + chat_field.parents('.open').attr('id')
                   : '&channel=' + channel_id
           ) + "&msg= " + chat_field.val(),
           success: function(data) {
               if(data == 1) {
                   updateShoutbox();
                   chat_field.val('');
                   chat_field.attr('disabled',false);
               } else {
                   alert('You\'re trying to post in a channel that either doesn\'t exist or your account does not have access to.');
                   chat_field.attr('disabled',false);
               }
           }
       });
   }
}
setInterval('updateShoutbox()',<?php echo $set['refresh_time']; ?>);
</script>
<link href="http://stillarider.com/css/game.css" type="text/css" rel="stylesheet" />
<!--[if IE]>
<style type="text/css">
.chat_box chat_input {
   margin-bottom: -20px;
}
</style>
<![endif]-->
<!--[if lt IE 7]>
<style type="text/css">
.chat_box {
   display: none;
}
</style>
<![endif]--><?php
// Make any changes to the system that is needed for the system to work.
$fields = array('top_bar','top_bar_hover','top_bar_text','top_bar_text_hover','chat_text','main_back','input_box','input_box_text','opacity','opacity_level','round_corners','round_corners_amount','box_shadow','channel_number','refresh_time','filter_words','new_words');
$values = array('bdbdbd','afafaf','000000','000000','000000','e2e2e2','bdbdbd','000000',1,0.8,1,5,1,1,2000,'****,cunt,****','****,****,****');
$count = 0;
foreach($fields as $f) {
   if(!isset($set[$f])) {
       $db->query("INSERT INTO `settings` (`conf_name`, `conf_value`) VALUES ('".$f."','".$values[$count]."')");
       ++$changed;
   }
   ++$count;
}
$table[] = "CREATE TABLE IF NOT EXISTS `chat_box` (
 `chat_id` int(11) NOT NULL AUTO_INCREMENT,
 `chat_user` int(11) NOT NULL,
 `chat_to` int(11) NOT NULL,
 `chat_text` varchar(255) NOT NULL,
 `chat_time` int(11) NOT NULL,
 `chat_channel` int(11) NOT NULL,
 `chat_gang` int(11) NOT NULL,
 PRIMARY KEY (`chat_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;";
$table[] = "CREATE TABLE IF NOT EXISTS `chat_channels` (
 `channel_id` int(11) NOT NULL AUTO_INCREMENT,
 `channel_alias` varchar(255) NOT NULL,
 `channel_name` varchar(255) NOT NULL,
 `channel_open` int(1) NOT NULL,
 `channel_req` text NOT NULL,
 PRIMARY KEY (`channel_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;";
foreach($table as $t) {
   $db->query($t) or exit('<b>MySQL Databse insertion error:</b><p>An error has occured when the system attempted to dump the various database information into the table. Please check the error below.<br />'.$db->error());
}
if(isset($changed))
   exit(header("Location: ".$_SERVER['PHP_SELF']));
// Make any changes to the system that is needed for the system to work.
$find_channels = $db->query("SELECT `channel_name`, `channel_id`, `channel_alias`, `channel_open`, `channel_req` FROM `chat_channels`");
if($db->num_rows($find_channels)) {
   $chat_count = 1;
   while($chan = $db->fetch_row($find_channels)) {
       $failed = 0;
       if($chan['channel_req']) {
           $privs = unserialize($chan['channel_req']);
           foreach($privs as $p) {
               $check_priv = $db->query("SELECT `userid` FROM `users` WHERE `".$db->escape($p[0])."` ".$db->escape($p[1])." '".$db->escape($p[2])."' AND `userid` = ".$userid);
               if(!$db->num_rows($check_priv))
                   $failed = 1;
           }
       }
       if($failed < 1) {
           ?>
           <div id="<?php echo $chan['channel_alias'];?>" class="chat_box<?php
               echo (isset($_COOKIE['chat_'.$chan['channel_alias']]) && $_COOKIE['chat_'.$chan['channel_alias']] == 'hidden'
                   ? ' hidden'
                   : (!isset($_COOKIE['chat_'.$chan['channel_alias']]) && $chan['channel_open'] == 1
                       ? ' hidden'
                       : ' open'
                   )
               );?>"<?php echo ($chat_count > 1 ? ' style="right: '.((($chat_count-1)*262)+20).'px;"' : '');?>>
               <div class="chat_bar"><?php
                   echo ($set['channel_number'] == 1 ? $chan['channel_id'].'.' : '').$chan['channel_name'];
               ?></div>
               <div class="chat_contents"></div>
               <div id="chat_input">
                   <form action="#" onsubmit="sendChat('<?php echo $chan['channel_alias'];?>');return false;">
                       <input type="text" name="<?php echo $chan['channel_alias'];?>" class="chat_msg" />
                   </form>
               </div>
           </div><?php
           ++$chat_count;
       }
   }
}
if(isset($ir['gang'])) {
   $gang_data = $db->query("SELECT `gangNAME` FROM `gangs` WHERE `gangID` = ".$ir['gang']);
   if($db->num_rows($gang_data)) {
       $g_data = $db->fetch_row($gang_data);
       ?><div id="<?php echo $ir['gang']?>" class="chat_box gang<?php echo (isset($_COOKIE['chat_'.$ir['gang']]) && $_COOKIE['chat_'.$ir['gang']] == 'hidden'
           ? ' hidden'
           : (!isset($_COOKIE['chat_'.$ir['gang']]) && $chan['channel_open'] == 1 ? ' hidden' : ' open')
       );?>"<?php echo ($chat_count > 1 ? ' style="right: '.((($chat_count-1)*262)+20).'px;"' : '');?>>
           <div class="chat_bar"><?php echo $g_data['gangNAME'];?> Chat</div>
           <div class="chat_contents"></div>
           <div id="chat_input">
               <form action="#" onsubmit="sendChat('<?php echo $chan['channel_alias'];?>');return false;">
                   <input type="text" name="<?php echo $chan['channel_alias'];?>" class="chat_msg" />
               </form>
           </div>
       </div><?php
   }
}
Link to comment
Share on other sites

Right, that's because PHP Code Checker (whilst being pretty decent), is struggling with the ternary-within-ternary statement..

The code *should* still run fine.

*If* you're still bothered about that issue, try changing lines 181 to 184 to this:

?><div id="<?php echo $ir['gang']?>" class="chat_box gang<?php echo isset($_COOKIE['chat_'.$ir['gang']]) && $_COOKIE['chat_'.$ir['gang']] == 'hidden'
           ? ' hidden'
           : (!isset($_COOKIE['chat_'.$ir['gang']]) && $chan['channel_open'] == 1 ? ' hidden' : ' open');?>"<?php echo ($chat_count > 1 ? ' style="right: '.((($chat_count-1)*262)+20).'px;"' : '');?>>
           <div class="chat_bar"><?php echo $g_data['gangNAME'];?> Chat</div>
Link to comment
Share on other sites

Thought I'd post the most recent

 

<?php
if(!isset($set)) {
   $set=array();
   $settq=$db->query("SELECT * FROM settings");
   while($r=$db->fetch_row($settq)) {
       $set[$r['conf_name']]=$r['conf_value'];
   }    
}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
   $('.chat_bar').click(function() {
       var this_ele = $(this);
       if($(this).parents('.chat_box').hasClass('hidden')) {
           $(this).parents('.hidden').animate({bottom: '0px'},500,function() { $('[name=' + this_ele.parents('.chat_box').attr('id') + ']').focus();updateShoutbox(); }).addClass('open').removeClass('hidden');
           c_name = 'chat_' + $(this).parents('.chat_box').attr('id');
           document.cookie=c_name + "=open";
       } else {
           $(this).parents('.open').animate({bottom: '-320px'},500,function() { updateShoutbox(); }).addClass('hidden').removeClass('open');    
           c_name = 'chat_' + $(this).parents('.chat_box').attr('id');
           document.cookie=c_name + "=hidden";
       }
   });
   $('.chat_contents').click(function() {
       $('[name=' + $(this).parents('.chat_box').attr('id') + ']').focus();
   });
   $('.chat_form').each(function() {
       $(this).submit(function() {
           alert('test');
       });
   });
   updateShoutbox();
});
function scrollBottom() {
   $('.chat_box').each(function() {
       $(this).children('.chat_contents').scrollTop($(this).children('.chat_contents')[0].scrollHeight);
   });    
}
function updateShoutbox() {
   $('.open').each(function() {
       var chat_box = $(this).children('.chat_contents');

       $.ajax({
           type: "POST",
           url: 'ajax_chat/chat_ajax.php',
           cache: false,
           data: "function=chat_box" + (chat_box.parents('.open').hasClass('gang') ? '&gang=' + chat_box.parents('.open').attr('id') : '&channel=' + $(this).attr('id')),
           success: function(data) {
               chat_box.html(data);
               scrollBottom();
           }
       });
   });
}
function sendChat(channel_id) {
   var chat_field = $('[name=' + channel_id + ']');
   if(chat_field.val() != '' && chat_field.val() != ' ') {
   chat_field.attr('disabled',true);
       $.ajax({
           type: "POST",
           url: 'ajax_chat/chat_ajax.php',
           cache: false,
           data: "function=send_chat" + (chat_field.parents('.open').hasClass('gang') ? '&gang=' + chat_field.parents('.open').attr('id') : '&channel=' + channel_id) + "&msg= " + chat_field.val(),
           success: function(data) {
               if(data == 1) {
                   updateShoutbox();
                   chat_field.val('');
                   chat_field.attr('disabled',false);
               } else {
                   alert('You\'re trying to post in a channel that either dosen\'t exist or your account does not have access to.');
                   chat_field.attr('disabled',false);    
               }
           }
       });
   }
}
setInterval('updateShoutbox()',<?php echo $set['refresh_time']; ?>);
</script>
<style type="text/css">
.chat_box {
   background: #<?php echo $set['main_back']; ?>;
   color: #<?php echo $set['chat_text']; ?>;
   position: fixed;
   right: 20px;
   bottom: 0px;
   width: 240px;
   height: 350px;    
   <?php echo ($set['opacity'] == 1 ? 'opacity: '.$set['opacity_level'].';' : '')?>
   <?
   if($set['round_corners'] == 1) {
   ?>
   -webkit-border-top-left-radius: <?php echo $set['round_corners_amount']; ?>px;
   -webkit-border-top-right-radius: <?php echo $set['round_corners_amount']; ?>px;
   -moz-border-radius-topleft: <?php echo $set['round_corners_amount']; ?>px;
   -moz-border-radius-topright: <?php echo $set['round_corners_amount']; ?>px;
   border-top-left-radius: <?php echo $set['round_corners_amount']; ?>px;
   border-top-right-radius: <?php echo $set['round_corners_amount']; ?>px;
   <?
   }
   if($set['box_shadow'] == 1) {
   ?>
   -moz-box-shadow: 0px 0px 10px #888;
   -webkit-box-shadow: 0px 0px 10px #888;
   box-shadow: 0px 0px 10px #888;
   <?
   }
   ?>
}
.chat_box:hover {
   opacity: 1;    
}
.chat_box .chat_bar {
   position: absolute;
   top: 0px;
   left: 0px;
   right: 0px;
   padding: 9px;
   background: #<?php echo $set['top_bar']?>;
   color: #<?php echo $set['top_bar_text']?>;
   text-align: left;
   <?
   if($set['round_corners'] == 1) {
   ?>
   -webkit-border-top-left-radius: <?php echo $set['round_corners_amount']; ?>px;
   -webkit-border-top-right-radius: <?php echo $set['round_corners_amount']; ?>px;
   -moz-border-radius-topleft: <?php echo $set['round_corners_amount']; ?>px;
   -moz-border-radius-topright: <?php echo $set['round_corners_amount']; ?>px;
   border-top-left-radius: <?php echo $set['round_corners_amount']; ?>px;
   border-top-right-radius: <?php echo $set['round_corners_amount']; ?>px;
   <?
   }
   ?>    
}
.chat_box .chat_bar:hover {
   background: #<?php echo $set['top_bar_hover']; ?>;    
   color: #<?php echo $set['top_bar_text_hover']; ?>;
   cursor: pointer;
}
.chat_box .chat_contents {
   position: absolute;
   overflow-y: scroll;
   left: 6px;
   right: 6px;
   top: 40px;    
   text-align: left;
   height: 270px;
}
.chat_box .chat_contents #line {
   display: block;    
   padding: 3px;
}
.chat_box .chat_contents span #time {
   font-size: 8px;    
}
.chat_box #chat_input {
   position: absolute;
   bottom: 0;    
   left: 0;
   right: 0;
   padding: 3px;
}
.chat_box #chat_input input {
   width: 95%;
   border: none;    
   padding: 5px;
   background: #<?php echo $set['input_box']; ?>;
   color: #<?php echo $set['input_box_text']; ?>;
}
.hidden {
   bottom: -320px;    
}
</style>
<!--[if IE]>
<style type="text/css">
.chat_box #chat_input {
   margin-bottom: -20px;
}
</style>
<![endif]-->
<!--[if lt IE 7]>
<style type="text/css">
.chat_box {
   display: none;
}
</style>
<![endif]-->
<?php

// Make any changes to the system that is needed for the system to work.
$fields = array('top_bar','top_bar_hover','top_bar_text','top_bar_text_hover','chat_text','main_back','input_box','input_box_text','opacity','opacity_level','round_corners','round_corners_amount','box_shadow','channel_number','refresh_time','filter_words','new_words');
$values = array('bdbdbd','afafaf','000000','000000','000000','e2e2e2','bdbdbd','000000',1,0.8,1,5,1,1,2000,'shit,cunt,fuck','****,****,****');

$count = 0;
foreach($fields as $f) {
   if(!isset($set[$f])) {
       $db->query("INSERT INTO settings (conf_name,conf_value) VALUES('".$f."','".$values[$count]."')");
       ++$changed;
   }
   ++$count;
}

$table[] = "CREATE TABLE IF NOT EXISTS `chat_box` (
 `chat_id` int(11) NOT NULL AUTO_INCREMENT,
 `chat_user` int(11) NOT NULL,
 `chat_to` int(11) NOT NULL,
 `chat_text` varchar(255) NOT NULL,
 `chat_time` int(11) NOT NULL,
 `chat_channel` int(11) NOT NULL,
 `chat_gang` int(11) NOT NULL,
 PRIMARY KEY (`chat_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;";

$table[] = "CREATE TABLE IF NOT EXISTS `chat_channels` (
 `channel_id` int(11) NOT NULL AUTO_INCREMENT,
 `channel_alias` varchar(255) NOT NULL,
 `channel_name` varchar(255) NOT NULL,
 `channel_open` int(1) NOT NULL,
 `channel_req` text NOT NULL,
 PRIMARY KEY (`channel_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;";

foreach($table as $t) {
   $db->query($t) or die('<b>MySQL Databse insertion error:</b><p>An error has occured when the system attempted to dump the various database information into the table. Please check the error below.<br />'.mysql_error());    
}
if(isset($changed)) {
   header("Location: ".$_SERVER['PHP_SELF']);    
   exit;
}
// Make any changes to the system that is needed for the system to work.

$find_channels = $db->query("SELECT channel_name, channel_id, channel_alias, channel_open, channel_req FROM chat_channels");
if($db->num_rows($find_channels)) {
   $chat_count = 1;
   while($chan = $db->fetch_row($find_channels)) {
       $failed = 0;
       if($chan['channel_req']) {
           $privs = unserialize($chan['channel_req']);
           foreach($privs as $p) {
               $check_priv = $db->query("SELECT userid FROM users WHERE `".mysql_real_escape_string($p[0])."` ".mysql_real_escape_string($p[1])." '".mysql_real_escape_string($p[2])."' AND userid = ".$userid);
               if(!$db->num_rows($check_priv)) {
                   $failed = 1;
               }
           }
       }
       if($failed < 1) {
           ?>
           <div id="<?php echo $chan['channel_alias']?>" class="chat_box <?php echo (isset($_COOKIE['chat_'.$chan['channel_alias']]) && $_COOKIE['chat_'.$chan['channel_alias']] == 'hidden' ? ' hidden' : (!isset($_COOKIE['chat_'.$chan['channel_alias']]) && $chan['channel_open'] == 1 ? ' hidden' : ' open'))?>" <?php echo ($chat_count > 1 ? 'style="right: '.((($chat_count-1)*262)+20).'px;"' : '')?>>
               <div class="chat_bar">
                   <?php echo ($set['channel_number'] == 1 ? $chan['channel_id'].'.' : '')?> <?php echo $chan['channel_name']?>
               </div>
               <div class="chat_contents">

               </div>
               <div id="chat_input">
                   <form action="#" onsubmit="sendChat('<?php echo $chan['channel_alias']?>');return false;">
                       <input type="text" name="<?php echo $chan['channel_alias']?>" class="chat_msg" />
                   </form>
               </div>
           </div>
           <?php
           ++$chat_count;    
       }
   }
}
if(isset($ir['gang'])) {

   $gang_data = $db->query("SELECT gangNAME FROM gangs WHERE gangID = ".$ir['gang']);
   if($db->num_rows($gang_data)) {
       $g_data = $db->fetch_row($gang_data);
       ?>
       <div id="<?php echo $ir['gang']?>" class="chat_box gang <?php echo (isset($_COOKIE['chat_'.$ir['gang']]) && $_COOKIE['chat_'.$ir['gang']] == 'hidden' ? ' hidden' : (!isset($_COOKIE['chat_'.$ir['gang']]) && $chan['channel_open'] == 1 ? ' hidden' : ' open'))?>" <?php echo ($chat_count > 1 ? 'style="right: '.((($chat_count-1)*262)+20).'px;"' : '')?>>
           <div class="chat_bar">
               <?php echo $g_data['gangNAME']?> Chat
           </div>
           <div class="chat_contents">

           </div>
           <div id="chat_input">
               <form action="#" onsubmit="sendChat('<?php echo $chan['channel_alias']?>');return false;">
                   <input type="text" name="<?php echo $chan['channel_alias']?>" class="chat_msg" />
               </form>
           </div>
       </div>
       <?php
   }
}
?>

[h=1]Results[/h]

  • Error: There is 1 more closing parenthesis ')' found
    This count is unaware if parenthesis are inside of a string
  • Warning: There are 2 lines with a possible typo in a php code declaration:
    • ?>>
    • ?>>

    [*]Warning: There are 2 functions in your code that have been deprecated in the current version of PHP :

     

Onsite the lined executed fail is 272

Link to comment
Share on other sites

have you got this on a live site where i can see whats going on.

I have made the code a little more readable, i have not tested this so tehre could still be errors

<?php
   if(!isset($set)) {
       $set=array();
       $settq=$db->query("SELECT * FROM settings");
       while($r=$db->fetch_row($settq)) {
           $set[$r['conf_name']]=$r['conf_value'];
       }    
   }
echo '
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
   $(".chat_bar").click(function() {
       var this_ele = $(this);
       if($(this).parents(".chat_box").hasClass("hidden")) {
           $(this).parents(".hidden").animate({bottom: "0px"},500,function() { $("[name=" + this_ele.parents(".chat_box").attr("id") + "]").focus();updateShoutbox(); }).addClass("open").removeClass("hidden");
           c_name = "chat_" + $(this).parents(".chat_box").attr("id");
           document.cookie=c_name + "=open";
       } else {
           $(this).parents(".open").animate({bottom: "-320px"},500,function() { updateShoutbox(); }).addClass("hidden").removeClass("open");    
           c_name = "chat_" + $(this).parents(".chat_box").attr("id");
           document.cookie=c_name + "=hidden";
       }
   });
   $(".chat_contents").click(function() {
       $("[name=" + $(this).parents(".chat_box").attr("id") + "]").focus();
   });
   $(".chat_form").each(function() {
       $(this).submit(function() {
           alert("test");
       });
   });
   updateShoutbox();
});
function scrollBottom() {
   $(".chat_box").each(function() {
       $(this).children(".chat_contents").scrollTop($(this).children(".chat_contents")[0].scrollHeight);
   });    
}
function updateShoutbox() {
   $(".open").each(function() {
       var chat_box = $(this).children(".chat_contents");

       $.ajax({
           type: "POST",
           url: "ajax_chat/chat_ajax.php",
           cache: false,
           data: "function=chat_box" + (chat_box.parents(".open").hasClass("gang") ? "&gang=" + chat_box.parents(".open").attr("id") : "&channel=" + $(this).attr("id")),
           success: function(data) {
               chat_box.html(data);
               scrollBottom();
           }
       });
   });
}
function sendChat(channel_id) {
   var chat_field = $("[name=" + channel_id + "]");
   if(chat_field.val() != "" && chat_field.val() != " ") {
   chat_field.attr("disabled",true);
       $.ajax({
           type: "POST",
           url: "ajax_chat/chat_ajax.php",
           cache: false,
           data: "function=send_chat" + (chat_field.parents(".open").hasClass("gang") ? "&gang=" + chat_field.parents(".open").attr("id") : "&channel=" + channel_id) + "&msg= " + chat_field.val(),
           success: function(data) {
               if(data == 1) {
                   updateShoutbox();
                   chat_field.val("");
                   chat_field.attr("disabled",false);
               } else {
                   alert("You\'re trying to post in a channel that either dosen\'t exist or your account does not have access to.");
                   chat_field.attr("disabled",false);    
               }
           }
       });
   }
}
setInterval("updateShoutbox()",'.$set['refresh_time'].');
</script>
<style type="text/css">
.chat_box {
   background: #'.$set['main_back'].';
   color: #'.$set['chat_text'].';
   position: fixed;
   right: 20px;
   bottom: 0px;
   width: 240px;
   height: 350px;    
   '.($set['opacity'] == 1 ? 'opacity: '.$set['opacity_level'].'' : '');

   if($set['round_corners'] == 1) {
       echo '-webkit-border-top-left-radius: '.$set['round_corners_amount'].'px;
       -webkit-border-top-right-radius: '.$set['round_corners_amount'].'px;
       -moz-border-radius-topleft: '.$set['round_corners_amount'].'px;
       -moz-border-radius-topright: '.$set['round_corners_amount'].'px;
       border-top-left-radius: '.$set['round_corners_amount'].'px;
       border-top-right-radius: '.$set['round_corners_amount'].'px'; 
   }

   if($set['box_shadow'] == 1) {
       echo '-moz-box-shadow: 0px 0px 10px #888;
       -webkit-box-shadow: 0px 0px 10px #888;
       box-shadow: 0px 0px 10px #888';
   }

echo '}
.chat_box:hover {
   opacity: 1;    
}
.chat_box .chat_bar {
   position: absolute;
   top: 0px;
   left: 0px;
   right: 0px;
   padding: 9px;
   background: #'.$set['top_bar'].';
   color: #'.$set['top_bar_text'].';
   text-align: left';

   if($set['round_corners'] == 1) {
       echo '-webkit-border-top-left-radius: '.$set['round_corners_amount'].'px;
       -webkit-border-top-right-radius: '.$set['round_corners_amount'].'px;
       -moz-border-radius-topleft: '.$set['round_corners_amount'].'px;
       -moz-border-radius-topright: '.$set['round_corners_amount'].'px;
       border-top-left-radius: '.$set['round_corners_amount'].'px;
       border-top-right-radius: '.$set['round_corners_amount'].'px';
   }

echo '}
.chat_box .chat_bar:hover {
   background: #'.$set['top_bar_hover'];.';    
   color: #'.$set['top_bar_text_hover'];.';
   cursor: pointer;
}
.chat_box .chat_contents {
   position: absolute;
   overflow-y: scroll;
   left: 6px;
   right: 6px;
   top: 40px;    
   text-align: left;
   height: 270px;
}
.chat_box .chat_contents #line {
   display: block;    
   padding: 3px;
}
.chat_box .chat_contents span #time {
   font-size: 8px;    
}
.chat_box #chat_input {
   position: absolute;
   bottom: 0;    
   left: 0;
   right: 0;
   padding: 3px;
}
.chat_box #chat_input input {
   width: 95%;
   border: none;    
   padding: 5px;
   background: #'.$set['input_box'].'; 
   color: #'.$set['input_box_text'].'; 
}
.hidden {
   bottom: -320px;    
}
</style>
<!--[if IE]>
<style type="text/css">
.chat_box #chat_input {
   margin-bottom: -20px;
}
</style>
<![endif]-->
<!--[if lt IE 7]>
<style type="text/css">
.chat_box {
   display: none;
}
</style>
<![endif]-->';

   // Make any changes to the system that is needed for the system to work.
   $fields = array('top_bar','top_bar_hover','top_bar_text','top_bar_text_hover','chat_text','main_back','input_box','input_box_text','opacity','opacity_level','round_corners','round_corners_amount','box_shadow','channel_number','refresh_time','filter_words','new_words');
   $values = array('bdbdbd','afafaf','000000','000000','000000','e2e2e2','bdbdbd','000000',1,0.8,1,5,1,1,2000,'****,cunt,****','****,****,****');

   $count = 0;
   foreach($fields as $f) {
       if(!isset($set[$f])) {
           $db->query("INSERT INTO settings (conf_name,conf_value) VALUES('".$f."','".$values[$count]."')");
           ++$changed;
       }
       ++$count;
   }

   $table[] = "CREATE TABLE IF NOT EXISTS `chat_box` (
     `chat_id` int(11) NOT NULL AUTO_INCREMENT,
     `chat_user` int(11) NOT NULL,
     `chat_to` int(11) NOT NULL,
     `chat_text` varchar(255) NOT NULL,
     `chat_time` int(11) NOT NULL,
     `chat_channel` int(11) NOT NULL,
     `chat_gang` int(11) NOT NULL,
     PRIMARY KEY (`chat_id`)
   ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;";

   $table[] = "CREATE TABLE IF NOT EXISTS `chat_channels` (
     `channel_id` int(11) NOT NULL AUTO_INCREMENT,
     `channel_alias` varchar(255) NOT NULL,
     `channel_name` varchar(255) NOT NULL,
     `channel_open` int(1) NOT NULL,
     `channel_req` text NOT NULL,
     PRIMARY KEY (`channel_id`)
   ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;";

   foreach($table as $t) {
       $db->query($t) or die('<b>MySQL Databse insertion error:</b><p>An error has occured when the system attempted to dump the various database information into the table. Please check the error below.<br />'.mysql_error());    
   }
   if(isset($changed)) {
       header("Location: ".$_SERVER['PHP_SELF']);    
       exit;
   }
   // Make any changes to the system that is needed for the system to work.

   $find_channels = $db->query("SELECT channel_name, channel_id, channel_alias, channel_open, channel_req FROM chat_channels");
   if($db->num_rows($find_channels)) {
       $chat_count = 1;
       while($chan = $db->fetch_row($find_channels)) {
           $failed = 0;
           if($chan['channel_req']) {
               $privs = unserialize($chan['channel_req']);
               foreach($privs as $p) {
                   $check_priv = $db->query("SELECT userid FROM users WHERE `".mysql_real_escape_string($p[0])."` ".mysql_real_escape_string($p[1])." '".mysql_real_escape_string($p[2])."' AND userid = ".$userid);
                   if(!$db->num_rows($check_priv)) {
                       $failed = 1;
                   }
               }
           }
           if($failed < 1) {

               $hiddenChatBox = (
                   (isset($_COOKIE['chat_'.$chan['channel_alias']]) && $_COOKIE['chat_'.$chan['channel_alias']] == 'hidden') ? ' hidden' : (
                       (!isset($_COOKIE['chat_'.$chan['channel_alias']]) && $chan['channel_open'] == 1) ? ' hidden' : ' open'
                   )
               );

               echo '<div id="'.$chan['channel_alias'].'" class="chat_box '.$hiddenChatBox.'" '.($chat_count > 1 ? 'style="right: '.((($chat_count-1)*262)+20).'px;"' : '').'
                   <div class="chat_bar">
                       '.($set['channel_number'] == 1 ? $chan['channel_id'].'.' : '').' '.$chan['channel_name'].'
                   </div>
                   <div class="chat_contents">

                   </div>
                   <div id="chat_input">
                       <form action="#" onsubmit="sendChat(\''.$chan['channel_alias'].'\');return false;">
                           <input type="text" name="'.$chan['channel_alias'].'" class="chat_msg" />
                       </form>
                   </div>
               </div>';
               ++$chat_count;    
           }
       }
   }
   if(isset($ir['gang'])) {

       $gang_data = $db->query("SELECT gangNAME FROM gangs WHERE gangID = ".$ir['gang']);
       if($db->num_rows($gang_data)) {
           $g_data = $db->fetch_row($gang_data);

           echo '
               <div id="'.$ir['gang'].'" class="chat_box gang '.(isset($_COOKIE['chat_'.$ir['gang']]) && $_COOKIE['chat_'.$ir['gang']] == 'hidden' ? ' hidden' : (!isset($_COOKIE['chat_'.$ir['gang']]) && $chan['channel_open'] == 1 ? ' hidden' : ' open')).'" '.($chat_count > 1 ? 'style="right: '.((($chat_count-1)*262)+20).'px;"' : '').'
                   <div class="chat_bar">
                       '.$g_data['gangNAME'].' Chat
                   </div>
                   <div class="chat_contents">

                   </div>
                   <div id="chat_input">
                       <form action="#" onsubmit="sendChat(\''.$chan['channel_alias'].'\');return false;">
                           <input type="text" name="'.$chan['channel_alias'].'" class="chat_msg" />
                       </form>
                   </div>
               </div>
           ';
       }
   }
?>
Link to comment
Share on other sites

Hey Chris, I haven't had a response from you on Google Talk since the 10th May.

Did you manage to try out the latest version I had sent you over Dropbox? If not I'm happy to jump on this and resolve it for you. Apologies that you haven't felt supported through this issue.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...