I have a problem where i am losing the PHP session between 2 pages. The session_start() is included in a file called session-inc.php into every page requiring a session to be set. This works for all pages on the site except one particular page, member-profile.php. When this page is visited a new session with …
Tag: php
Finding the number of days between two dates
How to find number of days between two dates using PHP? Answer
PHP: filter_var sanitization secure enough?
I have a PHP script with the following line: Is this safe enough? How would you improve this code? Answer It is safe for that case, but for a more general approach, I’d rather use mysql_real_escape_string in conjunction with type casting: In the worst case, that will result in a 0 and will escape all ma…
Remove newline character from a string using PHP regex
How can I remove a new line character from a string using PHP?
Remove warning messages in PHP
I have some PHP code. When I run it, a warning message appears. How can I remove/suppress/ignore these warning messages?
regular expressions – same for all languages?
is the regexp the same between languages? for example. if i want to use it in javascript, would i have to search for regexp for javascript specifically. cause i got some cheat sheets. it just says regular expression. i wonder if i could use this on all languages, php, javascript and so on. Answer The basics a…
How to generate random date between two dates using php?
I am coding an application where i need to assign random date between two fixed timestamps how i can achieve this using php i’ve searched first but only found the answer for Java not php for example : Answer PHP has the rand() function: It also has mt_rand(), which is generally purported to have better …
Images not showing up with https
Suddenly, my images are not showing up on my site when accessing https pages. No change in my code. My host did have to recompile their ftp service with SSL support after my request (so I could ftpes my site). Can’t thing of anything else that would affect my SSL cert. Same thing happens on FF and IE an…
PHP and unit testing assertions with decimals
I have a method that returns a float like 1.234567890.I want to test that it really does so. However, it seems that this returned float has different precision on different platforms so how do I …
passing mysql_fetch_array to array()
how can i pass mysql_fetch_array() to array() Answer did you mean: