scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
The problem is here: @move_uploaded_file($_FILES["file"]["tmp_name"], $target . $filename); $file_location = $target . $filename; if(file_exists($file_location)){ echo "Uploaded to <a href='$file_location'>$filename</a> <br />"; } else { echo "There was a problem saving the file. <br />"; } Having the "if file_exists" bit after move_uploaded_file is entirely pointless, because the operation already happened. Regardless, even though you get this "error", it should still have overwritten the file. You need to remove the "if file_exists" block if you want to overwrite files with existing name.
-
move_uploaded_file will overwrite existing files.
-
Haha, I like that one. lol yeah, I've been with my girlfriend for just over a year so I've been familiar with that one for a while. Well, sucks to be you I guess. EDIT: lolz, no pun intended
-
Haha, I like that one.
-
What do you mean?
-
Well played, Andy-H.
-
how do i pass a foreach loop through "Passing by Reference"
scootstah replied to ricky spires's topic in PHP Coding Help
I think you should check out this article on storing hierarchical data. -
The only thing is, is that you are essentially re-creating register globals. Which means you still suffer all of the problems from register globals. I realize (and hope) you are only doing this sort of thing with the $_SESSION array, but I feel it could still lead to unexpected bugs which may threaten the security of your application. It is a band-aid for outdated code, nothing more. The correct thing to do is go through the entire code base and update it as such that it no longer relies on register globals.
-
So why not use recaptcha then?
-
This is very easily accomplished with jQuery's Dialog widget.
-
htmlspecialchars() will let you view the HTML as plaintext, and strip_tags() will remove them completely.
-
There's a couple problems with using the ternary operator in this case. The first is that, it is sort of ugly when using an else-if. The second is that you have to set a value for when the condition fails. So you would have to do something like $var = condition1 ? 0 : condition2 ? 1 : someothervalue and then you would have to make sure it is one of the two values...which sort of defeats the purpose. Now, you could instead first check if print_change is set, and then use a ternary...which would be a lot cleaner. Something like: if (isset($_POST['print_change'])) { $reg_hardcopied = $_POST['print_change'] == 'no' ? 0 : 1; $query_print = "UPDATE tbl_registration SET reg_hardcopied = '$reg_hardcopied' WHERE reg_id = '$id_printed'"; mysql_query($query_print); }
-
how do i pass a foreach loop through "Passing by Reference"
scootstah replied to ricky spires's topic in PHP Coding Help
You could append the words to $output. foreach ($word as $words){ $output .= $words->text; } -
Remove the "&" before "new".
-
I can't answer your question because I've never used that site, but I would like to add that the Regular Expressions Tester Firefox add-on is pretty awesome for that.
-
serialize isn't going to magically validate it for you. In fact, serialize isn't going to validate anything at all. You need to do that before you begin to think about how to store it.
-
foreach ($order as $index) { if ($middle[$index]['hide'] != 0) echo '<br>'.$middle[$index]['section']; } Something like that?
-
Experiences and Opinions with Windows 8 Preview ?
scootstah replied to Glese's topic in Miscellaneous
Haha. If only Linux had better support for more mainstream Windows stuff. -
Because you're essentially saying "if this and this, OR this". See if this fixes it: elseif(($type == 2 && acc_status(getUsername()) > 1) && (!isset($_POST['title']) || !isset($_POST['content']))) This is saying "if this and this, AND this or this".
-
Experiences and Opinions with Windows 8 Preview ?
scootstah replied to Glese's topic in Miscellaneous
I don't want my PC to look like my cell phone. -
Disregard the pattern in my first post, this one will work a lot better: $str = '<b><font color=green>Get me out please </font></b><a><font color=green>Get me out please </font></a>'; $pattern = '/<font.*?>(.*?)<\/font>/i'; if (preg_match_all($pattern, $str, $matches)) { print_r($matches[1]); /* Array ( [0] => Get me out please [1] => Get me out please ) */ } Using preg_match_all will grab values in multiple font tags.
-
But what if a several users have hundreds of friends, and they all update at the same time? Now you are running 1000+ queries. I think this post on SO is what you want.
-
That's not how IN works. IN will update every row where the row is "in" the IN clause. There's a thread on the front page with the same question. http://www.phpfreaks.com/forums/index.php?topic=355124.0