Need help with stubborn PHP SQL error
Community Forums/General Help/Need help with stubborn PHP SQL error
| ||
Hi all. I need some help with a rather stubborn PHP SQL problem... So what's going on is that mysql_error() is returning Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource... I checked my UPDATE query in my PHP code, time & time again, yet I see NO problem with it. It is STILL returning this error, and I have NO idea what's going on. Can someone PLEASE help me fix it? Here's the link: http://pastebin.com/2Kv2xtzx Thanks to all who help! :) |
| ||
Maybe the error is here?$masterquery = "UPDATE `users` SET `user_id` = \"$genid\" WHERE `username` = \"$user_name\";"; $masterquery = "UPDATE `users` SET `user_id` = '".$genid."' WHERE `username` = '".$user_name."';"; |
| ||
Nope... I'm STILL getting supplied argument is not a valid MySQL result resource :( |
| ||
Apparently, the mysql_query() is returning 1, instead of a resource array..... :( how do i fix this? |
| ||
I'm no PHP/SQL expert, so correct me if I'm wrong, but doesn't MySQL UPDATE return 1 if successful, or 0 if not? If you intend to be parsing a resource array then you should be using SELECT. |
| ||
Well. Im just trying to stop ppl from logging in to the same account, either from the same ip, or a different ip, on different browsers. |
| ||
What about people who have a dynamic IP address? If you do that and their IP changes, they'll be stuck. |
| ||
You seem to devote a lot of energy to trying to stop users from doing entirely reasonable things. Do you document these unusual behaviours? Because if not, you're going to get a lot of bug reports when things suddenly appear to stop working. I still remember that time you wanted help deleting the user's files from their machine without permission (which, incidentally, was malware). Is this more of the same logic? |
| ||
deleting the user's files from their machine without permission (which, incidentally, was malware) Question of curiousity, a bit off-topic but I'll keep it brief: if a program were to include such behaviour in its actual EULA terms agreement - i.e. something like "by installing this program, you acknowledge that any files on your computer may be moved, renamed or deleted without notification" - would it still technically be malware? |
| ||
Um, no. i do not want anything to do with malware. i JUST wanna prevent people from taking advantage of my membership system by logging in and stealing bandwidth not to mention someone else who WANTS to use it right, and cant, because i had to delete the account due to account fraud..... -.- Last edited 2012 |
| ||
. Last edited 2012 |
| ||
I don't quite understand... You don't want people to log into their account, from a different IP address than the one they signed up with? Is this what your wanting to do? |
| ||
No no no. I just want to prevent membership fraud. How I do that, I really dont care, but I dont want any fraud. I also want to stop OTHER IPs from logging in to an account thats ALREADY logged in. Last edited 2012 |
| ||
No no no. I just want to prevent membership fraud. How I do that, I really dont care, but I dont want any fraud. I also want to stop OTHER IPs from logging in to an account thats ALREADY logged in. With most service providers using dynamic IPs, and so many folks having a range of internet-ready devices and using public wifi hotspots these days, what you're proposing to do is just not practical. |
| ||
what you need to do is check in the game/app whether they are logged in or not and if so dont let em log in again |
| ||
Ok, thanks Edzup :) |
| ||
the best way is have a timeout variable that increments every second this gets reset every packet they send and if it gets beyond a certain value they get kicked. As an example my networking system uses 120 seconds as a counter this can be changed in the program, when the player gets beyond the limit the server closes the connection and removes the player. Reasons for the system are in all games you have to have a timeout in case of dropped connections with this in mind its easier to keep track of with that idea than elaborate schemes. When someone logs back in after dropping they will have to wait for the server to kick the other old connection then allow them in again, there maybe other ways of doing this but this one seems to be in use quite a lot these days :) |
| ||
what you need to do is check in the game/app whether they are logged in or not and if so dont let em log in again Make sure that they are also -active- though, because it's really annoying if your application (or PC) crashes, or internet connection hiccups and severs the link, and then not being able to re-connect yourself because the server still think that you are already logged in. |
| ||
How would I check if they are active? |
| ||
Thundros: look at my previous post, best way is to send a ping packet I send 'Ping' in a network message to the clients once every twenty seconds and see how long they take to send 'Pong' back if they dont after the timeout period then they get removed as the connection is dead. |
| ||
nvm Last edited 2012 |
| ||
Ok, but how do i send a ping pong in PHP? Ive done it in blitz, but not in PHP. |
| ||
? |
| ||
EDIT: Nvm :) Last edited 2012 |