-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Make sure $kz is sorted, then foreach until the previous key = desired key. If it's not an exact match then pick whichever of the previous and current keys is closest.
-
I hate Mega. At least this time I was actually able to download something successfully. We will not reverse-engineer obfuscated code. If you need help with something, contact that person.
-
$focus[]=array($row['focus']);$focus is already an array. By doing this you're making it an array of arrays. Forget the array() part and just use $focus[]=$row['focus'];
-
size isn't valid on number inputs. Use CSS instead.
-
You can't prevent someone from listening to requests and faking their own. It's just not possible. The best thing you can do is rely on them being unable to read the game's code. Which isn't true, but it's harder than simply sniffing traffic. For example, you can hash some private key with the name and score (known as request signing) and get something like http://www.example.com/addscore.php?name=jimmy&score=100&signature=1234567890abcdefaddscore.php calculates and verifies the signature before recording the score.
-
It won't be. Remember what I said about not trying to outsmart the database? Really. Don't do it. All you have to do is put an index on the user ID in the table. That tells the database where to look for records for user #13. Then everything will work smoothly.
-
Very wasteful. Your application should never have to routinely modify your database schema. One log table and include the user ID in it. Remember that database servers are built for this exact kind of work. Don't try to outsmart them.
-
As you said, it's a credential error. Which means root@localhost with password "1234" was not allowed to connect. Which probably means the password is wrong. Don't use the root account to begin with. Create a new user with the permissions you need: connect as root successfully and run the query GRANT SELECT, INSERT, UPDATE, DELETE ON cms.* TO usernamegoeshere@localhost IDENTIFIED BY "password goes here"That will create a user with the common privileges; you won't be able to use it to do things like CREATE TABLEs or ALTER TABLEs, but those aren't the kinds of things you should be doing with this user anyways (temporarily use the root account for that). Then, of course, change the credentials in your code to match.
-
You need to make sure that you don't run the command if there was an error. Right now you set $error if a is bad, but as long as c is valid you'll execute the command. The code structure I prefer for this kind of thing goes like this: errors = array() if a is not valid { add error message for a } if c is not valid { add error message for c } if no errors { do stuff }
-
Unless you trust the HTML to be reasonably valid, it'd probably a good idea to run it through something like Tidy first. Just in case.
-
Variables do not work in single-quoted strings. Use double-quoted strings or string concatenation. But first your code is really, really unsafe. You may think the amount will be a certain thing (a number, I assume) but the code doesn't do anything to make sure that's the case. Someone could use a=whatever command I want in hereand have you execute aumix -v whatever command I want in hereIf amount is supposed to be a number then make sure it's an actual number: cast it like $amount = (int)$_GET['a'];and then make sure it's a valid number, like amount>0 and amount
-
No. The only way to avoid putting the port in the URL is if you can run something on port 80, which is the opposite of what you're trying to do.
-
The W3C has gone through great lengths to explain, in detail, exactly how processes like this work. HTML 5 Form Submission tl;dr: When submitting a form, 1. Browser does everything up to the actual navigation/request as normal 2. Uses the target to figure out where the request should be made 3. Makes the request (and handles the response, and so on) within that target It's not "print within that target" or "load the response in that target". When the browser is ready to submit the form - that is to navigate, with or without a request body - it does so in that tab/window/frame.
-
No. Once you provide the URL you stop being involved. Right. Yes.
-
The result from functions like file_exists() are cached for the duration of your script, if not longer. When the shell_exec() ends the files should be fully deleted. Use clearstatcache to clear the cache before you verify that.
-
getElementById() is what your next step will be, but as its name says it gets you an element - not an HTML string. Get the element, then pass it to $dom's saveHTML to get the HTML string.
-
Pass JS Variables without Output Buffering or XMLHttpRequest
requinix replied to rwhite35's topic in PHP Coding Help
What you have there isn't actually working: $windowwidth contains the Javascript code you wrote. It wasn't evaluated. Your script is simply outputting Window width is: <script> var wwidth = screen.width; document.write(wwidth): //output </script>If the PHP must have the width then you must push the user through some other page before then. No way around it.- 1 reply
-
- ob_start
- xmlhttprequest
-
(and 1 more)
Tagged with:
-
Now that you've announced your index99.html, you should take it down. I can see your code. And database credentials. Right. Blank page every time. Normally a blank page is the result of a parse error; as it so happens, line 199 is missing a semicolon and the if block on line 229 is unfinished. You should be getting error messages about this, and if not right on the page (a bad idea in production) then in some error logs. You also need to learn about SQL injection. It's a bad thing and you're vulnerable to it.
-
What's in your index.php? Not happening for me.
-
Make sure you put the file in the right place and that Apache can read it. Also make sure you've installed any dependencies there may be.
-
You can still use those lines but you can't put them in the .htaccess. Try the virtualhost config instead; if you have multiple sites and more than one needs it, in the global config.
-
With the same mechanism you used to put the make into the table: echo it. ">Which is a guess, since the code you've posted doesn't quite match up with the description you gave.
-
Upload multiple images but send them separately
requinix replied to GuitarGod's topic in Javascript Help
You could just alter the execution time: figure out how long a single image should take and multiply that by the number of images (then add a bit more just in case), change the time limit accordingly, and do your work. Processing multiple images at once will be a bit faster than each one individually, though I wouldn't expect there to be that huge of a difference. -
Have you looked at the server error logs yet?