-
Posts
2,142 -
Joined
-
Last visited
-
Days Won
148
Content Type
Profiles
Forums
Events
Everything posted by Magictallguy
-
Whoops, sorry, that's my fault. Previous post updated
-
Run this query on the database (CLI, phpMyAdmin, SQLBuddy, Adminer, etc.) ALTER TABLE `work` MODIFY `workId` INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT My only guess now is that the `workId` hasn't been correctly set
-
Right, you'll need to restructure your query to include column name declarations. This is based on stock MC Craps $db->query('INSERT INTO `items` (`itmtype`, `itmbuyprice`, `itmsellprice`, `itmbuyable`, `weapon`, `armor`, `effect1_on`, `effect2_on`, `effect3_on`, `effect1`, `effect2`, `effect3`, `itmname`, `itmdesc`) VALUES ('.$_POST['itmtype'].', '.$_POST['itmbuyprice'].', '.$_POST['itmsellprice'].', '.$itmbuy.', '.$weapon.', '.$armor.', '.$_POST['effect1on'].', '.$_POST['effect2on'].', '.$_POST['effect3on'].', "'.$efx1.'", "'.$efx2.'", "'.$efx3.'", "'.$itmname.'", "'.$itmdesc.'")');
-
Your HTML was pointing GETDATA to job, not id or ID. $_GET['job'] = array_key_exists('job', $_GET) && ctype_digit($_GET['job']) ? $_GET['job'] : null; if(empty($_GET['job'])) { echo 'You didn\'t select a valid job rank'; exit($h->endpage()); } $sql = $db->query('SELECT * FROM `work_ranks` LEFT JOIN `work` ON `workId` = `rankJob` WHERE `workId` = `workFirst` AND `rankId` = '.$_GET['job']); if(!$db->num_rows($sql)) { echo 'That job rank doesn\'t exist'; exit($h->endpage()); } $r = $db->fetch_row($sql);
-
Chances are you're trying to insert a string into your INT field. Please provide the line of code generating this error, along with 5 lines above and 5 lines below (11 lines in total).
-
Use the code I've provided. The fact that it returns null suggests that whatever you're specifying in the GETDATA isn't a valid job rank. Also, make sure you're sanitizing anything coming from the user. Assuming you haven't already, add this above the SELECT query. $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : null; if(empty($_GET['ID'])) { echo 'You didn\'t select a valid job rank'; exit($h->endpage()); } So, the full sanitation and select should look like this: $_GET['job'] = array_key_exists('job', $_GET) && ctype_digit($_GET['job']) ? $_GET['job'] : null; if(empty($_GET['job'])) { echo 'You didn\'t select a valid job rank'; exit($h->endpage()); } $sql = $db->query('SELECT * FROM `work_ranks` LEFT JOIN `work` ON `workId` = `rankJob` WHERE `workId` = `workFirst` AND `rankId` = '.$_GET['job']); if(!$db->num_rows($sql)) { echo 'That job rank doesn\'t exist'; exit($h->endpage()); } $r = $db->fetch_row($sql);
-
Do you have an .htaccess in your public_html/www/htdocs directory? If so, what is the content of it?
-
As Coly said, not that code. However, I will ask anyway.. Why are you quoting an int? $sql = $db->query('SELECT * FROM `work_ranks` LEFT JOIN `work` ON `workId` = `rankJob` WHERE `workId` = `workFirst` AND `rankId` = '.$_GET['id']); if(!$db->num_rows($sql)) { echo 'That job rank doesn\'t exist'; exit($h->endpage()); } $r = $db->fetch_row($sql);
-
Just beat me to it [uSER=65530]Coly010[/uSER] :P [uSER=72582]boionfire81[/uSER], what is the content of $r?
-
Looking to purchase a Browser/Text Based Game!
Magictallguy replied to Just Ace's topic in Game Projects
It ain't much at the moment, but this might get you started -
PAID REQUEST - TC cloned member dropdown function
Magictallguy replied to boionfire81's topic in Requests & In Production
You'll need to import the jquery-ui.css and a jquery.js function getList($var = false, $value = false) { global $db; $selectUsers = $db->query('SELECT `username` FROM `users` ORDER BY `username` ASC'); $users = []; while($row = $db->fetch_row()) $users[] = $row['username']; ?><script> $(function() { var availableUsers = <?php echo json_encode($users);?>; $( "#users" ).autocomplete({ source: availableUsers }); }); </script><?php if($var) { $ret = '<div class="ui-widget">'; $ret .= '<input id="users"'; $ret .= ' name="'.$var.'"'; if($value) $ret .= ' value="'.$value.'"'; $ret .= ' autofocus />'; return $ret; } } Usage (as part of a form): Returns an input box with a list of all users, with a $_REQUEST (_POST/_GET) named data_name_for_form. echo getList('data_name_for_form'); Returns an input box with a list of all users, request data named user, automatically filled with $value //Assuming getdata has been sanitized $selectUser = $db->query('SELECT `username` FROM `users` WHERE `userid` = '.$_GET['id']); $value = $db->num_rows($selectUser) ? $db->fetch_single($selectUser) : null; echo getList('user', $value); I'll take that $50, if that's still going, thanks. -
This is assuming you've sanitized the getdata $q = $db->query('SELECT `inv_userid`, `inv_itemid`, `itmname`, `itmtype` FROM `inventory` INNER JOIN `items` ON `inv_itemid` = `itmid` WHERE `inv_userid` = '.$ir['userid'].' AND `itmid` = '.$_GET['ID']); if(!$db->num_rows($q)) { echo 'Either that item doesn\'t exist or it\'s not yours'; exit($h->endpage()); } $r = $db->fetch_row($q); if($r['itmtype'] != 15) { echo 'You can\'t buy ammo for the '.$r['itmname']; exit($h->endpage()); }
-
Change form action="staff_userlogs.php?action=viewlogs" to form action="staff_userlogs.php?action=whatever_goes_here_to_access_the_original_form_function"
-
Untested.. function view_user_logs() { global $db, $ir, $sa; $_GET['user'] = array_key_exists('user', $_GET) && ctype_digit($_GET['user']) ? $_GET['user'] : null; ?>Select the user which you want to view their log. <form action="staff_userlogs.php?action=viewlogs" method="get"> User: <?php echo userlogged_dropdown(NULL, 'user', $_GET['user']);?><br /> <input type="submit" value="Submit" /> </form><?php if(!empty($_GET['user'])) { $st = array_key_exists('st', $_GET) && ctype_digit($_GET['st']) ? $_GET['st'] : 0; $app = 100; if(empty($_GET['user'])) error('Invalid user.'); $query = $db->query('SELECT COUNT(`uUSERID`) FROM `user_logs` WHERE `uUSERID` = '.$_GET['user']); $logs = $db->fetch_single($query); $db->free_result($query); if ($logs == 0) error('There have been no logs yet from this user.'); $pages = ceil($logs / $app); $q = $db->query('SELECT `userid` FROM `users` WHERE `userid` = '.$_GET['user']); if ($db->num_rows($q) == 0) { $db->free_result($q); error('User doesn\'t seem to exist, Please go back and try again.'); } $query = $db->query('SELECT `uID`, `uUSERID`, `uADDRESS`, `uTIME` FROM `user_logs` WHERE `uUSERID` = '.$_GET['user'].' ORDER BY `uTIME` DESC LIMIT '.$st.', '.$app); ?><hr width="75%"><table width="75%" cellpadding="1" cellspacing="1" class="table"> <tr> <th>User</th> <th>Address</th> <th>Time</th> </tr><?php if(!$db->num_rows($query)) echo '<tr><td colspan="3" class="center">There are no logs available</td></tr>'; else while($r = $db->fetch_row($query)) { ?><tr> <td><?php echo $sa->username_nonformat($r['uUSERID'], true);?></td> <td><?php echo $r['uADDRESS'];?></td> <td><?php echo date("F j, Y, g:i:s a", $r['uTIME']);?></td> </tr><?php } ?></table><hr width="75%"> Pages: <?php for($i = 1; $i <= $pages; ++$i) { $s = ($i - 1) * $app; echo ($s == $st) ? '<b>' . $i . '</b> ' : '<a href="staff_userlogs.php?action=viewlogs&st=' . $s . '&user='.$_GET['user'].'">' . $i . '</a> '; echo ($i % 25 == 0) ? '<br />' : ''; } $mypage = floor($_GET['st'] / 100) + 1; stafflog_add('Viewed ' . $sa->username_nonformat($_GET['user'], true) . ' user logs. (Page: '.$mypage.')'); } }
-
mccode-v2 New and improved inventory code sources for free!
Magictallguy replied to MDK666's topic in Free Modifications
The code snippet you posted is broken in multiple areas. Also, to handle your undefined index notice; in this case, simply wrap it in isset() if(isset($equip[$ir['equip_helmet']]['itmid'])) -
mccode-v1 [mccode] delete gang after respect hit 0
Magictallguy replied to iseeyou94056's topic in Free Modifications
Jeez.. 6 year gravedig much.. Still, updated code: $ids = []; $queryGangs = $db->query('SELECT `gangID` FROM `gangs` WHERE `gangRESPECT` < 1'); if($db->num_rows($queryGangs)) while($row = $db->fetch_row($queryGangs)) $ids[] = $row['gangID']; if(count($ids)) { $targets = implode(',', $ids); $db->query('DELETE FROM `gangs` WHERE `gangID` IN ('.$targets.')'); $db->query('DELETE FROM `gangwars` WHERE `warDECLARER` IN ('.$targets.') OR `warDECLARED` IN ('.$targets.')'); $db->query('UPDATE `users` SET `gang` = 0 WHERE `gang` IN ('.$targets.')'); } -
function create_item() { global $db, $ir, $h; $select = $db->query('SELECT *, `itmname` FROM `workshop` INNER JOIN `items` ON `wITEM` = `itmid` WHERE `wACTIVE` = 1 AND `wLEVEL` <= '.$ir['level'].' AND `wDONATOR` <= '.$ir['donatordays'].' AND `wDAYSOLD` <= '.$ir['daysold'].' ORDER BY `wITEM` ASC'); ?><table border="1" width="85%"> <tr> <th colspan="4" class="center">Here Are The Items You Can Currently Create</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><?php $reqs = ''; $costs = ''; if(!$db->num_rows($select)) echo '<tr><td colspan="4" class="center">There are currently no items available for you to create</td></tr>'; else while($row = $db->fetch_row($select)) { $costs .= $row['wCOST'] ? '$'.number_format($row['wCRYSTALS']).'<br />' : ''; $costs .= $row['wCRYSTALS'] ? number_format($row['wCRYSTALS']).' crystal'.($row['wCRYSTALS'] == 1 ? '' : 's').'<br />' : ''; $reqs .= $row['wDAYSOLD'] ? number_format($row['wDAYSOLD']).' Day'.($row['wDAYSOLD'] == 1 ? '' : 's').' Old<br />' : ''; $reqs .= $row['wLEVEL'] ? 'Level '.number_format($row['wLEVEL']).'<br />' : ''; $reqs .= $row['wDONATOR'] ? number_format($row['wDONATOR']).' Donator Day'.($row['wDAYSOLD'] == 1 ? '' : 's').'<br />' : ''; ?><tr> <td><?php echo $row['itmname'];?></td> <td><?php echo substr($reqs, 0, -6); $selectRequiredCourse = $db->query('SELECT `cnCOURSE` FROM `coursesneeded` WHERE `cnID` = '.$row['wITEM']); if($db->num_rows($selectRequiredCourse)) { $selectCourse = $db->query('SELECT `crNAME` FROM `courses` WHERE `crID` = '.$db->fetch_single($selectRequiredCourse)); if($db->num_rows($selectCourse)) echo '<ul><li><a href="education.php">'.$db->fetch_single($selectCourse).'</a></li></ul>'; } ?></td> <td><?php echo substr($costs, 0, -6); $selectRequiredItem = $db->query('SELECT `nITEM` FROM `itemsneeded` WHERE `nID` = '.$row['wITEM']); if($db->num_rows($selectRequiredItem)) { $selectItem = $db->query('SELECT `itmid`, `itmname` FROM `items` WHERE `itmid` = '.$db->fetch_single($selectRequiredItem)); if($db->num_rows($selectItem)) { $item = $db->fetch_row($selectItem); echo '<ul><li><a href="iteminfo.php?ID='.$item['itmid'].'">'.$item['itmname'].'</a></li></ul>'; } } ?></td> <td class="center"><a href="workshop.php?action=cconfirm&ID=<?php echo $row['wITEM'];?>">Create This Item</a></td> </tr><?php } ?></table><?php }
-
php code check no errors found??
Magictallguy replied to boionfire81's topic in Modification Support
Also, else statement is incorrect. Change the if() statement if(!$ir['gang']) { echo 'You\'re not in a gang'; exit($h->endpage()); } -
php code check no errors found??
Magictallguy replied to boionfire81's topic in Modification Support
I know my code when I see it.. Could just ask me for help.. -
Use jQuery's Tooltip as a basis and just work the information in
-
That particular piece of code shouldn't affect the typing. Ask [uSER=52003]Dave Macaulay[/uSER] for a hand, that is his code, after all
-
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>
-
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 } }
-
The folder extracts as JBBCode (capital J). Either update your require path, or rename the directory $parser->parse(nl2br($r['example'])); echo $parser->getAsHTML();