Jump to content
MakeWebGames

boionfire81

Members
  • Posts

    532
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by boionfire81

  1. I found this code https://codepen.io/hackfin/pen/fyKHx I'd like to implement it instead of a pagination. Is that possible to limit results to 10 results per "wrapper"
  2. <?php require_once('globals.php'); if($ir['jail'] == 0 && $ir['hospital'] == 0) { include ('access.php'); } global $ir,$db,$h; if(!$ir['gang']) { echo "You're not in a Gang."; $h->endpage(); } $gq = $db->query("SELECT `g`.*, `oc`.*, `gs`.* FROM `gangs` AS `g` LEFT JOIN `orgcrimes` AS `oc` ON `g`.`gangCRIME` = `oc`.`ocID` LEFT JOIN `gang_settings` AS `gs` ON `gs`.`gangid` = `g`.`gangID` WHERE `g`.`gangID` = {$ir['gang']}"); if(!$db->num_rows($gq)) { $db->query("UPDATE `users` SET `gang` = 0 WHERE `gang` = {$ir['gang']}"); echo "Your Gang doesn't exist"; $h->endpage(); } else { $requireSettings = true; $gangdata = $db->fetch_row($gq); $gpdata = $db->query("SELECT `username`, `userid` FROM `users` WHERE `userid` = {$gangdata['gangPRESIDENT']}"); $gvpdata = $db->query("SELECT `username`, `userid` FROM `users` WHERE `userid` = {$gangdata['gangVICEPRES']}"); $pres=$db->fetch_row($gpdata); $vicepres=$db->fetch_row($gvpdata); $gmem = $db->query("SELECT `userid`, `username`, `level`, `daysingang` FROM `users` WHERE `gang` = {$gangdata['gangID']} ORDER BY `daysingang` DESC, `level` DESC"); $gmembers=$db->fetch_row($gmem); $memcount=$db->num_rows($gmem); echo "<h3><a href='gang.php'> {$gangdata['gangNAME']}</a></h3>"; if($requireSettings) if(empty($gangdata['armoury_is_closed']) && (!isset($_GET['act2']) || $_GET['act2'] != 'editarmoury')){ echo " {$pres['username']} <strong>must</strong> set up the Gang armoury before you can access this.<br />"; if($gangdata['gangPRESIDENT'] == $ir['userid']) { echo "This can be done <a href='gang.php?action=staff&act2=editarmoury'>here</a><br />";} } $wq = $db->query("SELECT COUNT(`warID`) FROM `gangwars` WHERE `warDECLARER` = ".$ir['gang']." OR `warDECLARED` = ".$ir['gang']); if($db->fetch_single($wq)) { echo "<hr /><h3><a href='gang.php?action=warview' style='color: red;'>Your Gang is currently in {$wq} war's($db->fetch_single($wq))</a></h3><hr />"; } $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; switch($_GET['action']) { case "idx": gang_index(); break; case "summary": gang_summary(); break; case "members": gang_memberlist(); break; case "kick": gang_staff_kick(); break; case "donate": gang_donate(); break; case "donate2": gang_donate2(); break; case "warview": gang_warview(); break; case "staff": gang_staff(); break; case "leave": gang_leave(); break; case "atklogs": gang_atklogs(); break; case "crimes": gang_crimes(); break; case "forums": gang_forums(); break; case 'viewarmoury': gang_view_armoury(); break; case 'borrowitem': gang_borrow_item(); break; case 'donateitem': gang_donate_item(); break; default: gang_index(); break; } function gang_index() { global $db, $ir, $userid, $gangdata, $mtg, $gangs; $selectEvents = $db->query("SELECT `gevTIME`, `gevTEXT` FROM `gangevents` WHERE `gevGANG` = ".$ir['gang']." ORDER BY `gevTIME` DESC LIMIT 10");   has to be something to do with the else statement as it didn't happen prior. I can remove the else, but that leaves me back to the op. code checking now.
  3. ok added the else, and it kills the mysql error for noobs, but gang members see Fatal error: Uncaught Error: Call to undefined function gang_index()
  4. still have the same error.
  5. ok, php code check said no errors found. But yet the page displays an error.   <?php require_once('globals.php'); if($ir['jail'] == 0 && $ir['hospital'] == 0) { include ('access.php'); } global $ir,$db,$h; if($ir['gang'] == 0) { echo "You're not in a Gang."; $h->endpage(); } $requireSettings = true; $gq = $db->query("SELECT `g`.*, `oc`.*, `gs`.* " . "FROM `gangs` AS `g` " . "LEFT JOIN `orgcrimes` AS `oc` ON (`g`.`gangCRIME` = `oc`.`ocID`) " . "LEFT JOIN `gang_settings` AS `gs` ON (`gs`.`gangid` = `g`.`gangID`) " . "WHERE `g`.`gangID` = ".$ir['gang']); if(!$db->num_rows($gq)) { $db->query("UPDATE `users` SET `gang` = 0 WHERE `gang` = ".$ir['gang']); echo "Your Gang doesn't exist"; } $gangdata = $db->fetch_row($gq); $gpdata = $db->query("SELECT `username`, `userid` FROM `users` WHERE `userid` = {$gangdata['gangPRESIDENT']}"); $gvpdata = $db->query("SELECT `username`, `userid` FROM `users` WHERE `userid` = {$gangdata['gangVICEPRES']}");   ERROR is A critical error has occurred, and page execution has stopped. Below are the details: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Action taken: Attempted to execute query: SELECT `username`, `userid` FROM `users` WHERE `userid` = stopped code at the only 2 matching sqls. The gangdata would not apply, which would cause the error for noobs (as in this case). HOWEVER, the ir gang = 0 isn't working I'm guessing?
  6. ty found another error with it not recognizing the gangpresident, but fixed and it's good. Nice mod btw!
  7. Ok so staff can create an item and it's displayed and active on staff side. But on user end nothing appears. The rows = 0 doesn't show, nor any item. It ends at the table header. Everything is saved in the database, and phpcodecheck.com says no errors.   function create_item() { global $ir,$userid,$db,$h; print" <table border=1 width=85%> <tr> <th colspan=4><center>Here Are The Items You Can Currently Create</center></th> </tr> <tr> <th width=30%>Item Name</th> <th width=30%>Requirements</th> <th width=30%>Cost(s)</th> <th width=10%>---</th> </tr>"; $level=$ir['level']; $ddays=$ir['donatordays']; $daysold=$ir['daysold']; $blah=$db->query("SELECT * FROM workshop WHERE wACTIVE=1 AND wLEVEL<=$level AND wDONATOR<=$ddays AND wDAYSOLD<=$daysold ORDER BY wITEM ASC"); if($db->fetch_row($blah) == 0) { print" <tr> <td colspan=4><center>There are currently no items available for you to create!</center></td> </tr>"; } else { while($ws=$db->fetch_row($blah)) { $lso=$db->query("SELECT * FROM items WHERE itmid={$ws['wITEM']}"); $item=$db->fetch_row($lso); if($ws['wCRYSTALS'] > 0){ $crystals="<br>{$ws['wCRYSTALS']} Crystals";}else{ $crystals="";} if($ws['wCOST'] > 0){ $cost="<br>\${$ws['wCOST']}";}else{ $cost="";} if($ws['wDAYSOLD'] > 0){ $daysold="<br>{$ws['wDAYSOLD']} Days Old";}else{ $daysold="";} if($ws['wLEVEL'] > 1){ $level="<br>Level {$ws['wLEVEL']}";}else{ $level="";} if($ws['wDONATOR'] > 0){ $donator="<br>{$ws['wDONATOR']} Donator Days";}else{ $donator="";} echo " <tr> <td>{$item['itmname']}</td> <td><center> $level $daysold $donator</center> <ul>"; $lrd=$db->query("SELECT * FROM coursesneeded WHERE cnID={$ws['wITEM']}"); while($cneeded=$db->fetch_row($lrd)) { $luo=$db->query("SELECT * FROM courses WHERE crID={$cneeded['cnCOURSE']}"); $course=$db->fetch_row($luo); echo "<li><a href=education.php><font size=1>{$course['crNAME']} Course</font></a></li>"; } echo "</ul></td> <td><center>$cost$crystals</center> <ul>"; $lsd=$db->query("SELECT * FROM itemsneeded WHERE nID={$ws['wITEM']}"); while($needed=$db->fetch_row($lsd)) { $lso=$db->query("SELECT * FROM items WHERE itmid={$needed['nITEM']}"); $item=$db->fetch_row($lso); print"<li><a href=iteminfo.php?ID={$item['itmid']}><font size=1>{$item['itmname']}</font></a></li>"; } print"</ul></td> <td><center><a href=workshop.php?action=cconfirm&ID={$ws['wITEM']}>Create This Item</a></center></td> </tr>"; } } echo " </table>"; }
  8. [uSER=52003]Dave Macaulay[/uSER] no problem. And yes, the first post is the result of the mod you sent through dropbox.
  9. Undefined variable: chat_count 272 Undefined variable: chan 280/281
  10. [uSER=64684]Dayo[/uSER] any ideas?
  11. 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 : mysql_error() mysql_real_escape_string()   Onsite the lined executed fail is 272
  12. wrong fields? A critical error has occurred, and page execution has stopped. Below are the details: 1054: Unknown column 'cityid' in 'where clause' Action taken: Attempted to execute query: UPDATE `citypayments` SET `earnings` = `earnings` + 0.75 WHERE `userid` = 1 AND `cityid` = 1 AND `cowner` = 1
  13. I've messaged [uSER=52003]Dave Macaulay[/uSER] several times since I bought the mod months ago. Yet, it still, does not work. Thought maybe someone here could help.
  14. Ok now the error is on 183. I can't *not* be bothered by it when it wont work at all. displays, but no typing is allowed.
  15. missing sql for citypayments
  16. now it says line 184 and the same error in phpcodechecker.com
  17. <?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  
  18. boionfire81

    for each

    Perfect! worked like a charm :) ty!
  19. boionfire81

    for each

    ok but say the table is items, the column itemstock using that logic every item would get the same value on update. That's the issue I'm having. And being as this theory will be applied to several similar cases it's something has to be figured out how to do without running thousands of queries.
  20. boionfire81

    for each

    yes but if I run   $db->query("UPDATE `table` SET `column`=rand(100,900)");   every single entry gets the same update. Say it's stores inventory. Every item gets set to the exact same number of stock. Say it's "lucky chances" every player would get the exact same thing. How can I run a cron where each row/column would get it's own individual value?
  21. boionfire81

    for each

    is it possible to make a cron where each row can be assigned a random number value of it's own?
  22. ok, I've basically combined all of [uSER=56427]illusions[/uSER] school mods and have this:   <?php include "globals.php"; $_GET['cstart'] = isset($_GET['cstart']) && ctype_digit($_GET['cstart']) ? $_GET['cstart'] : null; if($ir['course'] > 0) { $cd=$db->query("SELECT * FROM courses WHERE crID={$ir['course']}"); $coud=$db->fetch_row($cd); print " You are currently attending the {$coud['crNAME']}</h1> course, you have {$ir['cdays']} days remaining."; } else { if($_GET['cstart']) { $_GET['cstart'] = abs((int) $_GET['cstart']); //Verify. $cd=$db->query("SELECT * FROM courses WHERE crID={$_GET['cstart']}"); if($db->num_rows($cd) == 0) { print "You are trying to start a course that is no longer available."; } else { $coud=$db->fetch_row($cd); $cdo=$db->query("SELECT * FROM coursesdone WHERE userid=$userid AND courseid={$_GET['cstart']}"); if($ir['money'] < $coud['crCOST']) { print " This course costs <font color='red'>" . money_formatter($coud['crCOST']) . "</font> to enroll. "; $h->endpage(); exit; } if($ir['crystals'] < $coud['crCRYSTALS']) { print " This course costs <font color='red'>" . number_format($coud['crCRYSTALS']) . "</font> credits to enroll. "; $h->endpage(); exit; } if($db->num_rows($cdo) > 0) { print " <font color='red'>You have already completed this course.</font> "; $h->endpage(); exit; } $db->query("UPDATE users SET course={$_GET['cstart']},cdays={$coud['crDAYS']},cclicks={$coud['crCLICKS']},money=money-{$coud['crCOST']},crystals=crystals-{$coud['crCRYSTALS']} WHERE userid=$userid"); print " You have enrolled in <font color='green'>{$coud['crNAME']}</font>. <br><br>This course requires"; if($coud['crCLICKS'] > 0) { echo" you to attend {$coud['crCLICKS']} classes. This means showing up and signing the attendance log. Classes start every hour, on the hour."; } if($coud['crCLICKS'] > 0 && $coud['crDAYS'] > 0) { echo "In addition,"; } if($coud['crDAYS'] > 0) { echo " {$coud['crDAYS']} days is the minimum amount of time estimated for completion of this course."; } echo "<br><br>Upon completion of {$coud['crNAME']} you will receive:<ul>"; if($coud['crSTR'] > 0) { echo "<li>{$coud['crSTR']} Strength"; } if($coud['crGUARD'] > 0) { echo "<li>{$coud['crGUARD']} Defense"; } if($coud['crLABOUR'] > 0) { echo "<li>{$coud['crLABOUR']} Reflex"; } if($coud['crAGIL'] > 0) { echo "<li>{$coud['crAGIL']} Speed"; } if($coud['crIQ'] > 0) { echo "<li>{$coud['crIQ']} IQ"; } if($coud['crCASHPRIZE'] > 0) { echo "<li>" . money_formatter($coud['crCASHPRIZE']) . ""; } if($coud['crITEM'] > 0) { $it=$db->query("SELECT itmname FROM items WHERE itmid={$coud['crITEM']}"); $itm=$db->fetch_row($it); echo "<li>{$itm['itmname']}"; if($coud['crQTY'] > 0) { echo " x {$coud['crQTY']}"; } } echo "</ul>"; } } print " <h1>Here is a list of available courses.</h1>"; $q=$db->query("SELECT * FROM courses"); print " <table width=75% cellspacing=1 class='table' border-color='#dedede'><tr style='background:gray;'><th>Course</th><th> Description</th><th> Cost</th><th> Credits</th><th> Take</th></tr>"; while($r=$db->fetch_row($q)) { $cdo=$db->query("SELECT * FROM coursesdone WHERE userid=$userid AND courseid={$r['crID']}"); if($db->num_rows($cdo)) { $do="<i>Done</i>"; } else { $do="<a href='education.php?cstart={$r['crID']}'>Take</a>"; } print " <tr><td>{$r['crNAME']}</td><td>{$r['crDESC']}</td><td>\${$r['crCOST']}</td><td> {$r['crCRYSTALS']}</td><td> $do</td></tr>"; } print "</table>"; } $h->endpage(); exit; print "<h3>Slave Traders Academy</h3>"; $cn=$db->query("SELECT taken FROM users WHERE userid=$userid"); $taken=$db->fetch_row($cn); if($taken['taken'] > 0) { die(" Your clicks have not been Renewed yet.. <h1> Sorry come back later</h1> Clicks Remaining,,,<h1>{$ir['cclicks']}</h1>"); } { if($ir['cclicks'] > 0) $ce=$db->query("SELECT cclicks='{$happy['cclicks']}' FROM users WHERE userid=$userid"); $happy=$db->fetch_row($ce); $cd=$db->query("SELECT * FROM courses WHERE crID={$ir['course']}"); $coud=$db->fetch_row($cd); $db->query("UPDATE users SET cclicks=cclicks-1 WHERE userid=$userid"); $db->query("UPDATE users SET taken=1 WHERE userid=$userid"); print " You currently have <h1>{$ir['cclicks']}</h1> CLICKS Left before this Tutition has completed. <a href='education.php'>Take This Tuition</a>"; $h->endpage(); exit; } $h->endpage(); ?> [/code] call this file [b]school_cron.php[/b] << This is to reset the clicks data [code]<?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $db->query("UPDATE users SET taken=0 WHERE course > 0"); $q=$db->query("SELECT * FROM users WHERE cclicks=0 AND course > 0"); while($r=$db->fetch_row($q)) { $cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}"); $coud=$db->fetch_row($cd); $userid=$r['userid']; $db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r['course']})"); $upd=""; $ev=""; if($coud['crSTR'] > 0) { $upd.=",us.strength=us.strength+{$coud['crSTR']}"; $ev.=", {$coud['crSTR']} strength"; } if($coud['crGUARD'] > 0) { $upd.=",us.guard=us.guard+{$coud['crGUARD']}"; $ev.=", {$coud['crGUARD']} guard"; } if($coud['crLABOUR'] > 0) { $upd.=",us.labour=us.labour+{$coud['crLABOUR']}"; $ev.=", {$coud['crLABOUR']} labour"; } if($coud['crAGIL'] > 0) { $upd.=",us.agility=us.agility+{$coud['crAGIL']}"; $ev.=", {$coud['crAGIL']} agility"; } if($coud['crIQ'] > 0) { $upd.=",us.IQ=us.IQ+{$coud['crIQ']}"; $ev.=", {$coud['crIQ']} IQ"; } $ev=substr($ev,1); if ($upd) { $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid"); } $db->query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'Congratulations, you completed the {$coud['crNAME']} and gained $ev!')"); } $db->query("UPDATE users SET course=0 WHERE cclicks=0"); ?>   My issue is it stop at "You are currently attending the The Fun Of Fishing course, you have 3 days remaining." after having enrolled. Staff area works great. etc. but stuck here. Also can anyone help construct a db query to see if a course has been completed or not? Basically locking features the manual way until the class is complete.
  23. No just a shop, you "walk into" it shows the list of items you have, and a buy price (the standard sell price set for that item). A shop that only buys items, not sells them. And while I do use your player shop, it's not an instant sale.
×
×
  • Create New...