-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
I hope you're using SSL for these uploads..?
-
That's correct. You would need to add an ampersand at the assignment and within the function declaration, to return and assign by reference: [...] public function &GetInvConfig() { [...] $configuracion = &$_SESSION['reg']->GetInvConfig(); Although the arrays would have to be large to make much of a difference to the memory usage. Also just be aware that any changes you make to the array would be reflected within the object.
-
I use both too, but I wrap them in a function and pass in constants I define at the top of every page to tell it which to use: define('PRINTORECHO_PRINT', 'print'); define('PRINTORECHO_ECHO', 'echo'); function printOrEcho($str, $func) { // can't be too careful if ($func == 'print' || $func == 'echo') { call_user_func($func, $str); } } printOrEcho('Hello', PRINTORECHO_PRINT); It's a little more code, but I like to type. You guys can use it if you want..?
-
day(dob)='$myDate' Sorry day() yeah, not date().
-
@cyberRobot It would be better to use the built-in MySQL functions for this, to avoid splitting the logic and it's a lot more efficient than using a LIKE statement. @wilna Ah okay great - though that wasn't what you said originally. Anyway you want to use the DATE() and MONTH() functions to do this: select * from table where date(dob) = 16 and month(dob) = 5;
-
You'll need to use the proper 'date' data type first, which will store the date in the format "YYYYMMDD".
-
Got a Twitt0rrr Idea -> Possible? and Is It Hard to Do?
Adam replied to chaseman's topic in Miscellaneous
I think the biggest time consumer would be in researching the Twitter API, but you seem to be half way there at least anyway. As for other services not providing it, perhaps it's not really that desirable. I don't go near Twitter myself, but why would you want to follow 100 or so random people that someone else does? -
Make sure you read it all. If you skip ahead you'll miss the theory and explanation behind it, and although you can produce the final product you still won't how or why you're doing it like you are.
-
Top tips there, if you are considering approaching children in public..?
-
Post form resubmits when going back in browser history
Adam replied to PHPSuperNewb's topic in PHP Coding Help
Actually thinking about it, I'm not sure if this will work. I need a computer to test it!! -
Post form resubmits when going back in browser history
Adam replied to PHPSuperNewb's topic in PHP Coding Help
When the user logs out, store the current session_id and then regenerate it but retain that piece of data; that means you'll want to manually remove the other session data instead of using session_destroy to flatten it. Within the login code, check if this session 'session ID' variable has been set and compare it to the current session_id. As the cookie will hold the value of the new session ID, but the session variable will contain the old one; you just need to check if they're equal OR the session 'session ID' variable isn't set, for a valid login. I can't actually test this right now, but in theory it should work. Ha.. It would be a lot easier if you could just redirect them at the point of login though. -
Post form resubmits when going back in browser history
Adam replied to PHPSuperNewb's topic in PHP Coding Help
There's no way for a website to modify the user's history; that in itself would be a security threat. You may not have seen my edit, but you could always add in some logic that would void the re-submission login attempt. -
Post form resubmits when going back in browser history
Adam replied to PHPSuperNewb's topic in PHP Coding Help
You can't, because the back button recreates the previous request with all it's header information. Even redirecting to another URL won't prevent clicking back a few times and re-submitting the POST data - just the way it works. In terms of security there's no great threat, after all the user did enter that information in the first place. What you should do is try to remove their need to hit the back button, by redirecting them to the page they were at before (if possible without a login) or giving them options of where to go. Edit You could also add in some logic that would void that login attempt, so even if they did re-submit the data they wouldn't be logged in. -
imagecreatetruecolor You need to use imagecreate instead, which creates a blank image identifier.
-
In the drop-down menu for the "Console" tab are options to enable certain types of errors/warnings. You probably had all/most of them ticked, and so re-installing FF4 reset them to their defaults.
-
Okay, right.. cd to the Apache directory within /etc/ and run the following grep search: grep -r ErrorLog * That should find the ErrorLog directive which contains the path to the server's error log.
-
Seems odd that you'd want to split the array like that. Given the data you're working with, an array would make things easier for yourself in terms of looping and access. Never the less... If you want to do this dynamically, you'll need to use a variable variable to dynamically create the variable name with the 1, 2, 3 etc. on the end. I'm not sure by your example data whether the existing region keys contain 'region<#>' or just '<#>', so will provide the code for both. If the keys are 'region<#>': $grade = array( 'region1' => array( 1 => 'value', 2 => 'value' ), 'region2' => array( 3 => 'value', 4 => 'value' ) ); foreach ($grade as $key => $region) { $$key = $region; } print_r($region1); print_r($region2); .. And if the keys are just '<#>': $grade = array( 1 => array( 1 => 'value', 2 => 'value' ), 2 => array( 3 => 'value', 4 => 'value' ) ); foreach ($grade as $key => $region) { $var_name = 'region' . $key; $$var_name = $region; } print_r($region1); print_r($region2); As I said before though, I think you'd be better off keeping the data within an array.
-
If you have SSH access, to prevent you having to download a 45mb log file, just use: cat error_log | less That will show you the first x lines of the log (x depending on the size of your screen) so you'll be able to tell first if it's the right one.
-
Those are specific to your hosting provider, likely a shared hosting, which is why they've been set-up within your home directory ("~/") as you won't have access to the root directories. On a dedicated server StefanRSA, you'll probably have the normal paths to the log files. Unfortunately that can vary between Unix distributions, so you may need to look around a bit. You should be able to find the Apache files within /etc/httpd/ or /etc/apache2, which should have an alias to the logs directory. In there you should be able to find the Apache error log. Edit If not you can use the grep or find commands to find the file.
-
I couldn't say to be honest, I don't use cPanel. Do you have SSH access to the server? I'd guess that if the search is working on and off, the server doesn't like what it's doing (albeit performance issues, high memory usage, etc.) and is failing occasionally. What kind of hosting do you have?
-
Does it show the server error every time you search for "spa bath", or sporadically? Also are you sure you're checking the Apache error log, and not PHP's error log?
-
"display_errors" and "error_reporting" are for PHP-level errors, not Apache server errors. Generally the two aren't related, but there's certain situations where PHP code could cause a server error. Infinite redirect loops are a common cause for getting an odd 500 error, and bad rewrite rules / server configuration as I think jonsjava is getting at. Also remember that Apache's error log is not the same as the PHP error log. What do you actually do in the code behind this page that doesn't work?
-
How will you update the session variable each time they tab to the next field?
-
How are you binding the key event to the window? When you say you have to refresh to get it to work, does simply clicking the window make it work again? I ran into a little issue the other week in FF4 where I was using alerts to debug, but they were taking focus away from the window and the event wasn't firing. I notice there's some alerts (albeit commented out presently) in your code... If not I would guess it's something to do with the macro / "autohotkey" script you're using, as opposed to the JavaScript - but show us how you're binding it.
-
You need to attach the key(press|up|down) event to the window, and use the event object to determine the key pressed. Certain keys however are only catchable for certain events. What keys are you wanting to capture -- which will you programme the pedal to?