Trying to pass spaces along with ajax call. ‘word’ is been passed the same as ‘word ‘ i believe so. On the other hand two words need to be send completely with call. ‘word second’ but not the same as ‘word second ‘ Should I trim before call or do this on server …
Tag: php
PHP – make session expire after X minutes
i am using the following technique… From the login.php the form posts to the page check.php where i do this and on loggedin.php page the first thing i do is but once logged in when i directly type the url localhostmyProjectloggedin.php it displays the page…which makes perfect sense because the ses…
php mkdir() chmod and permissions
i was using this basic script: i create this directory and then upload photos to it. I’ve been doing this for a good 4-5 months now and suddenly i start getting ‘FORBIDDEN’ errors when I attempt to view the contents of the folder via web browser The directory is being created the same and th…
How do I set a MysQL variable (time_zone) from within doctrine / symfony?
I would like to know how I can set the MySQL time zone to UTC (SET time_zone = ‘UTC’) from within Symfony/Doctrine, so when I call a UNIX_TIMESTAMP() function on a DATETIME field in my query, it returns the UTC unix time and not unix time in the server’s time zone. How can I do this, either …
PHP – Debugging Curl
I’d like to see what the post fields in the request are before I send it. (For debugging purposes). The PHP library (class) I am using is already made (not by me), so I am trying to understand it. As far as I can tell, it uses curl_setopt() to set different options like headers and such and then it uses
How do I debug a webhook POST?
A webhook is sending me a POST, and I want to do some debugging on it. Currently I’m looping over the array and then sending a mail() to myself instead of printing (because how could I see what’s …
How insecure is a salted SHA1 compared to a salted SHA512
SHA1 is completely insecure and should be replaced. This question is 8+ years old and times have changed: https://arstechnica.com/information-technology/2017/02/at-deaths-door-for-years-widely-used-sha1-function-is-now-dead/ For passwords: https://en.wikipedia.org/wiki/PBKDF2 For data: SHA3 SHA512 is more com…
Adding days to $Date in PHP
I have a date returned as part of a mySQL query in the form 2010-09-17 I would like to set the variables $Date2 to $Date5 as follows: $Date2 = $Date + 1 $Date3 = $Date + 2 etc.. so that it returns 2010-09-18, 2010-09-19 etc… I have tried but this gives me the date BEFORE $Date. What is the correct
PHP method chaining or fluent interface?
I am using PHP 5 and I’ve heard of a new featured in the object-oriented approach, called ‘method chaining’. What is it exactly? How do I implement it? Answer It’s rather simple, really. You have a series of mutator methods that all return the original (or other) object. That way, you …
How to handle user input of invalid UTF-8 characters
I’m looking for a general strategy/advice on how to handle invalid UTF-8 input from users. Even though my web application uses UTF-8, somehow some users enter invalid characters. This causes errors in PHP’s json_encode() and overall seems like a bad idea to have around. W3C I18N FAQ: Multilingual …