-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
You're not doing a great job of explaining the problem here. What is it you're trying to do exactly? As litlebearer asked a while back, what do you mean by not using 'echo'? Does the crop.php script return an image, otherwise why are you using an image tag to call a script that performs operations on the file system?
-
You mean like..? if (!empty($stipulation)) { echo '<h3 class="title">'; if (!empty($title)) { echo $title . ' '; } echo 'Championship Match</h3>'; }
-
When you say from another page, do you mean another file that is included on this request, or from a completely different request? In-case of the latter, session_start must be called on EVERY request you want to use it.
-
Take a look at how callbacks work. Out of interest, php.net is running awful slow for me. Is it you?
-
MySite needs criticism|feedback|help|no content|ergh
Adam replied to Minimeallolla's topic in Website Critique
You have a doctype. Fix the errors the validator is reporting, add content, and re-read the ideas people gave you before. -
Reason you're having problems is because the 'e' modifier struggles with object callbacks (which is presumably why preg_replace_callback exists). Personally I'd loop through the array and replace them one at a time, but using preg_replace_callback().
-
MySite needs criticism|feedback|help|no content|ergh
Adam replied to Minimeallolla's topic in Website Critique
This is like the third topic for this in about a week. People gave you ideas before.. http://validator.w3.org/check?uri=http%3A%2F%2Fwww.mysite.giacjr.dino-hosting.net There's still no real content to critique? .. there's also a heap of ideas between the responses you got before. -
No. As I said you want to validate the timestamp after you've checked if the form was submitted, and handle the error as you have done previously. In your case: session_start(); // note this! if (isset($_POST['submit'])) { if (isset($_SESSION['post_expire']) && $_SESSION['post_expire'] > time()) { // user posted last then 10 seconds ago die('You posted less than 10 seconds ago.'); } // (...) I flipped the logic within the condition as you're handling the errors differently to as I expected -- which by the way I'd look into exceptions for better error handling when you're ready. At the point at which you make the insert you also need to set/update the session variable for the next time this code is run for that user: // make post $add_member = mysql_query($insert); // set post expire $_SESSION['post_expire'] = strtotime('now + 10 seconds');
-
Wait why are you using double backslash? That'll escape the first so you're using the literal "\1".
-
And your problem is..?
-
@upp That's PHP, mcmuney requested a SQL update statement. Pus your code has a few problems with it, mainly what if the value had a space in the middle? You'd remove them all regardless of position. If you did want to do something like this in PHP you could just use trim, or rtrim if you only wanted to remove trailing spaces.
-
What data type are you using? MySQL varchars will have trailing spaces removed automatically.
-
You need to use mysql_query .. not $mysql_query(). In PHP variables start with a dollar, functions don't. That's what the second error is trying to tell you, and the first isn't technically an error but a notice; informing you that you're trying to use a variable that doesn't exist. Of course in this situation it's because it thinks you're trying to access the variable $mysql_query.
-
You could use a session variable to store a timestamp 10 seconds in the future. Set that as they make a post, and validate them by checking if the variable has been set, or if the value is more than the current time: if (!isset($_SESSION['post_expire']) || $_SESSION['post_expire'] > time()) { // make post // ... // set post expire $_SESSION['post_expire'] = strtotime('now + 10 seconds'); } else { // user posted last then 10 seconds ago } Don't forget to start the session with session_start.
-
Don't you mean it would return `songs_id` 1, 2 & 3? .. Since `id` 3 & 8 have `songs_id` 3?
-
The example you provided uses AJAX to request the content, which unfortunately you can't cross-domain (right now at least). There are a number of alternatives you could look into though.
-
I was about to suggest preg_replace_callback(), but he's passing arrays.
-
SQLite: * installed by default >= PHP5 * 'lite' * fast * simple * file-based
-
You need to use the 'e' modifier: Take a look at example 4 on the manual.
-
Do you have this online that we could look at, or the full HTML we could run ourselves? It's hard to say why it's giving the error when we can only see a small amount of the actual code. Really? I find it far easier to style a button. Plus you're making it unusable for those with JS disabled.
-
Ahhh, sorry. I misread what it was you were trying to do. Incidentally you could also have done this with a closure: (function(n) { link.onclick = function() { alert("Counter was "+n+" when onclick handler was attached"); return false; } })(n);
-
What you're trying to do doesn't make sense. Every time you hover over the element you're going to reassign the onclick event, using the current value of n.
-
Code will not work after adding sha1 and salt encryption
Adam replied to rightone's topic in PHP Coding Help
Hmm well what I said is right, not sure what he was thinking there. Then again, just because he has an IT diploma doesn't necessarily mean he knows anything about databases. The only time the char type would prove better for memory in this situation, is if the username length was the full 30 characters. In which case a varchar would need to use an extra byte (so 31 in total) to store the length; < 29 though and you're making a profit. That said, realistically, it's unlikely this will ever cause you problems.. So I wouldn't worry about it. -
It would help if you provided us with some more information; what does / doesn't work, what output you receive, etc.