-
Posts
2,921 -
Joined
-
Last visited
-
Days Won
48
Content Type
Profiles
Forums
Events
Everything posted by KyleMassacre
-
Well if you used the DB class it's all handled for you when it comes to MySQL
-
I'm not understanding where the invalid user ID comes in. Because that is taken from the query string. viewuser.php?id=1
-
Pokemon Helios - Complete & Revised EDITION release..
KyleMassacre replied to CruZer's topic in Game Projects
Ohhh snaps, do we have a hack-off? -
Returning the host name may show if someone is using a proxy service which may have been a good thing way back in the day when V1/V2 was released. But finding people with proxies may not always be a good thing. Some countries that hate your country may ban access to any IPs registered with your country. So this may give them a chance to play your game. But what sniko suggests is pretty interesting and may be something worth looking into, especially if it's free.
-
Look at your IP in the DB and make sure it's a valid address
-
I think that is because you are still mixing. a resource is a query that was passed through $db->query(); and an object is for lack of a better term, a class initializer much like $db. If you want to use mysqli then go into your config.php and change the driver to mysqli and refrain from using mysqli_*() at all costs otherwise the scripts get confused because all your resources get passed through properties in your database class if you dont know what you are exactly doing. Also, $r is not a global variable. So new people coming here looking at this, please DONT get confused here. $r is just a commonly used variable that returns a result set for a number of different things in any given PHP script. But yes, $ir is in fact a global variable found in globals.php that stores in cache almost everything about the current logged in user. But, here we will go after the most common global variables that you mentioned inside of functions: $ir: Like I mentioned above, it stores information about the current user like everything in the users, and userstats tables. $c: Not needed. This is the connection string used for the database class. This was just something carried over from the V1/lite days $userid: This is equivalent to $_SESSION['userid'] or $ir['userid']. If you only need the user's id then use this. If you need more info for the user then use $ir. $db: Also like I said above, this is the database object to perform queries to your mysql database. As for your undefined indexes, I believe (could be wrong) since PHP 5.3 they started issuing E_WARNING/E_NOTICE for array indexes that were not checked. They do this so that the administrator can be notified of something that can potentially go wrong before it does go wrong. And for reference, the anatomy of an array: Your array is basically a multidimensional variable with an $array['key'] look. The key is also an index starting with 0 and ending with count($array) - 1. So: $array['key0'] = 1; $array['key1'] = 1; $array['key2'] = 1; $array['key3'] = 1; $array['key4'] = 1; So you will see 5 array keys but the first key would be 0 or key0 and the last would be 4 or key4. This is why PHP issues a warning so that you can prevent someone from trying to access $array[5] or $array['key5'] since it doesnt exist and trigger a critical error. The way to do this is to first check if the array key exists using (thats right) array_key_exists(). After that returns true you should check to see if the array and key => value pair match criteria that you want: //using my example above with $array if(array_key_exists('key0',$array)) // You may even get away with in_array(['key0','...'], $array) { // that key exists in this example so we will move forward if(isset($array['key0']) && ctype_digit($array['key0'])) { // the value is in fact set since it contains a value of 1 and it is a number which is what we want $myValue = $array['key0']; } else { throw new Exception('You must enter a value that is a number knuckle head!'); } } else { throw new Exception('What are you trying to pull here?'); }
-
Take a look at this: http://code.tutsplus.com/articles/sql-for-beginners-part-3-database-relationships--net-8561
-
mccode-v2 [Verify Addon - TornCity Style
KyleMassacre replied to Spudinski's topic in Free Modifications
what is the problem you are having? -
lost mod details need help with 1 line
KyleMassacre replied to boionfire81's topic in Modification Support
That line really shouldn't run if there isn't a bounty on them because of the bounty query string. I don't know the system you are actually using but you probably need to check if there is an active bounty and also check to see if the bounty query string exists in the URL -
The IP should not have anything to do with when the last time he logged in was. Something must have happened and his IP got messed up in the database
-
So I take it that like you said, it was 0s and 1s basically for true/false. So what you can do is something like: $drunk = $ir['drunk']; switch($drunk) { case $drunk > 1 && $drunk < 10: echo "You are getting pretty tipsy, you should slow down"; break; case $drunk > 11 && $drunk < 20 echo "Now your even more drunk"; break; // Just keep going with what you want to do here }
-
Account page layout with display pic upload
KyleMassacre replied to boionfire81's topic in Requests & In Production
I have no idea. I would have to install it and I don't really want to haha -
do you have inv_qty in your backpack and inventory table? If so, it may not know which one you are talking about so you need to prefix your column names in your select with the table alias'. Much like: select iv.inv_qty, etc, etc
-
I will admit, I am quite confused with what you mean. Any chance you can explain it a bit more?
-
I think it looks very clean. And good luck with this sale
-
Pretty good and all but there are much easier ways to go about this and could have saved you some time as well ;) You can take a look at this link: http://stackoverflow.com/a/1727150/3233912 But basically there is a timezone function that will spit the timezones in an array making a select list just that much easier and checking if they selected a valid tz
-
mccode-v2 Crimes (Players Can Go To Hospital)
KyleMassacre replied to jamboy1's topic in Free Modifications
Are you filling out all the fields correctly? -
mccode-v2 Hospital Explore Updated **TESTED**
KyleMassacre replied to boionfire81's topic in Free Modifications
Here is a gist that you can copy and run through phpfiddle: Gist Just change the iterations variable to suit and also the $method var can be either mt_rand or rand -
mccode-v2 Hospital Explore Updated **TESTED**
KyleMassacre replied to boionfire81's topic in Free Modifications
Nevermind, the forum broke my link since I am mobile -
mccode-v2 Hospital Explore Updated **TESTED**
KyleMassacre replied to boionfire81's topic in Free Modifications
This is debatable and I believe Guest knows a great resource to show a comparison of rand vs mt_rand. But I believe with such a small range you won't really see a huge difference in random number generation with mt_rand. And to test it with rand just change the mt_rand to rand -
Account page layout with display pic upload
KyleMassacre replied to boionfire81's topic in Requests & In Production
Instead of input type='text' it needs to be input type='file' But then you need to go above and beyond and validate that its an actual file by validating the image properties like file type, width, height, and file size. -
Because isset() only returns a bool so the cases for that could only be case true: and case false:
-
Because the warning isn't saying its null. The warning is saying that I hasn't been defined yet. This is where PHP gets stupid since $_GET and the like are global variables but it is trying to save you from a real error
-
You should stick to one thing. Your mixing mysqli with the $db wrapper