Dave Posted September 16, 2013 Author Share Posted September 16, 2013 Ok so many thing don't work. I can't enter any requirement for chat channel. In my game and in your demo on your website. What going wrong ? Saving setting in chat setting do nothing. ( no probleme with this in your demo ) Warning: Invalid argument supplied for foreach() in /staff_chat.php on line 94 I dont want post line of code because is a paid code Thanks Sorry I didn't reply to your email over the weekend I've been very busy moving house. What version of McCodes are you using? If you're using Ravans there's code in sglobals.php which "attempts" to secure all $_POST & $_GET variables and as the data is passed through the system as a serialized string it breaks it. Quote Link to comment Share on other sites More sharing options...
secret_life Posted September 16, 2013 Share Posted September 16, 2013 Thanks for reply I got McCodes 2.0.2b my staff files was move to an other folder This is my sglobals.php <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } require "../global_func.php"; if($_SESSION['loggedin']==0) { header("Location: ../index.html");exit; } $userid=$_SESSION['userid']; require "../header.php"; include "../config.php"; global $_CONFIG; 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; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $domain=$_SERVER['HTTP_HOST']; global $jobquery, $housequery; if($jobquery) { $is=$db->query("SELECT u.*,us.*,j.*,jr.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON jr.jrID=u.jobrank WHERE u.userid=$userid"); } else if($housequery) { $is=$db->query("SELECT u.*,us.*,h.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.userid=$userid"); } else { $is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid"); } $ir=$db->fetch_row($is); if($ir['force_logout']) { $db->query("UPDATE users SET force_logout=0 WHERE userid=$userid"); session_unset(); session_destroy(); header("Location: ../login.php"); exit; } if($ir['user_level'] <= 1) { die("403: Access Denied"); } global $macropage; if($macropage && !$ir['verified'] && $set['validate_on']==1) { header("Location: ../macro1.php?refer=$macropage"); } check_level(); $h = new headers; $h->startheaders(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); global $atkpage; $staffpage=1; if($atkpage) { $h->userdata($ir,$lv,$fm,$cm,0); } else { $h->userdata($ir,$lv,$fm,$cm); } $h->smenuarea(); ?> I have create an other sglobals2.php without this line if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } Now All work but i have this line appears in chat box array(1) { [0]=> array(3) { [0]=> string(5) "level" [1]=> string(1) ">" [2]=> string(1) "0" } } I think this is my requirement unserialize. Why this appears in my chat box ? thanks Quote Link to comment Share on other sites More sharing options...
Dave Posted September 17, 2013 Author Share Posted September 17, 2013 Thanks for reply I got McCodes 2.0.2b my staff files was move to an other folder This is my sglobals.php <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } require "../global_func.php"; if($_SESSION['loggedin']==0) { header("Location: ../index.html");exit; } $userid=$_SESSION['userid']; require "../header.php"; include "../config.php"; global $_CONFIG; 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; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $domain=$_SERVER['HTTP_HOST']; global $jobquery, $housequery; if($jobquery) { $is=$db->query("SELECT u.*,us.*,j.*,jr.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON jr.jrID=u.jobrank WHERE u.userid=$userid"); } else if($housequery) { $is=$db->query("SELECT u.*,us.*,h.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.userid=$userid"); } else { $is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid"); } $ir=$db->fetch_row($is); if($ir['force_logout']) { $db->query("UPDATE users SET force_logout=0 WHERE userid=$userid"); session_unset(); session_destroy(); header("Location: ../login.php"); exit; } if($ir['user_level'] <= 1) { die("403: Access Denied"); } global $macropage; if($macropage && !$ir['verified'] && $set['validate_on']==1) { header("Location: ../macro1.php?refer=$macropage"); } check_level(); $h = new headers; $h->startheaders(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); global $atkpage; $staffpage=1; if($atkpage) { $h->userdata($ir,$lv,$fm,$cm,0); } else { $h->userdata($ir,$lv,$fm,$cm); } $h->smenuarea(); ?> I have create an other sglobals2.php without this line if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } Now All work but i have this line appears in chat box array(1) { [0]=> array(3) { [0]=> string(5) "level" [1]=> string(1) ">" [2]=> string(1) "0" } } I think this is my requirement unserialize. Why this appears in my chat box ? thanks Do you wanna contact me on Skype? Might be easier to determine what's going wrong. Add me on Skype at oxydennet Quote Link to comment Share on other sites More sharing options...
twison Posted January 1, 2014 Share Posted January 1, 2014 I recently purchased this mod and love it. I am having problems with trying to change the color of the names based on user level and if they have donated but everything I have tried just keeps breaking the chat. What I am wanting color wise is to have staff as maroon, donators as navy and the rest as black. Could this even be done with this mod? Quote Link to comment Share on other sites More sharing options...
Dave Posted January 1, 2014 Author Share Posted January 1, 2014 I recently purchased this mod and love it. I am having problems with trying to change the color of the names based on user level and if they have donated but everything I have tried just keeps breaking the chat. What I am wanting color wise is to have staff as maroon, donators as navy and the rest as black. Could this even be done with this mod? It runs all usernames through a function called username() on line 28 of chat_ajax.php. If you add in your if statement checks into this function and then wrap the username in a span with the appropriate colour defined in either a class or (if you're feeling lazy) in a style tag. You'll need to remember to change the query to select the username and user_level for your checks. Quote Link to comment Share on other sites More sharing options...
twison Posted January 1, 2014 Share Posted January 1, 2014 Thank you for the quick response. I will try that out. Wish me luck for I like most who come here am a noob at coding. lol How hard would you say it would be to put in a whisper or pm option? Quote Link to comment Share on other sites More sharing options...
Dave Posted January 2, 2014 Author Share Posted January 2, 2014 Thank you for the quick response. I will try that out. Wish me luck for I like most who come here am a noob at coding. lol How hard would you say it would be to put in a whisper or pm option? No problem! Good luck, it's not massively complicated just read up on if statements if you're unsure. if($user['user_level'] == 2) { // Show Admin Username } else if($user['user_level'] == 3) { // Show another username } else....... The way the system currently functions it would be surprisingly difficult. Really need to rebuild the system. Quote Link to comment Share on other sites More sharing options...
twison Posted January 2, 2014 Share Posted January 2, 2014 Thanks again I got it working. :) Quote Link to comment Share on other sites More sharing options...
twison Posted January 7, 2014 Share Posted January 7, 2014 Has anyone been able to make the option to close/open the chats? I have attempted it by putting the options into the account page then wrapping the chats in if statements but it only worked on the gane chat. No matter where I tried to wrap the if around the multi channel section it wouldn't let me chat in the chat anymore. The close/show worked but when trying to chat it'd say that the chat either didn't exist or I didn't have access to it. Quote Link to comment Share on other sites More sharing options...
Dave Posted January 7, 2014 Author Share Posted January 7, 2014 Has anyone been able to make the option to close/open the chats? I have attempted it by putting the options into the account page then wrapping the chats in if statements but it only worked on the gane chat. No matter where I tried to wrap the if around the multi channel section it wouldn't let me chat in the chat anymore. The close/show worked but when trying to chat it'd say that the chat either didn't exist or I didn't have access to it. Do you mean like leave a chat room? Quote Link to comment Share on other sites More sharing options...
twison Posted January 7, 2014 Share Posted January 7, 2014 Do you mean like leave a chat room? No I mean have it to where the chat won't show at all for someone who has that chat set to hidden. I was able to get the function to work like I wanted it to but only worked 100% with the gang chat. The multiple chat section however didn't work 100%. It would show and hide just fine but for some reason you could not chat in that chat what so ever even if it was not hidden. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 7, 2014 Share Posted January 7, 2014 (edited) make it a setting or requirement for the user and have them change it in preferences Edit: Let me go more into details and see if this works. I believe there is an option when creating the chats where you define certain requirements for the users to have to access the specific chat you are creating. So what you would do is make a new column in the users table and call it like "chat_open" set it enum, int, or whatever tickles your fancy. Then when creating/editing the chat you just add your requirement(s) for keeping the chat open for them. You can then add something in preferences for them to adjust accordingly. Personally I would make one for each chat you make and you can serialize it or encode it so its just still one column in the users table, this way they can keep maybe a certain chat open that they like the best Edited January 7, 2014 by KyleMassacre Quote Link to comment Share on other sites More sharing options...
Dave Posted January 7, 2014 Author Share Posted January 7, 2014 make it a setting or requirement for the user and have them change it in preferences Edit: Let me go more into details and see if this works. I believe there is an option when creating the chats where you define certain requirements for the users to have to access the specific chat you are creating. So what you would do is make a new column in the users table and call it like "chat_open" set it enum, int, or whatever tickles your fancy. Then when creating/editing the chat you just add your requirement(s) for keeping the chat open for them. You can then add something in preferences for them to adjust accordingly. Personally I would make one for each chat you make and you can serialize it or encode it so its just still one column in the users table, this way they can keep maybe a certain chat open that they like the best Didn't actually think about doing it like this Kyle. Good shout! You could even setup multiple variables in the user table 'global_chat','trade_chat' and then add that as a requirement. Quote Link to comment Share on other sites More sharing options...
twison Posted January 8, 2014 Share Posted January 8, 2014 make it a setting or requirement for the user and have them change it in preferences Edit: Let me go more into details and see if this works. I believe there is an option when creating the chats where you define certain requirements for the users to have to access the specific chat you are creating. So what you would do is make a new column in the users table and call it like "chat_open" set it enum, int, or whatever tickles your fancy. Then when creating/editing the chat you just add your requirement(s) for keeping the chat open for them. You can then add something in preferences for them to adjust accordingly. Personally I would make one for each chat you make and you can serialize it or encode it so its just still one column in the users table, this way they can keep maybe a certain chat open that they like the best I also didn't think to do it that way. Thank you Kyle. I will make a user_setting table to store that information since I have other things using a show/hide feature. Thanks again. :) Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 8, 2014 Share Posted January 8, 2014 A whole 'nother table would be wiser in my opinion instead of adding more stuff to the users table but that would require a lot more work when altering modules...... I take that back maybe just join the new table with users and userstats in the $ir variable in your globals. :p Either way, there are plenty of ways to go about this but the easiest way is just add more columns to the users table since from what I recall is this module grabs all cloumns from the users table in the chat box settings. Quote Link to comment Share on other sites More sharing options...
Dave Posted January 9, 2014 Author Share Posted January 9, 2014 A whole 'nother table would be wiser in my opinion instead of adding more stuff to the users table but that would require a lot more work when altering modules...... I take that back maybe just join the new table with users and userstats in the $ir variable in your globals. :p Either way, there are plenty of ways to go about this but the easiest way is just add more columns to the users table since from what I recall is this module grabs all cloumns from the users table in the chat box settings. As the chat is loaded on every page so you'll need those variables it's probably more efficient to join in the $ir query anyway. Providing you setup your foreign keys correctly! Quote Link to comment Share on other sites More sharing options...
spikereloaded Posted January 28, 2014 Share Posted January 28, 2014 any ideas on how to stop it from forcing the user to scroll to the bottom everytime it calls the ajax? making some modifications but this is the one that is annoying me the most as you can't see more than 4-5 messages up. Quote Link to comment Share on other sites More sharing options...
Dave Posted January 29, 2014 Author Share Posted January 29, 2014 any ideas on how to stop it from forcing the user to scroll to the bottom everytime it calls the ajax? making some modifications but this is the one that is annoying me the most as you can't see more than 4-5 messages up. Pretty simply! Open up chat_globals.php and find the function scrollBottom() and comment out it's contents (don't remove the function entirely). function scrollBottom() { //$('.chat_box').each(function() { // $(this).children('.chat_contents').scrollTop($(this).children('.chat_contents')[0].scrollHeight); //}); } Kinda thing Quote Link to comment Share on other sites More sharing options...
spikereloaded Posted January 29, 2014 Share Posted January 29, 2014 i've tried this, but this then means when you navigate to a new page, the chat box does not start at the bottom, meaning you have to scroll to the bottom to see the newest messages. I want it so that I can scroll up the messages without it forcing me to the bottom every 2 seconds when the ajax kicks in. Quote Link to comment Share on other sites More sharing options...
sniko Posted January 29, 2014 Share Posted January 29, 2014 i've tried this, but this then means when you navigate to a new page, the chat box does not start at the bottom, meaning you have to scroll to the bottom to see the newest messages. I want it so that I can scroll up the messages without it forcing me to the bottom every 2 seconds when the ajax kicks in. Make use of; $(document).ready( function() { }); Quote Link to comment Share on other sites More sharing options...
spikereloaded Posted January 29, 2014 Share Posted January 29, 2014 hmm thanks guys but still struggling, seems wherever I put the code, it doesn't seem to work. will have another look when i'm not as tired tomorrow! Quote Link to comment Share on other sites More sharing options...
Dave Posted January 30, 2014 Author Share Posted January 30, 2014 i've tried this, but this then means when you navigate to a new page, the chat box does not start at the bottom, meaning you have to scroll to the bottom to see the newest messages. I want it so that I can scroll up the messages without it forcing me to the bottom every 2 seconds when the ajax kicks in. Revert your changes to the scrollBottom(); function and then comment out where it's called just after the Ajax request. Then add this in <script /> tags $(document).ready( function() { scrollBottom(); }); Quote Link to comment Share on other sites More sharing options...
boots Posted April 29, 2014 Share Posted April 29, 2014 I have my colour names in my users db, cname, can you tel me how to add this to the script i have tried but still cant get it work i would also like to add viewuser from the chat box Quote Link to comment Share on other sites More sharing options...
Dave Posted April 30, 2014 Author Share Posted April 30, 2014 I have my colour names in my users db, cname, can you tel me how to add this to the script i have tried but still cant get it work i would also like to add viewuser from the chat box It would really depend on how you've stored the data. You'll just need to edit chat_ajax.php and change the part of the script where it pulls out the username and replace it with however you colour code names. Quote Link to comment Share on other sites More sharing options...
boots Posted April 30, 2014 Share Posted April 30, 2014 this is what i use <span color={$r['cName']}>{$r['username']}</span> but i try and add to the username part chat_ajax.php it dont work i know it something simple but I'm missing it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.