boionfire81 Posted March 27, 2016 Share Posted March 27, 2016 As mysql's site no longer offers the tool, can you help me mtg? Quote Link to comment Share on other sites More sharing options...
G7470 Posted March 28, 2016 Share Posted March 28, 2016 As mysql's site no longer offers the tool, can you help me mtg? If you're on MCCodes V2.0.5 (which judging by your posts on several mods you are), this can be done via the config file. In the config, there is a "driver" setting. Change that from 'mysql' to 'mysqli'. ~G7470 Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 28, 2016 Author Share Posted March 28, 2016 Yeah updated the driver. Now hopefully upgrading to php 7 works too :) Quote Link to comment Share on other sites More sharing options...
G7470 Posted March 28, 2016 Share Posted March 28, 2016 Yeah updated the driver. Now hopefully upgrading to php 7 works too :) I haven't tested out php 7 with MCCodes, so I have no idea whether or not that will work. I would be surprised if it worked without any issues tbh. ~G7470 Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 28, 2016 Share Posted March 28, 2016 (edited) It should work pretty well. I don't think MCC uses that much deprecated/obsolete functions going from 5.6 Here is something to look at: http://php.net/manual/en/migration70.php Edited March 28, 2016 by KyleMassacre Add migration link Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 28, 2016 Author Share Posted March 28, 2016 so far so good Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 28, 2016 Author Share Posted March 28, 2016 Here is one I found...And Kyle I KNOW....but is action now an issue? switch ($_GET['action']) { case "add": add_contact(); break; case "remove": remove_contact(); break; default: contacts_list(); break; } A non-critical error has occurred. Page execution will continue. Below are the details: PHP Notice: Undefined index: action (8) Line executed: /home/public_html/contactlist.php:39 And yes it's just a notice the page does display. But the notices are there for a reason. I feel fixing notices can help prevent more issues in the future. Quote Link to comment Share on other sites More sharing options...
G7470 Posted March 28, 2016 Share Posted March 28, 2016 This "notice" is exactly the same as what you have described on this post: http://makewebgames.io/forum/game-engines/mccode-development-support/engine-support/375764-error-on-every-page-almost ~G7470 Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 29, 2016 Author Share Posted March 29, 2016 Yes, but the undefined index is switch ($_GET['action']) { case "add": add_contact(); break; case "remove": remove_contact(); break; default: contacts_list(); break; } and GET action has never been a variable that I'm aware of. So was just wondering if it was a php 7 thing. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 29, 2016 Share Posted March 29, 2016 It's not a variable it's an array key also known as an array index Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 29, 2016 Author Share Posted March 29, 2016 well whatever it is. It's in contact list which is a standard mccode 2.0.5 file. So there are definitely going to be issues with the php 7. Not to mention after how many attempts there is still no clear definition of how to get rid of these undefined. I've been able to understand most of what you guys have said. But for whatever reason undefined slips past me every time >.< Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 29, 2016 Share Posted March 29, 2016 There is a clear definition since I have told you how at least 3 times ;) I don't want to tell you exactly how to do it because you won't learn Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 29, 2016 Author Share Posted March 29, 2016 Well half of the time the issue was simply not including the $value in the SELECT from. But I have seen so many ways of defining a variable/array it's ridiculous. What I do know is a variable is basically a constant. Representing an item or amount. While an array is several values. That's all I have understood so far. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 29, 2016 Share Posted March 29, 2016 (edited) An array is a dictionary of keys/indexes and their values. It's basically a multi-dimensional variable. This is pretty much exactly why you need to check your arrays before using them for example: $data = array( 'index1' => 10, 'index2' => 5, ); echo $data['index3']; // will result in an error 'undefined index index3 (6)' $data['index3'] = 1; echo $data['index3']; // will return 1 These errors can easily be avoided by using things such as isset() or array_key_exists() but these are different: http://codepad.org/SDsWmLmq Edited March 29, 2016 by KyleMassacre Added code pad link Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted March 29, 2016 Author Share Posted March 29, 2016 ok, so in this case switch ($_GET['action']) { case "add": add_contact(); break; case "remove": remove_contact(); break; default: contacts_list(); break; } the default is not defined. but the default does not have an action. Soooo????? Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 29, 2016 Share Posted March 29, 2016 Can you start a new topic because this is going way off topic and I can't figure out for the life of me how to split this on my phone. And I am at work. When I get a chance after work I will merge all of these into that new topic Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted March 30, 2016 Share Posted March 30, 2016 *sigh* Please actually read the answers granted. Add: $_GET['action'] = array_key_exists('action', $_GET) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; if you want it to be done properly in this case, or if(!isset($_GET['action'])) $_GET['action'] = ''; if not - above the switch($_GET['action']) Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 30, 2016 Share Posted March 30, 2016 *sigh* Please actually read the answers granted. Add: $_GET['action'] = array_key_exists('action', $_GET) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; if you want it to be done properly in this case, or if(!isset($_GET['action'])) $_GET['action'] = ''; if not - above the switch($_GET['action']) A little overkill on it much haha. The switch statement will handle most of the security you provided by going to the default if it's not one of the cases defined right? FYI.... I moved this to a new topic from here: http://makewebgames.io/forum/general-development-central/services/24426-free-mysql-to-mysqli-conversion Quote Link to comment Share on other sites More sharing options...
Dominion Posted March 30, 2016 Share Posted March 30, 2016 It should work pretty well. I don't think MCC uses that much deprecated/obsolete functions going from 5.6 Here is something to look at: http://php.net/manual/en/migration70.php Has mccodes had a version update recently or is the class still the same just adding the i? No prepared statements etc... Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 30, 2016 Share Posted March 30, 2016 Its basically bare minimum mysqli Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted March 30, 2016 Share Posted March 30, 2016 A little overkill on it much haha. The switch statement will handle most of the security you provided by going to the default if it's not one of the cases defined right? FYI.... I moved this to a new topic from here: http://makewebgames.io/forum/general-development-central/services/24426-free-mysql-to-mysqli-conversion Perhaps, but this also filters in for SilLYCaSe actions. without strotlower() file.php?action=SomEThing = default with it file.php?action=SomEThing = whatever "something" is. Good for developers who make typos or catch the shift key too often (I have done both many times) Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 30, 2016 Share Posted March 30, 2016 Agreed, but I wasn't even talking about that. I was more on the ctype* and trim Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted March 31, 2016 Share Posted March 31, 2016 Aye, perhaps it be a little overkill, I just like to cover as many bases as possible. For most, though: if(!isset($_GET['action'])) $_GET['action'] = null; should be enough (though I would recommend the use of array_key_exists() over isset() in these cases Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted March 31, 2016 Share Posted March 31, 2016 Aye, perhaps it be a little overkill, I just like to cover as many bases as possible. For most, though: if(!isset($_GET['action'])) $_GET['action'] = null; should be enough (though I would recommend the use of array_key_exists() over isset() in these cases Correct which was why I posted the little snippet to show the main difference between the two 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.